@mxraven/admin - v2.1.0
    Preparing search index...

    Class Paged<T>

    A cursor-paginated collection.

    The first page is fetched eagerly when the owning list() call is made. Remaining pages are fetched lazily, either automatically as the collection is consumed or manually through Page.nextPage and Paged.pages.

    const paged = await ws.domains().list();
    for await (const domain of paged) {
    console.log(domain.domainName);
    }
    const firstTen = await paged.take(10);
    const paged = await ws.domains().list();
    let page = paged.firstPage;
    while (page.nextPageToken !== undefined) {
    page = await page.nextPage();
    }

    Type Parameters

    • T

      The item type.

    Implements

    • AsyncIterable<T>
    Index
    firstPage: Page<T>

    The eagerly fetched first page, including its items and cursors.

    • get isEmpty(): boolean

      Whether the collection is empty, without fetching further pages.

      Returns boolean

    • Walks every item across all pages.

      Prefer take or manual page navigation when the collection may be large.

      Returns AsyncGenerator<T, void, void>

    • Lazily filters every item across all pages.

      Parameters

      • predicate: (item: T) => boolean

        The predicate used to keep items.

      Returns Paged<T>

      A lazily filtered collection.

    • Runs visitor for every item across all pages, in order.

      The visitor may be async; each item is awaited before the next is visited.

      Parameters

      • visitor: (item: T) => void | Promise<void>

        The function invoked for each item.

      Returns Promise<void>

    • Lazily transforms every item across all pages.

      Page navigation on the result also works: the mapper is applied to every page it fetches.

      Type Parameters

      • R

        The mapped item type.

      Parameters

      • mapper: (item: T) => R

        The function applied to each item.

      Returns Paged<R>

      A lazily mapped collection.

    • Fetches the page after page, or the page after the first page when page is omitted.

      Parameters

      • page: Page<T> = ...

        The page whose next page to fetch. Defaults to firstPage.

      Returns Promise<Page<T>>

      The next page.

      Error When page has no next page.

    • Fetches the page identified by an opaque cursor.

      This is the lowest-level navigation primitive; prefer page.nextPage() or page.previousPage() unless you are persisting or restoring a cursor.

      Parameters

      • cursor: string

        The opaque cursor from a page's nextPageToken, previousPageToken, or lastPageToken.

      Returns Promise<Page<T>>

      The page the cursor points at.

      ApiException When the control plane returns a non-success status.

    • Lazily yields every page in order, starting with Paged.firstPage.

      A page token repeated by the control plane is treated as a protocol error and raises an Error rather than looping forever.

      Returns AsyncGenerator<Page<T>, void, void>

    • Fetches the page before page.

      Parameters

      • page: Page<T>

        The page whose previous page to fetch.

      Returns Promise<Page<T>>

      The previous page.

      Error When page has no previous page.

    • Reads at most limit items, fetching only the pages needed to satisfy it.

      Parameters

      • limit: number

        The maximum number of items to read.

      Returns Promise<T[]>

      The first limit items.

    • Eagerly fetches every page and returns all items.

      Returns Promise<T[]>

      Every item across all pages.