import { FinalRequestOptions } from "../internal/request-options.js"; import { type Metronome } from "../client.js"; import { APIPromise } from "./api-promise.js"; import { type APIResponseProps } from "../internal/parse.js"; export type PageRequestOptions = Pick; export declare abstract class AbstractPage implements AsyncIterable { #private; protected options: FinalRequestOptions; protected response: Response; protected body: unknown; constructor(client: Metronome, response: Response, body: unknown, options: FinalRequestOptions); abstract nextPageRequestOptions(): PageRequestOptions | null; abstract getPaginatedItems(): Item[]; hasNextPage(): boolean; getNextPage(): Promise; iterPages(): AsyncGenerator; [Symbol.asyncIterator](): AsyncGenerator; } /** * This subclass of Promise will resolve to an instantiated Page once the request completes. * * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg: * * for await (const item of client.items.list()) { * console.log(item) * } */ export declare class PagePromise, Item = ReturnType[number]> extends APIPromise implements AsyncIterable { constructor(client: Metronome, request: Promise, Page: new (...args: ConstructorParameters) => PageClass); /** * Allow auto-paginating iteration on an unawaited list call, eg: * * for await (const item of client.items.list()) { * console.log(item) * } */ [Symbol.asyncIterator](): AsyncGenerator; } export interface CursorPageResponse { /** * Cursor to fetch the next page */ next_page: string; /** * Items of the page */ data: Array; } export interface CursorPageParams { /** * Cursor to begin fetching from */ next_page?: string; /** * Number of elements to fetch */ limit?: number; } export declare class CursorPage extends AbstractPage implements CursorPageResponse { /** * Cursor to fetch the next page */ next_page: string; /** * Items of the page */ data: Array; constructor(client: Metronome, response: Response, body: CursorPageResponse, options: FinalRequestOptions); getPaginatedItems(): Item[]; hasNextPage(): boolean; nextPageRequestOptions(): PageRequestOptions | null; } export interface BodyCursorPageResponse { /** * Cursor to fetch the next page */ next_page: string; /** * Items of the page */ data: Array; } export interface BodyCursorPageParams { /** * Cursor to begin fetching from */ next_page?: string; /** * Number of elements to fetch */ limit?: number; } export declare class BodyCursorPage extends AbstractPage implements BodyCursorPageResponse { /** * Cursor to fetch the next page */ next_page: string; /** * Items of the page */ data: Array; constructor(client: Metronome, response: Response, body: BodyCursorPageResponse, options: FinalRequestOptions); getPaginatedItems(): Item[]; hasNextPage(): boolean; nextPageRequestOptions(): PageRequestOptions | null; } export interface CursorPageWithoutLimitResponse { /** * Cursor to fetch the next page */ next_page: string; /** * Items of the page */ data: Array; } export interface CursorPageWithoutLimitParams { /** * Cursor to begin fetching from */ next_page?: string; } export declare class CursorPageWithoutLimit extends AbstractPage implements CursorPageWithoutLimitResponse { /** * Cursor to fetch the next page */ next_page: string; /** * Items of the page */ data: Array; constructor(client: Metronome, response: Response, body: CursorPageWithoutLimitResponse, options: FinalRequestOptions); getPaginatedItems(): Item[]; hasNextPage(): boolean; nextPageRequestOptions(): PageRequestOptions | null; } //# sourceMappingURL=pagination.d.ts.map