digital-samba-mcp-server
Version:
Digital Samba MCP Server - Model Context Protocol server for Digital Samba's video conferencing API
131 lines • 5.13 kB
TypeScript
/**
* Digital Samba API Client with Circuit Breaker Integration
*
* This module extends the core DigitalSambaApiClient with circuit breaker pattern
* integration for improved fault tolerance and resilience.
*
* Key features:
* - Automatic protection of all API requests with circuit breakers
* - Per-endpoint circuit isolation to prevent cascading failures
* - Configurable fallback mechanisms for when circuits are open
* - Metrics integration for circuit state and event monitoring
*
* @module digital-samba-api-circuit-breaker
* @author Digital Samba Team
* @version 0.1.0
*/
import { DigitalSambaApiClient, type ApiResponse, type PaginationParams, type Room, type RoomCreateSettings, type TokenOptions, type TokenResponse } from './digital-samba-api.js';
import { MemoryCache } from './cache.js';
import { CircuitBreaker, type CircuitBreakerOptions } from './circuit-breaker.js';
/**
* Circuit breaker wrapper for the Digital Samba API client
*/
export declare class CircuitBreakerApiClient {
private apiClient;
private circuitPrefix;
private defaultOptions;
/**
* Creates a circuit breaker wrapper for the Digital Samba API client
*
* @param apiClient The Digital Samba API client to wrap
* @param circuitPrefix Prefix for circuit breaker names (default: 'api')
* @param defaultOptions Default options for all circuit breakers
*/
constructor(apiClient: DigitalSambaApiClient, circuitPrefix?: string, defaultOptions?: Partial<CircuitBreakerOptions>);
/**
* Initialize the API connection
* This is a special method that bypasses timeouts for the initial request
* and implements retries for better resilience during startup
*/
initializeConnection(): Promise<boolean>;
/**
* Create a circuit breaker for a specific API endpoint
*
* @param endpoint The API endpoint name
* @param options Additional circuit breaker options
* @param forceNoTimeout If true, disables timeout for this endpoint
* @returns A circuit breaker instance
*/
protected createCircuitBreaker(endpoint: string, options?: Partial<CircuitBreakerOptions>, forceNoTimeout?: boolean): CircuitBreaker;
/**
* Get the API key from context or direct value
*
* This method retrieves the API key using a prioritized approach:
* 1. First tries to get the API key from the ApiKeyContext (for session-based auth)
* 2. If not found, falls back to using the direct API key if provided during construction
* 3. If neither source provides an API key, throws an AuthenticationError
*
* @protected
* @returns {string} The API key to use for authentication
* @throws {AuthenticationError} If no API key is available from any source
*/
protected getApiKey(): string;
/**
* Get base URL of the API
*/
protected get apiBaseUrl(): string;
/**
* Get default room settings
*/
getDefaultRoomSettings(): Promise<Record<string, any>>;
/**
* Update default room settings
*/
updateDefaultRoomSettings(settings: Record<string, any>): Promise<Record<string, any>>;
/**
* List all rooms
*/
listRooms(params?: PaginationParams): Promise<ApiResponse<Room>>;
/**
* Get details for a specific room
*/
getRoom(roomId: string): Promise<Room>;
/**
* Create a new room
*/
createRoom(settings: RoomCreateSettings): Promise<Room>;
/**
* Update an existing room
*/
updateRoom(roomId: string, settings: Partial<RoomCreateSettings>): Promise<Room>;
/**
* Delete a room
*/
deleteRoom(roomId: string, options?: {
delete_resources?: boolean;
}): Promise<void>;
/**
* Generate a token for joining a room
*/
generateRoomToken(roomId: string, options: TokenOptions): Promise<TokenResponse>;
/**
* Delete all resources for a room
*/
deleteRoomResources(roomId: string): Promise<void>;
/**
* Create a circuit breaker API client from a standard Digital Samba API client
*
* @param apiClient The Digital Samba API client to wrap
* @param options Circuit breaker options
* @returns A circuit breaker wrapped API client
*/
static withCircuitBreaker(apiClient: DigitalSambaApiClient, options?: {
circuitPrefix?: string;
defaultOptions?: Partial<CircuitBreakerOptions>;
}): CircuitBreakerApiClient;
/**
* Create a new circuit breaker API client with the given API key
*
* @param apiKey API key for Digital Samba API
* @param apiBaseUrl Base URL for Digital Samba API
* @param cache Optional cache for API responses
* @param options Circuit breaker options
* @returns A circuit breaker API client
*/
static createWithApiKey(apiKey: string, apiBaseUrl?: string, cache?: MemoryCache, options?: {
circuitPrefix?: string;
defaultOptions?: Partial<CircuitBreakerOptions>;
}): CircuitBreakerApiClient;
}
export default CircuitBreakerApiClient;
//# sourceMappingURL=digital-samba-api-circuit-breaker.d.ts.map