How to paginate using queries (for reference: https://facebook.github.io/relay/graphql/connections.htm)

This is just an example and is applicable to other queries.

Let's dive into pageInfo hash, what it is and how it can be used.

NameTypeDescriptionQuery Head Example
firstIntegerHow many items will be returned from the beginning of the list.leads(usingToolSlugs: ["gmail"], toolMatch: "any",
first: 3)
afterStringThe client will show the results after $endCursor.usingToolSlugs: ["gmail"], toolMatch: "any",
after: "MjU")
beforeStringThe client will show the results before $beforeCursor.leads(usingToolSlugs: ["gmail"], toolMatch: "any",
before: "MjY")
lastIntHow many items will be returned from end of the list.leads(usingToolSlugs: ["gmail"], toolMatch: "any",
last: 3)

Edge at PageInfo

The information about the cursors can be found using this edge. The sample query of pageInfo is below:

pageInfo {
  startCursor
  hasNextPage
  endCursor
  hasPreviousPage
}

The response is as follows:

"pageInfo": {
  "startCursor": "MzA3NDQx",
  "hasNextPage": false,
  "endCursor": "MzA3NDQz",
  "hasPreviousPage": true
}
NameTypeDescription
startCursorStringThe ID of the page before. In other words, this is the cursor to the pervious page.
hasNextPageBooleanAfter the result, mean if is there any result that hasn't shown after the page in the response.
endCursorStringThe ID of the page after. In other words, this is the cursor to the next page.
hasPreviousPageBooleanAfter the result, mean if is there any result that hasn't shown after the page in the response.
Language
Authorization
Query