Astrada TypeScript SDK
    Preparing search index...

    Function paginate

    • Calls a list method page by page and yields each item.

      for await (const subaccount of paginate((p) => subaccounts.listSubaccounts(p), { limit: 100 })) {
      console.log(subaccount.id);
      }

      Type Parameters

      • const P extends object
      • R

      Parameters

      • list: (params: P) => Promise<R>

        a list method, called with params plus the next page's cursor or offset

      • params: P = ...

        the first page's parameters (filters and limit); string literals keep their literal type, so enum filters such as state: 'failed' type-check

      • options: PaginateOptions = {}

      Returns AsyncGenerator<PageItem<R>, void, undefined>