mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
Add pagination example
This commit is contained in:
parent
f018034808
commit
177a9baf55
1 changed files with 44 additions and 0 deletions
44
README.md
44
README.md
|
|
@ -20,6 +20,7 @@ to help construct your query.
|
||||||
- [Environment Variables](#environment-variables)
|
- [Environment Variables](#environment-variables)
|
||||||
- [Debugging](#debugging)
|
- [Debugging](#debugging)
|
||||||
- [Example Queries](#example-queries)
|
- [Example Queries](#example-queries)
|
||||||
|
- [Pagination](#pagination)
|
||||||
- [Questions](#questions)
|
- [Questions](#questions)
|
||||||
- [Schema](#schema)
|
- [Schema](#schema)
|
||||||
|
|
||||||
|
|
@ -143,6 +144,49 @@ Nirvana albums and each album’s 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
|
## Questions
|
||||||
|
|
||||||
**What’s with the cumbersome `edges`/`node` nesting? Why `first`/`after`
|
**What’s with the cumbersome `edges`/`node` nesting? Why `first`/`after`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue