PagePromise
Defined in: src/core/pagination.ts:19
Return type of every paginated SDK method — both a promise and an iterator:
await client.vendors.list()→ the first page;for await (const vendor of client.vendors.list())→ every item, across pages, followingnext_cursorautomatically;for await (const page of client.vendors.list().pages())→ page-by-page.
Each await/iteration starts its own request(s).
Type Parameters
Section titled “Type Parameters”P extends PageShape
Implements
Section titled “Implements”PromiseLike<P>AsyncIterable<PageItem<P>>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PagePromise<
P>(fetchPage):PagePromise<P>
Defined in: src/core/pagination.ts:24
Parameters
Section titled “Parameters”fetchPage
Section titled “fetchPage”(cursor?) => Promise<P>
Returns
Section titled “Returns”PagePromise<P>
Methods
Section titled “Methods”[asyncIterator]()
Section titled “[asyncIterator]()”[asyncIterator]():
AsyncGenerator<PageItem<P>,void,undefined>
Defined in: src/core/pagination.ts:47
Iterate every item across all pages.
Returns
Section titled “Returns”AsyncGenerator<PageItem<P>, void, undefined>
Implementation of
Section titled “Implementation of”AsyncIterable.[asyncIterator]
pages()
Section titled “pages()”pages():
AsyncGenerator<P,void,undefined>
Defined in: src/core/pagination.ts:37
Iterate page-by-page, following next_cursor until exhausted.
Returns
Section titled “Returns”AsyncGenerator<P, void, undefined>
then()
Section titled “then()”then<
TResult1,TResult2>(onfulfilled?,onrejected?):Promise<TResult1|TResult2>
Defined in: src/core/pagination.ts:29
Attaches callbacks for the resolution and/or rejection of the Promise.
Type Parameters
Section titled “Type Parameters”TResult1
Section titled “TResult1”TResult1 = P
TResult2
Section titled “TResult2”TResult2 = never
Parameters
Section titled “Parameters”onfulfilled?
Section titled “onfulfilled?”((value) => TResult1 | PromiseLike<TResult1>) | null
The callback to execute when the Promise is resolved.
onrejected?
Section titled “onrejected?”((reason) => TResult2 | PromiseLike<TResult2>) | null
The callback to execute when the Promise is rejected.
Returns
Section titled “Returns”Promise<TResult1 | TResult2>
A Promise for the completion of which ever callback is executed.
Implementation of
Section titled “Implementation of”PromiseLike.then