import { InsightsOperations } from '../operations/insights.js'; import { MetadataOperations } from '../operations/metadata.js'; import { ChatOperations } from '../operations/chat.js'; import { RevealSdkClientConfig } from '../types/config.js'; /** * AI operations namespace (mounted at /api/reveal/ai) */ export interface AIOperations { /** Insights operations */ insights: InsightsOperations; /** Metadata operations */ metadata: MetadataOperations; /** Chat operations */ chat: ChatOperations; } /** * Main Reveal SDK API Client * * Provides a clean, type-safe interface for interacting with Reveal SDK APIs * * Supports multiple API routing patterns: * - Standard Reveal APIs: mounted at root (/) * - AI APIs: mounted at /api/reveal/ai * * @example * ```typescript * // Option 1: Create instance directly * const client = new RevealSdkClient({ * hostUrl: 'https://api.example.com', * bearerToken: 'your-token' * }); * * // Option 2: Use singleton pattern (recommended for apps) * RevealSdkClient.initialize({ * hostUrl: 'https://api.example.com', * bearerToken: 'your-token' * }); * * // Later, anywhere in your app: * const client = RevealSdkClient.getInstance(); * const insights = await client.ai.insights.get({ * dashboardId: 'my-dashboard', * insightType: InsightType.Summary * }); * ``` */ export declare class RevealSdkClient { private static instance; private httpClient; private config; private defaultHeaders; /** * AI operations (mounted at /api/reveal/ai) */ readonly ai: AIOperations; /** * Create a Reveal SDK API client instance. * * Use this when an application needs an independently configured client. * Applications that only need one shared client can use * {@link RevealSdkClient.initialize} and {@link RevealSdkClient.getInstance} * instead. * * @param config - Client configuration, including the Reveal API server URL * @throws Error when `hostUrl` is missing */ constructor(config: RevealSdkClientConfig); /** * Initialize the singleton instance * * This is useful for applications where you want to configure the client once * and use it throughout your app without passing it around. * * @param config - Client configuration * @returns The singleton instance * * @example * ```typescript * // Initialize once at app startup * RevealSdkClient.initialize({ * hostUrl: 'https://api.example.com', * bearerToken: 'your-token' * }); * * // Use anywhere in your app * const client = RevealSdkClient.getInstance(); * const insights = await client.ai.insights.get({...}); * ``` */ static initialize(config: RevealSdkClientConfig): RevealSdkClient; /** * Get the singleton instance * * @returns The singleton instance * @throws Error if initialize() has not been called * * @example * ```typescript * const client = RevealSdkClient.getInstance(); * const insights = await client.ai.insights.get({...}); * ``` */ static getInstance(): RevealSdkClient; /** * Check if the singleton has been initialized * * @returns True if initialized, false otherwise * * @example * ```typescript * if (RevealSdkClient.isInitialized()) { * const client = RevealSdkClient.getInstance(); * } * ``` */ static isInitialized(): boolean; /** * Reset the singleton instance * * Useful for testing or when you need to reconfigure the client * * @example * ```typescript * RevealSdkClient.reset(); * RevealSdkClient.initialize(newConfig); * ``` */ static reset(): void; /** * Setup authentication interceptor */ private setupAuthInterceptor; /** * Update the bearer token * * Useful for token refresh scenarios * * @param token - New bearer token * * @example * ```typescript * client.setBearerToken(newToken); * ``` */ setBearerToken(token: string): void; /** * Update a header value * * @param name - Header name * @param value - Header value * * @example * ```typescript * client.setHeader('X-Custom-Header', 'value'); * ``` */ setHeader(name: string, value: string): void; /** * Remove a header * * @param name - Header name * * @example * ```typescript * client.removeHeader('X-Custom-Header'); * ``` */ removeHeader(name: string): void; /** * Get current configuration * * @returns A read-only copy of the current client configuration */ getConfig(): Readonly; /** * Enable or disable debug mode * * @param enabled - Whether to enable debug logging * * @example * ```typescript * client.setDebug(true); * ``` */ setDebug(enabled: boolean): void; } //# sourceMappingURL=reveal-sdk-client.d.ts.map