Closed tisonkun closed 2 months ago
I'm not familiar with GraphQL pagination queries, but I can give it a try 😄
@yanyongyu The main design of the SDK above is a convention:
pageInfo {
hasNextPage
endCursor
}
that the GraphQL query must have the pageInfo
section. And it will extract the related fields to fulfill after: $cursor
.
It should be possible for users to handle this iteration logic manually but an out-of-the-box API can help.
And here is the related GitHub docs: https://docs.github.com/en/graphql/guides/using-pagination-in-the-graphql-api
After a deep understanding of octokit plugin paginate graphql, I'll record some key points and notes here:
pageInfo
object, and should be defined by user in the query.pageInfo
key of dicts recursively to detect pagination. [Ref]pageInfo
object and merges the nodes
and edges
[Ref]hasNextPage
/endCursor
and hasPreviousPage
/startCursor
key of the page info.
Something like https://github.com/octokit/plugin-paginate-graphql.js