通过 GraphQL API 显示 100 多个条目 [英] Display more than 100 entries through GraphQL API
问题描述
我已经厌倦了在 github grpahQL API 中使用 endCursor 和 hasNextPage 进行分页以获得 100 多个数据.我使用的查询是:
I have tired pagination using endCursor and hasNextPage in github grpahQL API to get more than 100 data. Query I used is:
query {
organization(login:"XXX") {
repository(name:"XX") {
pullRequests(first:100, states:[OPEN], after: "XXX" ) {
pageInfo{
hasNextPage
endCursor
}
}
}
它正在工作.但是为了访问更多细节,需要进行迭代分页.谁能提供一种有效的替代方法来在 GraphQL API 中以编程方式遍历所有页面?
It is working. But in order to access further details,iterative pagination needs to be done. Can anyone provides an efficient alternative to traverse all pages programatically in GraphQL API?
推荐答案
使用 endCursor 的分页是一种解决方案.与 REST API 一样,您无法务实地遍历所有页面.正如您指定的,您可以指定 endCursor 并遍历是否有下一页
Pagination using endCursor is the one solution. Like REST API, you cannot traverse all pages pragmatically. As you specified you can specify endCursor and traverse if there is next page
这篇关于通过 GraphQL API 显示 100 多个条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!