Skip to content

PagePromise

Class@tryyoursize/node

What every list() returns: await it for one page ({ data, has_more, next_cursor }), or iterate it with for await to walk every item of every page.

then / catch / finallyPromise<TPage>Required

Awaiting gives the first page.

[Symbol.asyncIterator]()AsyncGenerator<TItem>Required

for await (const item of list): every item, following next_cursor.

pages()AsyncGenerator<TPage>Required

Every page, starting with the first.

autoPagingToArray(opts?)Promise<TItem[]>Required

Collects items across pages, at most opts.limit (default 10,000).

autoPagingEach(fn)Promise<void>Required

Calls fn for each item; return false to stop.

const first = await tys.products.list({ limit: 20 });
const all = await tys.products.list().autoPagingToArray({ limit: 500 });
await tys.fitGroups.list().autoPagingEach((g) => { console.log(g.name); });

Was this page helpful?