UNPKG

digital-samba-mcp-server

Version:

Digital Samba MCP Server - Model Context Protocol server for Digital Samba's video conferencing API

144 lines 5.24 kB
/** * Enhanced Digital Samba API Client Module - Integration File * * This file extends the base digital-samba-api.ts to integrate the new * token-manager, connection-manager, and resource-optimizer features. * It enhances the existing API client with improved connection handling, * automatic token refresh, and optimized resource usage for high-traffic * scenarios. * * @module digital-samba-api-enhanced * @author Digital Samba Team * @version 0.1.0 */ import { DigitalSambaApiClient } from './digital-samba-api.js'; import { TokenManager } from './token-manager.js'; import { MemoryCache } from './cache.js'; /** * Enhanced API client options */ export interface EnhancedApiClientOptions { /** API base URL */ apiUrl?: string; /** API key for authentication */ apiKey?: string; /** Whether to enable connection management */ enableConnectionManagement?: boolean; /** Whether to enable token management */ enableTokenManagement?: boolean; /** Whether to enable resource optimization */ enableResourceOptimization?: boolean; /** Connection pool size */ connectionPoolSize?: number; /** Cache instance */ cache?: MemoryCache; } /** * Enhanced Digital Samba API Client * * This class extends the base DigitalSambaApiClient with improved connection handling, * automatic token refresh, and optimized resource usage for high-traffic scenarios. */ export declare class EnhancedDigitalSambaApiClient extends DigitalSambaApiClient { private connectionManager?; private tokenManagers; private resourceOptimizer?; private readonly enabledFeatures; /** * Creates an instance of the Enhanced Digital Samba API Client * * @constructor * @param {string} [apiKey] - Optional API key for direct authentication * @param {string} [apiBaseUrl='https://api.digitalsamba.com/api/v1'] - Base URL for the Digital Samba API * @param {MemoryCache} [cache] - Optional cache instance * @param {EnhancedApiClientOptions} [options] - Additional options */ constructor(apiKey?: string, apiBaseUrl?: string, cache?: MemoryCache, options?: EnhancedApiClientOptions); /** * Set up connection event handlers */ private setupConnectionEventHandlers; /** * Override the request method to use the connection manager * @param endpoint API endpoint * @param options Request options * @returns Promise resolving to the response data */ protected request<T>(endpoint: string, options?: RequestInit): Promise<T>; /** * Handle error response - helper method to match parent class behavior */ private handleErrorResponse; /** * Create a token manager for a room * @param roomId Room ID * @param sessionId Session ID * @param tokenOptions Token options * @returns Token manager for the room */ createTokenManager(roomId: string, sessionId: string, tokenOptions?: any): TokenManager; /** * Get a token manager for a room * @param roomId Room ID * @returns Token manager for the room or undefined if not found */ getTokenManager(roomId: string): TokenManager | undefined; /** * Generate a room token with automatic refresh * @param roomId Room ID * @param options Token options * @param sessionId Session ID for token context * @returns Promise resolving to token response */ generateRoomTokenWithRefresh(roomId: string, options: any, sessionId: string): Promise<any>; /** * Batch API requests of the same type * @param batchId Batch identifier * @param key Request key * @param executor Function to execute the batch * @returns Promise resolving to the result */ batchRequest<T>(batchId: string, key: string, executor: (keys: string[]) => Promise<Map<string, T>>): Promise<T>; /** * Load data incrementally * @param dataLoader Function to load data * @param pageSize Page size * @param maxPages Maximum number of pages to load * @returns Promise resolving to the loaded data */ loadIncrementally<T>(dataLoader: (page: number, pageSize: number) => Promise<{ data: T[]; total: number; }>, pageSize?: number, maxPages?: number): Promise<T[]>; /** * Get client health status * @returns Whether the client is healthy */ isHealthy(): boolean; /** * Get client statistics * @returns Client statistics */ getStats(): Record<string, any>; /** * Clean up resources */ destroy(): void; } /** * Create an enhanced API client * @param apiKey API key * @param apiBaseUrl API base URL * @param options Additional options * @returns A new enhanced API client instance */ export declare function createEnhancedApiClient(apiKey?: string, apiBaseUrl?: string, options?: EnhancedApiClientOptions): EnhancedDigitalSambaApiClient; /** * Export default enhanced API client utilities */ declare const _default: { EnhancedDigitalSambaApiClient: typeof EnhancedDigitalSambaApiClient; createEnhancedApiClient: typeof createEnhancedApiClient; }; export default _default; //# sourceMappingURL=digital-samba-api-enhanced.d.ts.map