import type { AnyCaller } from "../../util/function.js";
import type { Endpoint } from "../endpoint/Endpoint.js";
import type { APIProvider } from "../provider/APIProvider.js";
import { EndpointCache } from "./EndpointCache.js";
/**
 * Cache of `EndpointCache` objects for multiple endpoints.
 * - Use `get(endpoint)` to retrieve or create the `EndpointCache` for a given endpoint, then `get(payload)` on that to get a specific `EndpointStore`.
 */
export declare class APICache<P, R> implements AsyncDisposable {
    private readonly _endpoints;
    readonly provider: APIProvider<P, R>;
    constructor(provider: APIProvider<P, R>);
    private _get;
    /** Get (or create) the `EndpointCache` for the given endpoint. */
    get<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>): EndpointCache<PP, RR>;
    /**
     * Fetch (or return a cached result) for the given endpoint and payload.
     * - Returns the cached value immediately if one exists.
     * - Waits for the in-flight fetch if the store is loading.
     * - Throws if the fetch fails, matching `APIProvider.call` behaviour.
     */
    call<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, maxAge?: number, caller?: AnyCaller): Promise<RR>;
    /** Invalidate a specific store for an endpoint. */
    invalidate<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP): void;
    /** Invalidate all stores for an endpoint. */
    invalidateAll<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>): void;
    /** Trigger a refetch on a specific store for an endpoint. */
    refresh<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, maxAge?: number): void;
    /** Trigger a refetch on all stores for an endpoint. */
    refreshAll<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, maxAge?: number): void;
    [Symbol.asyncDispose](): Promise<void>;
}
