Random-accessing via GraphQL/REST?

Hi, I’ve been exploring it for a while. That’s my query:

query { 
  repository(owner: "somewhere", name: "repo") {
  	pullRequests(first: 100, states: MERGED) {
      edges {
        node {
          number
          author {
            login
          }
          additions
          deletions
        }
      }
    }
  }
}

However, I couldn’t found a method to access intermidate data, and didn’t see like page or offset. Is it possible on GraphQL? How about on REST API?

Try this query:

query { 
  repository(owner: "somewhere", name: "repo") {
  	pullRequests(first: 100, states: MERGED) {
      totalCount
      pageInfo { endCursor, hasNextPage }
      nodes {
          number
          author {
            login
          }
          additions
          deletions
       }
    }
  }
}

You can then use endCursor to query the next page.

1 Like