/** * AniList GraphQL API Client * * Handles rate limiting (token bucket), retry with exponential backoff, * and in-memory caching. */ import type { AniListMediaListEntry, UserListResponse } from "../types.js"; /** Per-category TTLs for the query cache */ export declare const CACHE_TTLS: { media: number; search: number; list: number; seasonal: number; stats: number; trending: number; schedule: number; }; export type CacheCategory = keyof typeof CACHE_TTLS; /** API error with HTTP status and retry eligibility */ export declare class AniListApiError extends Error { readonly status?: number | undefined; readonly retryable: boolean; constructor(message: string, status?: number | undefined, retryable?: boolean); } /** Options for a single query call */ export interface QueryOptions { /** Cache category to use. Pass null to skip caching. */ cache?: CacheCategory | null; } /** Manages authenticated requests to the AniList GraphQL API */ declare class AniListClient { private get token(); /** Execute a GraphQL query with caching and automatic retry */ query(query: string, variables?: Record, options?: QueryOptions): Promise; /** Fetch a user's media list groups with metadata (name, status, isCustomList) */ fetchListGroups(username: string, type: string, status?: string, sort?: string[]): Promise; /** Fetch a user's media list, flattened into a single array */ fetchList(username: string, type: string, status?: string, sort?: string[]): Promise; /** Invalidate the entire query cache */ clearCache(): void; /** Cache size and capacity for health checks */ cacheStats(): { size: number; maxSize: number; }; /** Evict cache entries related to a specific user (lists and stats) */ invalidateUser(username: string): void; /** Retries with exponential backoff via p-retry */ private executeWithRetry; /** Send a single GraphQL POST request and parse the response */ private makeRequest; } /** Singleton. Rate limiter and cache must be shared across all tools. */ export declare const anilistClient: AniListClient; /** Pre-fetch default user's lists so first tool call is instant */ export declare function warmCache(): void; export {};