You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-85Lines changed: 1 addition & 85 deletions
Original file line number
Diff line number
Diff line change
@@ -196,91 +196,7 @@ And here is the result of the query:
196
196
197
197
### Queries and Pagination
198
198
199
-
It took me a bit to understand how *pagination* works under the GitHub's implementation of GraphQL. Honestly it isn't that difficult. But the available documentation does not seem to provide any *workable* examples or a very clear explanation.
200
-
201
-
The GitHub GraphQL uses the *Complete Connection Model* method of pagination. Which is partially descrbed [here](https://graphql.github.io/learn/pagination/#complete-connection-model).
202
-
203
-
Pagination Examples:
204
-
205
-
***`/queries/user-verified-pagination-starred_repos.graphql`** : retrieves the validated user's list of starred repos where pagination can applied.
206
-
207
-
#### Pagination in Detail
208
-
209
-
Using the **`/queries/user-verified-pagination-starred_repos.graphql`** file I will attempt to explain how pagination works under the GitHub GraphQL API.
210
-
211
-
First, open a GraphQL *explorer*. This example should also work with GitHub's [GraphQL Explorer](https://docs.github.com/en/free-pro-team@latest/graphql/overview/explorer). Open the Explorer and *paste* the following into it:
Variables needed by the query, paste this into the *query variables* pane :
249
-
250
-
```
251
-
{
252
-
"fst": 3,
253
-
"lst": null,
254
-
"aft": null,
255
-
"bef": null
256
-
}
257
-
```
258
-
259
-
To see how pagination works use these steps:
260
-
261
-
1) Run the query with the data as shown below
262
-
2) After the successful query, copy the string from the
263
-
result at `pageInfo.endCursor` into the `aft` data item
264
-
3) Run the query again
265
-
4) The next "page" will be returned
266
-
267
-
Steps 2 - 4 can be repeated until `pageInfo.hasNextPage`
268
-
becomes `false`.
269
-
270
-
5) To go to the previous page copy the string from the result
271
-
at `pageInfo.startCursor` into the `bef` data item
272
-
6) Set `aft` to `null`
273
-
7) Set `fst` to `null`
274
-
8) Set `lst` to 3
275
-
9) Run the query again
276
-
10) The previous "page" will be returned
277
-
278
-
Steps 6 - 9 can be repeated until `pageInfo.hasPreviousPage`
279
-
becomes `false`.
280
-
281
-
**NOTE**: You will need to have some starred repositories under your account. The minimum recommended for this demonstration is 12. If you have a lot of starred repos change the value used in `"fst"` and `"lst"` to a larger value. For example, if you had 100 starred repos you could change that value from `3` to `25`. That would give you 4 pages of 25 items.
282
-
283
-
For a *visual* representation of pagination view this [file](http://webexperiment.info/ghqlpagination/pagination.html). There is also an accompanying Excel spreadsheet in the `docs` folder in this repository.
199
+
This described in detail [here](./pagination/README.md)
0 commit comments