Skip to content

API ReferenceSetup and configurationFunction

iterateCollectionPages()

function iterateCollectionPages<T, Params>(
fetchPage,
params,
options?
): AsyncGenerator<CollectionPage<T>, void, void>;

Lazily yields collection pages in order until the exact next cursor is null.

A later failure rejects that iteration step without changing pages already yielded to the caller. Repeated cursors fail closed before another request can loop.

Type Parameters

Type Parameter
T
Params extends CollectionRequest

Parameters

ParameterTypeDescription
fetchPageCollectionPageFetcher<T, Params>Page reader that accepts execution controls separately.
paramsParamsCollection filters and initial cursor.
optionsReadExecutionOptionsCancellation controls shared by every page.

Returns

AsyncGenerator<CollectionPage<T>, void, void>