UNPKG

@huddle01/server-sdk

Version:

The Huddle01 Server SDK allows you to perform protected admin actions on your server side, like generating peer access tokens and starting and stopping meeting recordings and livestreams.

148 lines (145 loc) 4.24 kB
import { GetRecordingsInputSchema } from '../recorder/recorder.js'; import 'zod'; /** * API Classes deals with all the Hub realted API calls */ declare class API { #private; constructor(data: { apiKey: string; }); /** * Create Room registers a new room in the developer hub. * The room can be used for multiple sessions. * @param data - metadata and roomLocked * @throws Error if the room creation fails */ createRoom: (data?: { roomLocked: boolean; metadata?: string; }) => Promise<{ message: string; roomId: string; }>; /** * Get Rooms gives the list of rooms registered in the developer hub * @param data - { * `limit` - Number of rooms to be fetched * `cursor` - Cursor for pagination * } * @throws Error if not able to get the rooms */ getRooms: (data?: { limit?: number; cursor?: number; }) => Promise<{ rooms: { roomId: string; createdAt: number; roomLocked: boolean; metadata: never; }[]; pageSize: number; current: number; nextCursor: number | null; prevCursor: number | null; count: number; }>; /** * Get all the live sessions for a particular project or roomId * @description - All the live sessions for a particular project id can be fetched * using this API. If room id is provided, then the sessions for that room will be fetched. * @param data - {roomId?: string} * @returns - List of sessions * @throws Error if not able to get the sessions */ getLiveSessions: (data?: { roomId?: string; }) => Promise<{ roomId: string; startTime: number; livestreamCount: number; recordingCount: number; }[] | { roomId: string; startTime: number; currentPeerCount: number; livestreamCount: number | null; recordingCount: number | null; }>; getMetrics: () => Promise<{ livestreamCount: number; recordingCount: number; totalSessions: number; totalDuration: number; totalUsers: number; }>; /** * Get the room details for a particular roomId * @param data - {roomId: string} * @returns - Object containing the metadata, room id and room locked status of the room */ getRoomDetails: (data: { roomId: string; }) => Promise<{ metadata: {} | null; roomId: string; roomLocked: boolean; }>; /** * Get the participants details for a live room. * @description - Get the list of all the participants for a live room * @param data - {roomId: string} * @returns - List of participants */ getLivePartipantsDetails: (data: { roomId: string; }) => Promise<{ peerId: string; joinTime: number | undefined; metadata: never; }[]>; /** * Get the participants details for a session. * @description - Get the list of all the participants for a particular session * @param data - {sessionId: string} * @returns - List of participants */ getPartipantsDetails: (data: { sessionId: string; }) => Promise<{ peerId: string; joinTime: number; exitTime: number | undefined; metadata: never; }[]>; /** * Get the list of all the sessions for a particular roomId - Same Room can be used for multiple sessions. * @param data - {roomId: string} * @returns - List of sessions */ getRoomSessions: (data: { roomId: string; limit?: number; cursor?: number; }) => Promise<{ sessionId: string; endTime: number | null; startTime: number; }[]>; getRecordings: (data?: GetRecordingsInputSchema) => Promise<{ data: { recordings: { id: string; recordingUrl: string; recordingSize: number; }[]; nextCursor: number | null; }; error?: undefined; } | { data: null; error: Error; }>; } export { API };