Pagination#
The Afosto API uses Relay-style cursor-based pagination for all list fields.
How it works#
List fields return a Connection type with:
edges— array of result items wrapped in anEdgetypepageInfo— metadata about the current page
PageInfo#
| Name | Type | Required | Description |
|---|---|---|---|
hasNextPage | Boolean! | Required | Whether there are more items after this page |
hasPreviousPage | Boolean! | Required | Whether there are more items before this page |
startCursor | String | Optional | Cursor of the first item in this page |
endCursor | String | Optional | Cursor of the last item in this page |
Edge#
Each edge wraps a single result item with its cursor:
| Name | Type | Required | Description |
|---|---|---|---|
cursor | String! | Required | Opaque cursor for this item — pass to after or before |
node | T! | Required | The item itself (type depends on the query) |
Fetching the first page#
Fetching the next page#
Use the endCursor from the previous response as the after argument:
Arguments#
All paginated list fields accept these arguments:
| Name | Type | Required | Description |
|---|---|---|---|
first | Int | Optional | Number of items to fetch from the start (forward pagination) |
after | String | Optional | Cursor to start after — use endCursor from the previous page |
last | Int | Optional | Number of items to fetch from the end (backward pagination) |
before | String | Optional | Cursor to fetch before — use startCursor from the previous page |