/** * Pagination helper for Splitwise list endpoints. * * Splitwise uses a simple `limit`/`offset` scheme with no continuation tokens, * so a "page" is exhausted when the server returns fewer rows than requested * (or none at all). `PagedResult` wraps that loop in a value that is: * - awaitable: `await result` resolves to the first page's array (sends the * user's `limit` as-is so the server's default applies when omitted) * - async-iterable: `for await (const item of result)` yields every item * - page-iterable: `for await (const page of result.byPage())` yields arrays * * Iteration needs a known page size to detect end-of-data, so when iterating * without an explicit `limit` the SDK uses `ITERATION_PAGE_SIZE` for batching. * * The first page fetched via `await` is cached, so repeated awaits don't * re-hit the network. Iteration always starts a fresh sequence from the * configured offset. */ import type { HttpClient, RequestOverrides } from './http.js'; export interface PagedResultOptions extends RequestOverrides { /** Page size. If omitted, the server's default applies for `await result`, * and `ITERATION_PAGE_SIZE` (100) applies for iteration. */ limit?: number; /** Starting offset; default 0. */ offset?: number; /** Other query params to send with each page request. */ query?: Record; } export interface PagedResult extends AsyncIterable { /** Awaitable: returns the first page array. */ then(onfulfilled?: ((value: T[]) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null): Promise; /** Page-by-page iteration. */ byPage(): AsyncIterable; } export declare function createPagedResult(http: HttpClient, path: string, unwrapKey: string, options?: PagedResultOptions): PagedResult; //# sourceMappingURL=pagination.d.ts.map