Pagination
All list responses from queries return paginated results. We implement Relay style cursor-based pagination with first and after pagination arguments. For example, this is how to query the first 10 boards in your workspace:
query ListBoards($workspaceId: ID!) {
boards(workspaceId: $workspaceId, first: 10) {
edges {
node {
id
title
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}To query the next 10, simply pass the value of pageInfo.endCursor as the after argument for the next request. You can do this as long as pageInfo.hasNextPage returns true, and you'll paginate through all the values in the collection. Cursors are opaque: do not build them or keep them beyond the next request.
query NextBoards($workspaceId: ID!, $after: String) {
boards(workspaceId: $workspaceId, first: 10, after: $after) {
edges {
node {
id
title
}
}
pageInfo {
hasNextPage
endCursor
}
}
}The first 50 results are returned by default without pagination arguments, and a page holds at most 200. Lists page forward only: there are no last and before arguments.
Some lists also report the size of the whole collection in pageInfo.totalCount, such as boards and Board.pages. On lists that do not, it is null, so stop on hasNextPage rather than counting:
query BoardCount($workspaceId: ID!) {
boards(workspaceId: $workspaceId, first: 1) {
pageInfo {
totalCount
}
}
}By default results are ordered by when they were last opened or created. To get the most recently updated resources, you can alternatively order by the UPDATED field:
query RecentlyUpdatedBoards($workspaceId: ID!) {
boards(workspaceId: $workspaceId, orderBy: { field: UPDATED, direction: DESC }) {
edges {
node {
id
title
createdAt
updatedAt
}
}
}
}