PagePromise
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.
Methods
Section titled “Methods”then / catch / finallyPromise<TPage>RequiredAwaiting gives the first page.
[Symbol.asyncIterator]()AsyncGenerator<TItem>Requiredfor await (const item of list): every item, following next_cursor.
pages()AsyncGenerator<TPage>RequiredEvery page, starting with the first.
autoPagingToArray(opts?)Promise<TItem[]>RequiredCollects items across pages, at most opts.limit (default 10,000).
autoPagingEach(fn)Promise<void>RequiredCalls fn for each item; return false to stop.
Example
Section titled “Example”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); });page = tys.products.list(limit=20)next_page = page.next_page()for product in page.auto_paging_iter(): ...See also
Section titled “See also”Was this page helpful?
Thank you. We read every answer.