import type { AnyCaller } from "../../util/function.js";
import type { RequestOptions } from "../../util/http.js";
import type { Endpoint } from "../endpoint/Endpoint.js";
import type { APIProvider } from "./APIProvider.js";
import { ThroughAPIProvider } from "./ThroughAPIProvider.js";
/**
 * API provider wrapper that serves requests through an `APICache`.
 * - Constructor accepts a `source` provider and an optional default `maxAge`.
 * - On `call(...)`, triggers `cache.refresh(maxAge)` for the endpoint+payload before awaiting `cache.call(...)`.
 * - `invalidate`, `invalidateAll`, `refresh`, and `refreshAll` pass through to the underlying cache and use `this.maxAge` as the default refresh timing.
 *
 * @param `maxAge` The maximum age used when calling `call()` (defaults to `AVOID_REFRESH`, i.e. only refresh if the value is invalidated or still loading).
 * - Note: This is not used for `refresh()` calls — when you call `refresh()` you likely mean "do it now".
 * - When we are using `call()` on a cache, the entire point of the cache is to "cache", so the default isn't `0` like it is for `refresh()`
 */
export declare class CachedAPIProvider<P, R> extends ThroughAPIProvider<P, R> implements AsyncDisposable {
    readonly maxAge: number | undefined;
    private readonly _cache;
    constructor(source: APIProvider<P, R>, maxAge?: number);
    call<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, _options?: RequestOptions, caller?: AnyCaller): Promise<RR>;
    invalidate<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP): void;
    invalidateAll<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>): void;
    refresh<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP): void;
    refreshAll<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>): void;
    [Symbol.asyncDispose](): Promise<void>;
}
