/** * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com) * http://github.com/fonoster/fonoster * * This file is part of Fonoster * * Licensed under the MIT License (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * https://opensource.org/licenses/MIT * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ type ListResponse = { items: T[]; nextPageToken?: string; }; type PaginatedListOptions = { pageSize: number; pageToken?: string; fetchPage: (pageToken: string | undefined, pageSize: number) => Promise>; filterItems: (items: TInput[]) => TOutput[]; maxIterations?: number; }; /** * Normalizes empty string pageToken to undefined. * Empty strings are falsy in JS, but gRPC/protobuf may send them as empty strings. */ export declare function normalizePageToken(pageToken?: string): string | undefined; /** * Normalizes nextPageToken from response; returns empty string when there are no more pages. */ export declare function normalizeNextPageToken(nextPageToken?: string): string; /** * Filters items by accessKeyId from extended field. */ export declare function filterByAccessKeyId(items: T[], accessKeyId: string): T[]; /** * Handles pagination with filtering, continuing to fetch pages until: * - We have enough items (pageSize) * - We run out of pages * - We hit the max iterations limit * * This handles the case where the first pages contain items from other customers. * * @template TInput - The type of items returned from the API * @template TOutput - The type of items after filtering/transformation (defaults to TInput) */ export declare function paginateWithFiltering(options: PaginatedListOptions): Promise>; export {};