export interface ClientOptions { apiKey?: string; baseUrl?: string; fetchImpl?: typeof fetch; } export declare class AllRatesTodayError extends Error { readonly status?: number | undefined; readonly body?: unknown; constructor(message: string, status?: number | undefined, body?: unknown); } /** * Thrown when a tool needs an endpoint that sits behind the API key. Carries * the sign-up instructions so the assistant relays one actionable sentence * rather than a bare 401. */ export declare class NeedsKeyError extends AllRatesTodayError { constructor(what: string, paid?: boolean); } export declare class AllRatesTodayClient { private apiKey?; private readonly baseUrl; private readonly fetchImpl; constructor(options?: ClientOptions); private request; /** True when no API key is configured: only the open endpoints are reachable. */ get keyless(): boolean; /** Adopt a key at runtime (used after request_trial_key) so the rest of the session is keyed. */ setApiKey(key: string | undefined): void; /** * Daily Reference Rate: one never-revised mid-market table per business day, * fixed at 16:00 London (median of samples in a 5-minute window). Latest * table and single pairs are keyless; a dated table needs a paid-plan key. */ getReferenceRate(params?: { source?: string; target?: string; date?: string; }): Promise>; /** * Retail buy/sell board rates commercial banks display on their own * websites, read hourly: every covered bank in a country, or one bank * (optionally one currency, optionally a stored past day). Behind the API * key on every plan, the free and trial keys included. */ getBankRates(params: { country: string; bank?: string; ccy?: string; date?: string; }): Promise>; /** * Self-issue a trial key (100 calls, 7 days, no account) and adopt it for the * rest of this process. POST with a JSON body: the site rejects bodiless * POSTs as cross-site form submissions. */ requestTrialKey(params?: { agent?: string; purpose?: string; }): Promise; getRate(source: string, target: string): Promise<{ rate: number; source: string; bank: string; rate_date: string; derived: boolean; note: string; } | { rate: number; source: string; }>; getHistoricalRates(source: string, target: string, period?: '1d' | '7d' | '30d' | '1y'): Promise<{ source: string; target: string; period: string; source_api?: string; data: { date: string; rate: number; timestamp: number; }[]; }>; getAuthenticatedRates(params: { source?: string; target?: string; time?: string; group?: 'hour' | 'day' | 'week' | 'month'; }): Promise<{ rate: number; source: string; target: string; time: string; }[]>; /** Every covered official source (120+ central banks and 50+ tax authorities). Keyless. */ listCentralBanks(): Promise<{ sources: { code: string; name: string; latest: string | null; stale?: boolean; }[]; stale_count: number; checked_at: string; }>; /** * Latest OFFICIAL table published by a central bank or tax authority, or one * pair from it (cross-computed inside the bank's own table when not published * directly, flagged `derived`). Keyless; a dated table needs a paid-plan key. */ getOfficialRates(bank: string, params?: { date?: string; source?: string; target?: string; }): Promise>; listSymbols(): Promise<{ currencies: { code: string; name: string; symbol: string; }[]; count: number; }>; }