Skip to main content

pagination.ts

Source: sdks/typescript/packages/sdk/src/pagination.ts. Back to the TypeScript SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Interface Page​

One page of a listing: the items and the cursor of the next page.

Fields:

NameTypeRequiredDescription
itemsT[]yesItems of the page.
next_cursorstring | nullyesCursor of the next page, null on the last page.

Interface ListParams​

Query of a listing: limit, cursor and any filter.

Fields:

NameTypeRequiredDescription
limitnumbernoMaximum number of items in one page. The server caps the value; read the next page with cursor.
cursorstringnoOpaque cursor returned as next_cursor by the previous page. Omit it to read the first page.

Functions​

collect​

async collect(iter: AsyncIterable<T>, max = Infinity): Promise<T[]>

Collects every item of a paginated listing (use with care on large collections).

NameTypeDefaultRequiredDescription
iterAsyncIterable<T>yesAsync iterable to read, for example the result of paginate.
maxInfinitynoMaximum number of items to collect (default no limit).

Returns: Promise<T[]>. Array of the items read.