Class DonationAlertsApiPaginator<D, T>

Donation Alerts API paginator.

A utility class for managing paginated responses from the Donation Alerts API. This paginator supports navigating through paginated data by individual pages or fetching all data at once. It internally keeps track of the current page, total pages, and other metadata to simplify navigation.

Type Parameters

  • D
  • T

Accessors

  • get isFinished(): boolean

    Indicates whether the paginator has reached the last page.

    Returns boolean

    When this flag is true, calling getNext() will return an empty array without making additional API requests.

  • get rawData(): undefined | DonationAlertsResponseWithMeta<D>

    The raw data of the last retrieved page, including metadata.

    Returns undefined | DonationAlertsResponseWithMeta<D>

    The full API response for the most recently fetched page, or undefined if no request has been made yet.

Methods

  • Enables asynchronous iteration over all available pages.

    Returns AsyncGenerator<T[], void, undefined>

    HttpError if the response status code is not within the 200-299 range.

    UnregisteredUserError if the user is not registered in the authentication provider.

    MissingScopeError if the access token does not include the required scope.

    const paginator = apiClient.donations.createDonationsPaginator();

    for await (const pageData of paginator) {
    console.log(pageData);
    }
  • Fetches all pages and aggregates the results into a single array.

    Returns Promise<T[]>

    A combined array of all mapped data objects from all pages.

    This method resets the paginator at the start and end of the operation. It sequentially requests each page and concatenates the results.

    This method may take longer to execute, especially for users with a large volume of donations. For better performance with large datasets, consider using the getNext method to fetch data in chunks.

    HttpError if the response status code is not within the 200-299 range.

    UnregisteredUserError if the user is not registered in the authentication provider.

    MissingScopeError if the access token does not include the required scope.

  • Fetches the next page of data, or the first page if no pages have been loaded yet.

    Returns Promise<T[]>

    An array of mapped data objects for the next page, or an empty array if the last page is reached.

    This method automatically increments the page counter and checks the total number of pages to stop requests when the end is reached.

    HttpError if the response status code is not within the 200-299 range.

    UnregisteredUserError if the user is not registered in the authentication provider.

    MissingScopeError if the access token does not include the required scope.

  • Fetches and returns data from a specific page.

    Parameters

    • page: number = 1

      The page number to fetch. Defaults to 1.

    Returns Promise<T[]>

    An array of mapped data objects for the requested page.

    If the requested page number exceeds the total number of pages, the method returns an empty array.

    HttpError if the response status code is not within the 200-299 range.

    UnregisteredUserError if the user is not registered in the authentication provider.

    MissingScopeError if the access token does not include the required scope.

    const data = await paginator.getPage(42);
    
  • Fetches the previous page of data.

    Returns Promise<T[]>

    An array of mapped data objects for the previous page.

    If the current page is 1, this method will return data for the first page.

    HttpError if the response status code is not within the 200-299 range.

    UnregisteredUserError if the user is not registered in the authentication provider.

    MissingScopeError if the access token does not include the required scope.

MMNEPVFCICPMFPCPTTAAATR