Graphql API Offset Pagination

Hi,

I’m building an app which uses Graphql API extensively. I’d like to retrieve the paginated list of repositories using offset and limit instead of using cursors so let’s say I can jump directly to page 5 of the repo list.

Can anyone tell me if its possible with Graphql API v4?

query {
  search(query: "image", first: 5, type:REPOSITORY) {
    edges {
      node {
        ...on Repository {
          name
          url
          nameWithOwner
          stargazers {
            totalCount
          }
          watchers {
            totalCount
          }
          forkCount
        }
      }
    }
    pageInfo {
      endCursor
    }
    repositoryCount
  }
}

Thanks,

Monik

1 Like

Hi @gandhimonik,

Thanks for being here! This is not currently possible, I’ve taken your suggestion and passed it along to the appropriate teams. Thanks again for reaching out :grinning:

3 Likes

Please note that this is a very important feature as it prevents random access.

I also need this way of accessing the pages as the page limit is 100. So if I want to say draw a graph of the stargazers over time for some popular repository like electron which has 79,000 stars, I need to make 790 requests :thinking: (there is no other way) i.e. it is impossible. But with API v3 I can make a fixed number of requests say e.g. 15 because random access is possible and then interpolate the graph in between (which is done by timqian/star-history). But API v3 is bloated and wastes a lot of bandwidth. I request this feature to be implemented because as of now, it’s impossible to do some things that can be done with API v3 which is a severe regression and a breaking change.

Hello @andreagriffiths11 please has this issue been resolved