UNPKG

digital-samba-mcp-server

Version:

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

1,045 lines 30.6 kB
import { MemoryCache } from './cache.js'; export interface PaginationParams { limit?: number; offset?: number; order?: 'asc' | 'desc'; after?: string; } export interface DateRangeParams { date_start?: string; date_end?: string; } export interface ApiResponse<T> { data: T[]; total_count: string | number; length: number; map: <U>(callback: (value: T, index: number, array: T[]) => U) => U[]; } export interface Room { id: string; description?: string; topic?: string; friendly_url?: string; privacy: 'public' | 'private'; max_participants?: number; max_broadcasters?: number; is_locked?: boolean; external_id?: string; room_url?: string; created_at: string; updated_at: string; topbar_enabled?: boolean; toolbar_enabled?: boolean; toolbar_position?: 'left' | 'right' | 'bottom'; toolbar_color?: string; primary_color?: string; background_color?: string; palette_mode?: 'light' | 'dark'; language?: string; language_selection_enabled?: boolean; audio_on_join_enabled?: boolean; video_on_join_enabled?: boolean; screenshare_enabled?: boolean; participants_list_enabled?: boolean; chat_enabled?: boolean; private_chat_enabled?: boolean; recordings_enabled?: boolean; is_breakout?: boolean; parent_id?: string; [key: string]: any; } export interface RoomCreateSettings { name: string; description?: string; friendly_url?: string; privacy?: 'public' | 'private'; external_id?: string; max_participants?: number; max_broadcasters?: number; is_locked?: boolean; roles?: string[]; default_role?: string; topbar_enabled?: boolean; toolbar_enabled?: boolean; toolbar_position?: 'left' | 'right' | 'bottom'; toolbar_color?: string; primary_color?: string; background_color?: string; palette_mode?: 'light' | 'dark'; language?: string; language_selection_enabled?: boolean; audio_on_join_enabled?: boolean; video_on_join_enabled?: boolean; screenshare_enabled?: boolean; participants_list_enabled?: boolean; chat_enabled?: boolean; private_chat_enabled?: boolean; recordings_enabled?: boolean; [key: string]: any; } export interface Participant { id: string; external_id?: string; session_id: string; room_id: string; room_external_id?: string; room_is_deleted: boolean; name: string; role?: string; friendly_url?: string; join_time: string; leave_time?: string; live: boolean; } export interface ParticipantDetail extends Participant { device?: string; system?: string; browser?: string; e2ee?: boolean; participation_minutes?: number; public_chat_posts?: number; questions?: number; answers?: number; } export interface TokenOptions { ud?: string; u?: string; role?: string; initials?: string; avatar?: string; breakoutId?: string; nbf?: string; exp?: string; } export interface TokenResponse { token: string; link: string; } export interface Recording { id: string; name?: string; status: 'AWAITING_START' | 'IN_PROGRESS' | 'PENDING_CONVERSION' | 'READY'; room_id: string; external_room_id?: string; friendly_url?: string; privacy?: 'public' | 'private'; session_id?: string; participant_id?: string; participant_name?: string; participant_external_id?: string; duration?: number; created_at: string; updated_at: string; } export interface RecordingDownloadLink { link: string; valid_until: string; } export interface Session { id: string; start_time: string; end_time?: string; room_id: string; room_external_id?: string; description?: string; friendly_url?: string; room_is_deleted: boolean; participants_live?: number; participants_total: number; participants_max: number; live: boolean; } export interface SessionStatistics { room_id: string; room_external_id?: string; room_description?: string; room_friendly_url?: string; room_privacy?: string; room_source?: string; room_max_participants?: number; room_is_deleted: boolean; session_id: string; session_duration: number; session_live: boolean; session_start_time: string; session_end_time?: string; participation_minutes: number; desktop_participation_minutes?: number; mobile_participation_minutes?: number; tablet_participation_minutes?: number; smarttv_participation_minutes?: number; broadcasted_minutes?: number; subscribed_minutes?: number; live_participants: number; active_participants: number; max_concurrent_participants?: number; [key: string]: any; } export interface Webhook { id: string; endpoint: string; authorization_header?: string; name?: string; events?: string[]; created_at: string; updated_at: string; } export interface WebhookCreateSettings { endpoint: string; name?: string; authorization_header?: string; events: string[]; } export interface BreakoutRoom extends Room { is_breakout: true; parent_id: string; } export interface BreakoutRoomCreateSettings { count: number; name_prefix?: string; auto_assign?: boolean; distribution_method?: 'random' | 'manual'; } export interface BreakoutRoomParticipantAssignment { participant_id: string; breakout_id: string | null; } export interface ScheduledMeeting { id: string; title: string; description?: string; room_id: string; start_time: string; end_time: string; timezone: string; host_name: string; host_email?: string; participants: { name: string; email: string; role?: string; }[]; recurring?: boolean; recurrence_pattern?: string; status: 'scheduled' | 'started' | 'ended' | 'cancelled'; created_at: string; updated_at: string; } export interface MeetingCreateSettings { title: string; description?: string; room_id?: string; room_settings?: { name?: string; privacy?: 'public' | 'private'; max_participants?: number; }; start_time: string; end_time: string; timezone: string; host_name: string; host_email?: string; participants?: { name: string; email: string; role?: string; }[]; recurring?: boolean; recurrence_pattern?: string; send_invitations?: boolean; } export interface MeetingUpdateSettings { title?: string; description?: string; start_time?: string; end_time?: string; timezone?: string; host_name?: string; host_email?: string; participants?: { name: string; email: string; role?: string; }[]; recurring?: boolean; recurrence_pattern?: string; status?: 'scheduled' | 'cancelled'; send_updates?: boolean; } export interface MeetingParticipantAddOptions { participants: { name: string; email: string; role?: string; }[]; send_invitations?: boolean; } export interface MeetingParticipantRemoveOptions { participant_emails: string[]; notify_participants?: boolean; } export interface MeetingReminderOptions { message?: string; } export interface MeetingAvailabilityOptions { participants: string[]; duration_minutes: number; start_date: string; end_date: string; timezone: string; working_hours_start?: number; working_hours_end?: number; min_options?: number; } export interface AvailableTimeSlot { start_time: string; end_time: string; } export interface Poll { id: string; question: string; status: string; multiple: boolean; anonymous: boolean; options: PollOption[]; created_at: string; } export interface PollOption { id: string; text: string; } export interface PollCreateSettings { question: string; multiple?: boolean; anonymous?: boolean; options: { text: string; }[]; } export interface Role { id: string; name: string; display_name: string; description?: string; default: boolean; created_at: string; updated_at: string; permissions?: Record<string, any>; } export interface RoleCreateSettings { name: string; display_name: string; description?: string; permissions: Record<string, any>; } export interface Library { id: string; external_id?: string; name: string; created_at: string; } export interface LibraryFolder { id: string; external_id?: string; description?: string; created_at: string; } export interface LibraryFile { id: string; folder_id?: string; name: string; type: string; size: number; created_at: string; } /** * Digital Samba API Client * * This class provides a comprehensive interface to the Digital Samba API. It handles * authentication, request formation, response parsing, and error handling for all * available API endpoints. The client supports both direct API key authentication * and session-based authentication through the ApiKeyContext. * * @class DigitalSambaApiClient * @example * // Create a client with direct API key * const client = new DigitalSambaApiClient('your-api-key'); * * // Create a client that uses the ApiKeyContext * const sessionClient = new DigitalSambaApiClient(); * * // List all rooms * const rooms = await client.listRooms(); * * // Create a room * const room = await client.createRoom({ * name: 'New Meeting Room', * privacy: 'public' * }); */ export declare class DigitalSambaApiClient { protected apiBaseUrl: string; protected cache?: MemoryCache; /** * Creates an instance of the Digital Samba API Client * * @constructor * @param {string} [apiKey] - Optional API key for direct authentication. If not provided, * the client will use the ApiKeyContext for session-based authentication * @param {string} [apiBaseUrl='https://api.digitalsamba.com/api/v1'] - Base URL for the Digital Samba API * @example * // Create a client with the default API URL * const client = new DigitalSambaApiClient('your-api-key'); * * // Create a client with a custom API URL * const customClient = new DigitalSambaApiClient('your-api-key', 'https://custom-api.example.com/v1'); */ constructor(apiKey?: string, apiBaseUrl?: string, cache?: MemoryCache); private _apiKey?; /** * 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; /** * Make an authenticated request to the Digital Samba API * * This method handles all API requests including authentication, error handling, and response parsing. * It automatically adds the Authorization header with the API key, logs request details (excluding sensitive * information), and processes the response. It also handles special cases like 204 No Content responses and * adds array-like properties to ApiResponse objects for easier consumption. * * @protected * @template T - The expected response type * @param {string} endpoint - The API endpoint path (without the base URL) * @param {RequestInit} [options={}] - Request options, including method, body, and additional headers * @returns {Promise<T>} A promise resolving to the parsed response data * @throws {AuthenticationError} If no API key is available for authentication * @throws {ApiRequestError} If a network error occurs during the request * @throws {ApiResponseError} If the API returns a non-2xx status code * @throws {ValidationError} If the API returns a 400 Bad Request with validation errors * @throws {ResourceNotFoundError} If the API returns a 404 Not Found response * @example * // Example internal usage * const rooms = await this.request<ApiResponse<Room>>('/rooms'); */ protected request<T>(endpoint: string, options?: RequestInit): Promise<T>; /** * 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>; /** * Get rooms with live participants count */ getLiveRooms(params?: PaginationParams): Promise<ApiResponse<{ id: string; external_id?: string; start_time: string; session_duration: number; live_participants: number; }>>; /** * Get rooms with live participants data */ getLiveRoomsWithParticipants(params?: PaginationParams): Promise<ApiResponse<{ id: string; external_id?: string; start_time: string; session_duration: number; live_participants: { id: string; external_id?: string; name: string; role: string; join_time: string; }[]; }>>; /** * Get single room with live participants count */ getRoomLiveParticipantsCount(roomId: string): Promise<{ id: string; external_id?: string; start_time: string; session_duration: number; live_participants: number; }>; /** * Get single room with live participants data */ getRoomLiveParticipantsData(roomId: string): Promise<{ id: string; external_id?: string; start_time: string; session_duration: number; live_participants: { id: string; external_id?: string; name: string; role: string; join_time: string; }[]; }>; /** * List all participants */ listParticipants(params?: PaginationParams & DateRangeParams & { live?: boolean; room_id?: string; session_id?: string; }): Promise<ApiResponse<Participant>>; /** * Get details for a specific participant */ getParticipant(participantId: string): Promise<ParticipantDetail>; /** * List participants in a room */ listRoomParticipants(roomId: string, params?: PaginationParams & DateRangeParams & { live?: boolean; session_id?: string; }): Promise<ApiResponse<Participant>>; /** * List participants in a session */ listSessionParticipants(sessionId: string, params?: PaginationParams & DateRangeParams & { live?: boolean; }): Promise<ApiResponse<Participant>>; /** * Phone participants joined */ phoneParticipantsJoined(roomId: string, participants: { call_id: string; name?: string; caller_number?: string; external_id?: string; }[]): Promise<void>; /** * Phone participants left */ phoneParticipantsLeft(roomId: string, callIds: string[]): Promise<void>; /** * List all recordings */ listRecordings(params?: PaginationParams & { room_id?: string; session_id?: string; status?: 'IN_PROGRESS' | 'PENDING_CONVERSION' | 'READY'; }): Promise<ApiResponse<Recording>>; /** * List archived recordings */ listArchivedRecordings(params?: PaginationParams & { room_id?: string; }): Promise<ApiResponse<Recording>>; /** * Get a specific recording */ getRecording(recordingId: string): Promise<Recording>; /** * Delete a recording */ deleteRecording(recordingId: string): Promise<void>; /** * Get a download link for a recording */ getRecordingDownloadLink(recordingId: string, validForMinutes?: number): Promise<RecordingDownloadLink>; /** * Archive a recording */ archiveRecording(recordingId: string): Promise<void>; /** * Unarchive a recording */ unarchiveRecording(recordingId: string): Promise<void>; /** * Start recording in a room */ startRecording(roomId: string): Promise<void>; /** * Stop recording in a room */ stopRecording(roomId: string): Promise<void>; /** * List available event types for webhooks */ listWebhookEvents(): Promise<string[]>; /** * List all webhooks */ listWebhooks(params?: PaginationParams): Promise<ApiResponse<Webhook>>; /** * Create a new webhook */ createWebhook(settings: WebhookCreateSettings): Promise<Webhook>; /** * Get a specific webhook */ getWebhook(webhookId: string): Promise<Webhook>; /** * Update a webhook */ updateWebhook(webhookId: string, settings: Partial<WebhookCreateSettings>): Promise<Webhook>; /** * Delete a webhook */ deleteWebhook(webhookId: string): Promise<void>; /** * List all roles */ listRoles(params?: PaginationParams): Promise<ApiResponse<Role>>; /** * Create a new role */ createRole(settings: RoleCreateSettings): Promise<Role>; /** * Get a specific role */ getRole(roleId: string): Promise<Role>; /** * Update a role */ updateRole(roleId: string, settings: Partial<RoleCreateSettings>): Promise<Role>; /** * Delete a role */ deleteRole(roleId: string): Promise<void>; /** * List all available permissions */ listPermissions(): Promise<string[]>; /** * List all sessions */ listSessions(params?: PaginationParams & DateRangeParams & { live?: boolean; room_id?: string; }): Promise<ApiResponse<Session>>; /** * List sessions for a specific room */ listRoomSessions(roomId: string, params?: PaginationParams & DateRangeParams & { live?: boolean; }): Promise<ApiResponse<Session>>; /** * Get session statistics */ getSessionStatistics(sessionId: string, metrics?: string): Promise<SessionStatistics>; /** * End a live session */ endSession(sessionId: string): Promise<void>; /** * Get session summary */ getSessionSummary(sessionId: string): Promise<{ job_id: string; status: 'IN_PROGRESS' | 'READY'; summary: string; }>; /** * Delete session data */ deleteSessionData(sessionId: string, dataType: 'chat' | 'questions' | 'summaries' | 'transcripts' | 'polls' | 'recordings' | 'resources'): Promise<void>; /** * Get chat messages */ getChatMessages(roomId: string, params?: PaginationParams & { session_id?: string; }): Promise<ApiResponse<{ id: string; message: string; participant_id: string; external_participant_id?: string; participant_name: string; breakout_id?: string; created_at: string; }>>; /** * Delete chat messages */ deleteChatMessages(roomId: string): Promise<void>; /** * Export chat messages */ exportChatMessages(roomId: string, options?: { session_id?: string; format?: 'txt' | 'json'; }): Promise<string>; /** * Get Q&A */ getQuestionsAndAnswers(roomId: string, params?: PaginationParams & { session_id?: string; }): Promise<ApiResponse<{ id: string; question: string; participant_id: string; external_participant_id?: string; participant_name: string; created_at: string; answers: { id: string; answer: string; participant_id: string; external_participant_id?: string; participant_name: string; created_at: string; }[]; }>>; /** * Delete Q&A */ deleteQA(roomId: string): Promise<void>; /** * Export Q&A */ exportQA(roomId: string, options?: { session_id?: string; format?: 'txt' | 'json'; }): Promise<string>; /** * Get polls */ getPolls(roomId: string, params?: PaginationParams): Promise<Poll[]>; /** * Create a poll */ createPoll(roomId: string, settings: PollCreateSettings): Promise<Poll>; /** * Get a specific poll */ getPoll(roomId: string, pollId: string): Promise<Poll>; /** * Update a poll */ updatePoll(roomId: string, pollId: string, settings: Partial<PollCreateSettings>): Promise<Poll>; /** * Delete a poll */ deletePoll(roomId: string, pollId: string): Promise<void>; /** * Get poll results */ getPollResults(roomId: string, pollId: string, sessionId?: string): Promise<{ id: string; session_id: string; question: string; status: string; started: string; ended?: string; votes: number; options: { id: string; text: string; voted: number; voters: { id: string; name: string; }[]; }[]; }[]>; /** * Export polls */ exportPolls(roomId: string, options?: { session_id?: string; format?: 'txt' | 'json'; }): Promise<string>; /** * List all libraries */ listLibraries(params?: PaginationParams): Promise<ApiResponse<Library>>; /** * Create a new library */ createLibrary(settings: { name?: string; external_id: string; }): Promise<Library>; /** * Get a specific library */ getLibrary(libraryId: string): Promise<Library>; /** * Update a library */ updateLibrary(libraryId: string, settings: { name?: string; external_id?: string; }): Promise<Library>; /** * Delete a library */ deleteLibrary(libraryId: string): Promise<void>; /** * Get library hierarchy */ getLibraryHierarchy(libraryId: string): Promise<Record<string, any>>; /** * List library folders */ listLibraryFolders(libraryId: string, params?: PaginationParams): Promise<ApiResponse<LibraryFolder>>; /** * Create a library folder */ createLibraryFolder(libraryId: string, settings: { name?: string; parent_id?: string; }): Promise<LibraryFolder>; /** * Get a specific library folder */ getLibraryFolder(libraryId: string, folderId: string): Promise<LibraryFolder>; /** * Update a library folder */ updateLibraryFolder(libraryId: string, folderId: string, settings: { name?: string; parent_id?: string; }): Promise<LibraryFolder>; /** * Delete a library folder */ deleteLibraryFolder(libraryId: string, folderId: string): Promise<void>; /** * List library files */ listLibraryFiles(libraryId: string, params?: PaginationParams): Promise<LibraryFile[]>; /** * Create a new library file (get upload URL and token) */ createLibraryFile(libraryId: string, settings: { name: string; folder_id?: string; }): Promise<{ file_id: string; file_name: string; external_storage_url: string; token: string; expiration_timestamp: number; }>; /** * Get a specific library file */ getLibraryFile(libraryId: string, fileId: string): Promise<LibraryFile>; /** * Update a library file */ updateLibraryFile(libraryId: string, fileId: string, settings: { name?: string; folder_id?: string; }): Promise<LibraryFile>; /** * Delete a library file */ deleteLibraryFile(libraryId: string, fileId: string): Promise<void>; /** * Get file links */ getFileLinks(libraryId: string, fileId: string): Promise<{ pages: { url: string; thumbnail_url: string; }[]; }>; /** * Remove a participant from a room */ removeParticipant(roomId: string, participantId: string): Promise<void>; /** * Set participant mute status */ setParticipantMute(roomId: string, participantId: string, options: { mute: boolean; type?: 'audio' | 'video' | 'all'; }): Promise<void>; /** * Set participant role */ setParticipantRole(roomId: string, participantId: string, role: string): Promise<void>; /** * Ban a participant from a room */ banParticipant(roomId: string, participantId: string): Promise<void>; /** * Unban a participant from a room */ unbanParticipant(roomId: string, participantId: string): Promise<void>; /** * Get banned participants */ getBannedParticipants(roomId: string): Promise<ApiResponse<{ id: string; external_id?: string; name: string; ban_time: string; }>>; /** * Get team global statistics by period */ getTeamStatistics(params?: DateRangeParams & { metrics?: string; }): Promise<Record<string, any>>; /** * Get team global statistics by current period */ getTeamCurrentStatistics(metrics?: string): Promise<Record<string, any>>; /** * Get team statistics for current period (simplified) */ getSimplifiedTeamCurrentStatistics(): Promise<Record<string, any>>; /** * Get room statistics by period */ getRoomStatistics(roomId: string, params?: DateRangeParams & { metrics?: string; }): Promise<Record<string, any>>; /** * Get room statistics for current period */ getRoomCurrentStatistics(roomId: string, metrics?: string): Promise<Record<string, any>>; /** * Get participant statistics */ getParticipantStatistics(participantId: string): Promise<ParticipantDetail>; /** * List breakout rooms for a parent room */ listBreakoutRooms(roomId: string, params?: PaginationParams): Promise<ApiResponse<BreakoutRoom>>; /** * Get a specific breakout room */ getBreakoutRoom(roomId: string, breakoutRoomId: string): Promise<BreakoutRoom>; /** * Create breakout rooms */ createBreakoutRooms(roomId: string, settings: BreakoutRoomCreateSettings): Promise<ApiResponse<BreakoutRoom>>; /** * Delete a breakout room */ deleteBreakoutRoom(roomId: string, breakoutRoomId: string): Promise<void>; /** * Delete all breakout rooms */ deleteAllBreakoutRooms(roomId: string): Promise<void>; /** * List participants in a breakout room */ listBreakoutRoomParticipants(roomId: string, breakoutRoomId: string, params?: PaginationParams): Promise<ApiResponse<Participant>>; /** * Assign participants to breakout rooms */ assignParticipantsToBreakoutRooms(roomId: string, assignments: BreakoutRoomParticipantAssignment[]): Promise<void>; /** * Return all participants to the main room */ returnAllParticipantsToMainRoom(roomId: string): Promise<void>; /** * Broadcast message to all breakout rooms */ broadcastToBreakoutRooms(roomId: string, options: { message: string; }): Promise<void>; /** * Open breakout rooms (start breakout sessions) */ openBreakoutRooms(roomId: string): Promise<void>; /** * Close breakout rooms */ closeBreakoutRooms(roomId: string): Promise<void>; /** * List all scheduled meetings */ listScheduledMeetings(params?: PaginationParams & DateRangeParams): Promise<ApiResponse<ScheduledMeeting>>; /** * Get a specific scheduled meeting */ getScheduledMeeting(meetingId: string): Promise<ScheduledMeeting>; /** * Create a new scheduled meeting */ createScheduledMeeting(settings: MeetingCreateSettings): Promise<ScheduledMeeting>; /** * Update a scheduled meeting */ updateScheduledMeeting(meetingId: string, settings: MeetingUpdateSettings): Promise<ScheduledMeeting>; /** * Cancel a scheduled meeting */ cancelScheduledMeeting(meetingId: string, options?: { notify_participants?: boolean; }): Promise<void>; /** * Delete a scheduled meeting */ deleteScheduledMeeting(meetingId: string): Promise<void>; /** * List upcoming meetings */ listUpcomingMeetings(params?: PaginationParams): Promise<ApiResponse<ScheduledMeeting>>; /** * List meetings for a specific room */ listRoomMeetings(roomId: string, params?: PaginationParams & DateRangeParams): Promise<ApiResponse<ScheduledMeeting>>; /** * Add participants to a meeting */ addMeetingParticipants(meetingId: string, options: MeetingParticipantAddOptions): Promise<void>; /** * Remove participants from a meeting */ removeMeetingParticipants(meetingId: string, options: MeetingParticipantRemoveOptions): Promise<void>; /** * Send meeting reminders */ sendMeetingReminders(meetingId: string, options?: MeetingReminderOptions): Promise<void>; /** * Find available meeting times */ findAvailableMeetingTimes(options: MeetingAvailabilityOptions): Promise<AvailableTimeSlot[]>; } //# sourceMappingURL=digital-samba-api.d.ts.map