/** * Base API client with shared functionality for both browser and standalone environments. */ export interface ApiResponse { data?: T; success: boolean; status: number; headers: Headers; error?: Error | string; connectionError?: boolean; } export interface ApiClientConfig { baseUrl: string; apiKey: string; onConnectionChange?: (isConnected: boolean) => void; } /** Query parameters that can be passed to GET requests */ export type QueryParams = Record; /** * Abstract base class for API clients. * Provides shared functionality for making HTTP requests. */ export declare abstract class BaseApiClient { /** * Error messages that indicate a connection failure rather than a server error. * Grouped by source/environment. */ protected static readonly CONNECTION_ERROR_MESSAGES: string[]; protected onConnectionChange?: (isConnected: boolean) => void; baseUrl: string; api_key: string; constructor(config: ApiClientConfig); protected isConnectionError(error: unknown): boolean; protected setConnectionStatus(isConnected: boolean): void; protected baseHeaders(): Headers; /** Override in subclasses to provide the active UI locale for the Accept-Language header. */ protected getLocale(): string | undefined; protected mergeHeaders(base: Headers, extra?: HeadersInit): Headers; /** * Builds a query string from params, filtering out undefined/null values. */ protected buildQueryString(params?: QueryParams): string; /** * Override this in subclasses to add environment-specific request options. */ protected abstract getRequestOptions(): RequestInit; /** * Override this in subclasses to handle connection errors (e.g., Sentry reporting). */ protected abstract handleConnectionError(error: unknown, endpoint: string, method: string): void; protected request(method: string, endpoint: string, body?: object, headers?: HeadersInit): Promise>; get(endpoint: string, headers?: HeadersInit, params?: QueryParams): Promise>; post(endpoint: string, body: object, headers?: HeadersInit): Promise>; patch(endpoint: string, body: object, headers?: HeadersInit): Promise>; delete(endpoint: string, headers?: HeadersInit): Promise>; }