Repository navigation
Introducing GraphQL Pagination on queries
From now on the Booster GraphQL API includes a type for your read models that stands for List<YourReadModelName>, which is the official way to work with pagination. Alternatively, and for compatibility with previous versions, there is still the type without the List prefix, which will be deprecated in future versions.
The new Read Model List type includes some new parameters that can be used on queries:
limit; an integer that specifies the maximum number of items to be returned.afterCursor; a parameter to set thecursorproperty returned by the previous query, if not null.
Example:
query {
ListProductReadModels
(
limit: 1,
afterCursor: { id: "last-page-item"}
) {
id
sku
availability
price
}
}Besides the parameters, this type also returns a type {your-read-model-name}Connection, it includes the following properties:
cursor; if there are more results to paginate, it will return the object to pass to theafterCursorparameter on the next query. If there aren't more items to be shown, it will be undefined.items; the list of items returned by the query, if there aren't any, it will be an empty list.