openvidu/typings/src/room.ts
2025-09-10 00:22:11 +02:00

91 lines
3.5 KiB
TypeScript

import { ParticipantPermissions, ParticipantRole } from './participant.js';
import { MeetRoomConfig } from './room-config.js';
interface BaseRoomOptions {
roomName?: string;
autoDeletionDate?: number;
autoDeletionPolicy?: MeetRoomAutoDeletionPolicy;
config?: MeetRoomConfig;
// maxParticipants?: number | null;
}
/**
* Options for creating or configuring a room.
*/
export type MeetRoomOptions = BaseRoomOptions;
/**
* Interface representing the response received when a room is created.
*/
export interface MeetRoom extends BaseRoomOptions {
roomId: string;
roomName: string;
creationDate: number;
config: MeetRoomConfig;
moderatorUrl: string;
speakerUrl: string;
status: MeetRoomStatus;
meetingEndAction: MeetingEndAction; // Action to take on the room when the meeting ends
}
export const enum MeetRoomStatus {
OPEN = 'open', // Room is open and available to host a meeting
ACTIVE_MEETING = 'active_meeting', // There is an ongoing meeting in the room
CLOSED = 'closed' // Room is closed to hosting new meetings
}
export const enum MeetingEndAction {
NONE = 'none', // No action is taken when the meeting ends
CLOSE = 'close', // The room will be closed when the meeting ends
DELETE = 'delete' // The room (and its recordings if any) will be deleted when the meeting ends
}
export interface MeetRoomAutoDeletionPolicy {
withMeeting: MeetRoomDeletionPolicyWithMeeting;
withRecordings: MeetRoomDeletionPolicyWithRecordings;
}
export const enum MeetRoomDeletionPolicyWithMeeting {
FORCE = 'force', // Force deletion even if there is an active meeting
WHEN_MEETING_ENDS = 'when_meeting_ends', // Delete the room when the meeting ends
FAIL = 'fail' // Fail the deletion if there is an active meeting
}
export const enum MeetRoomDeletionPolicyWithRecordings {
FORCE = 'force', // Force deletion even if there are ongoing or previous recordings
CLOSE = 'close', // Close the room and keep recordings
FAIL = 'fail' // Fail the deletion if there are ongoing or previous recordings
}
export interface MeetRoomRoleAndPermissions {
role: ParticipantRole;
permissions: ParticipantPermissions;
}
export type MeetRoomFilters = {
maxItems?: number;
nextPageToken?: string;
roomName?: string;
fields?: string;
};
export const enum MeetRoomDeletionSuccessCode {
ROOM_DELETED = 'room_deleted',
ROOM_WITH_ACTIVE_MEETING_DELETED = 'room_with_active_meeting_deleted',
ROOM_WITH_ACTIVE_MEETING_SCHEDULED_TO_BE_DELETED = 'room_with_active_meeting_scheduled_to_be_deleted',
ROOM_AND_RECORDINGS_DELETED = 'room_and_recordings_deleted',
ROOM_CLOSED = 'room_closed',
ROOM_WITH_ACTIVE_MEETING_AND_RECORDINGS_DELETED = 'room_with_active_meeting_and_recordings_deleted',
ROOM_WITH_ACTIVE_MEETING_CLOSED = 'room_with_active_meeting_closed',
ROOM_WITH_ACTIVE_MEETING_AND_RECORDINGS_SCHEDULED_TO_BE_DELETED = 'room_with_active_meeting_and_recordings_scheduled_to_be_deleted',
ROOM_WITH_ACTIVE_MEETING_SCHEDULED_TO_BE_CLOSED = 'room_with_active_meeting_scheduled_to_be_closed'
}
export const enum MeetRoomDeletionErrorCode {
ROOM_HAS_ACTIVE_MEETING = 'room_has_active_meeting',
ROOM_HAS_RECORDINGS = 'room_has_recordings',
ROOM_WITH_ACTIVE_MEETING_HAS_RECORDINGS = 'room_with_active_meeting_has_recordings',
ROOM_WITH_ACTIVE_MEETING_HAS_RECORDINGS_CANNOT_SCHEDULE_DELETION = 'room_with_active_meeting_has_recordings_cannot_schedule_deletion',
ROOM_WITH_RECORDINGS_HAS_ACTIVE_MEETING = 'room_with_recordings_has_active_meeting'
}