Function: paginate()
function paginate<T>(fetchPage: (cursor?: string) => Promise<Page<T>>): AsyncGenerator<T, void, void>;
Defined in: packages/sdk/src/pagination.ts:8
Walk a cursor-paginated endpoint, yielding every item across pages. The
fetchPage callback receives the cursor for the next page (undefined for the
first) and returns one page. Stops when nextCursor is null.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fetchPage | (cursor?: string) => Promise<Page<T>> |
Returns
AsyncGenerator<T, void, void>