Add pagination example

This commit is contained in:
Brian Beck 2016-11-26 12:03:46 -08:00
parent f018034808
commit 177a9baf55

View file

@ -20,6 +20,7 @@ to help construct your query.
- [Environment Variables](#environment-variables)
- [Debugging](#debugging)
- [Example Queries](#example-queries)
- [Pagination](#pagination)
- [Questions](#questions)
- [Schema](#schema)
@ -143,6 +144,49 @@ Nirvana albums and each albums singles:
}
```
### Pagination
The first five labels with “Apple” in the name:
```graphql
{
search {
labels(query: "Apple", first: 5) {
...labelResults
}
}
}
fragment labelResults on LabelConnection {
pageInfo {
endCursor
}
edges {
cursor
node {
mbid
name
type
area {
name
}
}
}
}
```
…and the next five, using the `endCursor` from the previous result:
```graphql
{
search {
labels(query: "Apple", first: 5, after: "YXJyYXljb25uZWN0aW9uOjQ=") {
...labelResults
}
}
}
```
## Questions
**Whats with the cumbersome `edges`/`node` nesting? Why `first`/`after`