import { PaginationArgs } from './types'; export declare type PaginationMethod = (args: PaginationArgs) => Promise; /** * This class allows you to cache visited pages of a paginated collection. * It also automatically handles cursor pagination and starting from the correct offsets. */ export declare class PageCache { private method; private baseArgs; private pageSize?; private total?; private cache; /** * Create a new page cache for a paginated collection. * @param baseArgs Base arguments for the method, without pagination parameters * @param method The method to call to request a page from the collection * @param pageSize Page size. If not set, will be determined by the backend on first request */ constructor(method: PaginationMethod, baseArgs: PaginationArgs, pageSize?: number); /** * Get a cached page using the provided method. Request the page if it has not been seen before. * @param page Page number * @returns The data within the page */ getPage(page: number): Promise; /** * Gets the page size. This must be either defined on creation or is provided by the backend on getting any page. * @returns The page size */ getPageSize(): number | undefined; /** * Gets the highest page number that has been cached. * @returns The highest page number */ getMaxPage(): number | undefined; /** * Gets the total number of items, if available. * On certain backends, the total number of items will only appear when you reach the last page. * @returns Total number of items, or undefined if unknown. */ getTotal(): number | undefined; }