UNPKG

@signalwire/compatibility-api

Version:
441 lines (416 loc) 15.1 kB
/** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ import Page = require('../../../base/Page'); import Response = require('../../../http/response'); import V1 = require('../V1'); import { ParticipantList } from './room/roomParticipant'; import { ParticipantListInstance } from './room/roomParticipant'; import { RecordingRulesList } from './room/roomRecordingRule'; import { RecordingRulesListInstance } from './room/roomRecordingRule'; import { RoomRecordingList } from './room/recording'; import { RoomRecordingListInstance } from './room/recording'; import { SerializableClass } from '../../../interfaces'; type RoomRoomStatus = 'in-progress'|'completed'|'failed'; type RoomRoomType = 'go'|'peer-to-peer'|'group'|'group-small'; type RoomVideoCodec = 'VP8'|'H264'; /** * Initialize the RoomList * * @param version - Version of the resource */ declare function RoomList(version: V1): RoomListInstance; /** * Options to pass to update * * @property status - The new status of the resource */ interface RoomInstanceUpdateOptions { status: RoomRoomStatus; } interface RoomListInstance { /** * @param sid - sid of instance */ (sid: string): RoomContext; /** * create a RoomInstance * * @param callback - Callback to handle processed record */ create(callback?: (error: Error | null, item: RoomInstance) => any): Promise<RoomInstance>; /** * create a RoomInstance * * @param opts - Options for request * @param callback - Callback to handle processed record */ create(opts?: RoomListInstanceCreateOptions, callback?: (error: Error | null, item: RoomInstance) => any): Promise<RoomInstance>; /** * Streams RoomInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param callback - Function to process each record */ each(callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void; /** * Streams RoomInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param opts - Options for request * @param callback - Function to process each record */ each(opts?: RoomListInstanceEachOptions, callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void; /** * Constructs a room * * @param sid - The SID that identifies the resource to fetch */ get(sid: string): RoomContext; /** * Retrieve a single target page of RoomInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param callback - Callback to handle list of records */ getPage(callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; /** * Retrieve a single target page of RoomInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param targetUrl - API-generated URL for the requested results page * @param callback - Callback to handle list of records */ getPage(targetUrl?: string, callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; /** * Lists RoomInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param callback - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>; /** * Lists RoomInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param opts - Options for request * @param callback - Callback to handle list of records */ list(opts?: RoomListInstanceOptions, callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>; /** * Retrieve a single page of RoomInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param callback - Callback to handle list of records */ page(callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; /** * Retrieve a single page of RoomInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param opts - Options for request * @param callback - Callback to handle list of records */ page(opts?: RoomListInstancePageOptions, callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; /** * Provide a user-friendly representation */ toJSON(): any; } /** * Options to pass to create * * @property audioOnly - Indicates whether the room will only contain audio track participants for group rooms. * @property emptyRoomTimeout - Configures the time a room will remain active after last participant leaves. * @property enableTurn - Enable Twilio's Network Traversal TURN service * @property largeRoom - Indicates whether this is a large room. * @property maxParticipantDuration - The maximum number of seconds a Participant can be connected to the room * @property maxParticipants - The maximum number of concurrent Participants allowed in the room * @property mediaRegion - The region for the media server in Group Rooms * @property recordParticipantsOnConnect - Whether to start recording when Participants connect * @property recordingRules - A collection of Recording Rules * @property statusCallback - The URL to send status information to your application * @property statusCallbackMethod - The HTTP method we should use to call status_callback * @property type - The type of room * @property uniqueName - An application-defined string that uniquely identifies the resource * @property unusedRoomTimeout - Configures the time a room will remain active when no one joins. * @property videoCodecs - An array of the video codecs that are supported when publishing a track in the room */ interface RoomListInstanceCreateOptions { audioOnly?: boolean; emptyRoomTimeout?: number; enableTurn?: boolean; largeRoom?: boolean; maxParticipantDuration?: number; maxParticipants?: number; mediaRegion?: string; recordParticipantsOnConnect?: boolean; recordingRules?: object; statusCallback?: string; statusCallbackMethod?: string; type?: RoomRoomType; uniqueName?: string; unusedRoomTimeout?: number; videoCodecs?: RoomVideoCodec | RoomVideoCodec[]; } /** * Options to pass to each * * @property callback - * Function to process each record. If this and a positional * callback are passed, this one will be used * @property dateCreatedAfter - Read only rooms that started on or after this date, given as YYYY-MM-DD * @property dateCreatedBefore - Read only rooms that started before this date, given as YYYY-MM-DD * @property done - Function to be called upon completion of streaming * @property limit - * Upper limit for the number of records to return. * each() guarantees never to return more than limit. * Default is no limit * @property pageSize - * Number of records to fetch per request, * when not set will use the default value of 50 records. * If no pageSize is defined but a limit is defined, * each() will attempt to read the limit with the most efficient * page size, i.e. min(limit, 1000) * @property status - Read only the rooms with this status * @property uniqueName - Read only rooms with this unique_name */ interface RoomListInstanceEachOptions { callback?: (item: RoomInstance, done: (err?: Error) => void) => void; dateCreatedAfter?: Date; dateCreatedBefore?: Date; done?: Function; limit?: number; pageSize?: number; status?: RoomRoomStatus; uniqueName?: string; } /** * Options to pass to list * * @property dateCreatedAfter - Read only rooms that started on or after this date, given as YYYY-MM-DD * @property dateCreatedBefore - Read only rooms that started before this date, given as YYYY-MM-DD * @property limit - * Upper limit for the number of records to return. * list() guarantees never to return more than limit. * Default is no limit * @property pageSize - * Number of records to fetch per request, * when not set will use the default value of 50 records. * If no page_size is defined but a limit is defined, * list() will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @property status - Read only the rooms with this status * @property uniqueName - Read only rooms with this unique_name */ interface RoomListInstanceOptions { dateCreatedAfter?: Date; dateCreatedBefore?: Date; limit?: number; pageSize?: number; status?: RoomRoomStatus; uniqueName?: string; } /** * Options to pass to page * * @property dateCreatedAfter - Read only rooms that started on or after this date, given as YYYY-MM-DD * @property dateCreatedBefore - Read only rooms that started before this date, given as YYYY-MM-DD * @property pageNumber - Page Number, this value is simply for client state * @property pageSize - Number of records to return, defaults to 50 * @property pageToken - PageToken provided by the API * @property status - Read only the rooms with this status * @property uniqueName - Read only rooms with this unique_name */ interface RoomListInstancePageOptions { dateCreatedAfter?: Date; dateCreatedBefore?: Date; pageNumber?: number; pageSize?: number; pageToken?: string; status?: RoomRoomStatus; uniqueName?: string; } interface RoomPayload extends RoomResource, Page.TwilioResponsePayload { } interface RoomResource { account_sid: string; audio_only: boolean; date_created: Date; date_updated: Date; duration: number; empty_room_timeout: number; enable_turn: boolean; end_time: Date; large_room: boolean; links: string; max_concurrent_published_tracks: number; max_participant_duration: number; max_participants: number; media_region: string; record_participants_on_connect: boolean; sid: string; status: RoomRoomStatus; status_callback: string; status_callback_method: string; type: RoomRoomType; unique_name: string; unused_room_timeout: number; url: string; video_codecs: RoomVideoCodec[]; } interface RoomSolution { } declare class RoomContext { /** * Initialize the RoomContext * * @param version - Version of the resource * @param sid - The SID that identifies the resource to fetch */ constructor(version: V1, sid: string); /** * fetch a RoomInstance * * @param callback - Callback to handle processed record */ fetch(callback?: (error: Error | null, items: RoomInstance) => any): Promise<RoomInstance>; participants: ParticipantListInstance; recordingRules: RecordingRulesListInstance; recordings: RoomRecordingListInstance; /** * Provide a user-friendly representation */ toJSON(): any; /** * update a RoomInstance * * @param opts - Options for request * @param callback - Callback to handle processed record */ update(opts: RoomInstanceUpdateOptions, callback?: (error: Error | null, items: RoomInstance) => any): Promise<RoomInstance>; } declare class RoomInstance extends SerializableClass { /** * Initialize the RoomContext * * @param version - Version of the resource * @param payload - The instance payload * @param sid - The SID that identifies the resource to fetch */ constructor(version: V1, payload: RoomPayload, sid: string); private _proxy: RoomContext; accountSid: string; audioOnly: boolean; dateCreated: Date; dateUpdated: Date; duration: number; emptyRoomTimeout: number; enableTurn: boolean; endTime: Date; /** * fetch a RoomInstance * * @param callback - Callback to handle processed record */ fetch(callback?: (error: Error | null, items: RoomInstance) => any): Promise<RoomInstance>; largeRoom: boolean; links: string; maxConcurrentPublishedTracks: number; maxParticipantDuration: number; maxParticipants: number; mediaRegion: string; /** * Access the participants */ participants(): ParticipantListInstance; recordParticipantsOnConnect: boolean; /** * Access the recordingRules */ recordingRules(): RecordingRulesListInstance; /** * Access the recordings */ recordings(): RoomRecordingListInstance; sid: string; status: RoomRoomStatus; statusCallback: string; statusCallbackMethod: string; /** * Provide a user-friendly representation */ toJSON(): any; type: RoomRoomType; uniqueName: string; unusedRoomTimeout: number; /** * update a RoomInstance * * @param opts - Options for request * @param callback - Callback to handle processed record */ update(opts: RoomInstanceUpdateOptions, callback?: (error: Error | null, items: RoomInstance) => any): Promise<RoomInstance>; url: string; videoCodecs: RoomVideoCodec[]; } declare class RoomPage extends Page<V1, RoomPayload, RoomResource, RoomInstance> { /** * Initialize the RoomPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoomSolution); /** * Build an instance of RoomInstance * * @param payload - Payload response from the API */ getInstance(payload: RoomPayload): RoomInstance; /** * Provide a user-friendly representation */ toJSON(): any; } export { RoomContext, RoomInstance, RoomInstanceUpdateOptions, RoomList, RoomListInstance, RoomListInstanceCreateOptions, RoomListInstanceEachOptions, RoomListInstanceOptions, RoomListInstancePageOptions, RoomPage, RoomPayload, RoomResource, RoomRoomStatus, RoomRoomType, RoomSolution, RoomVideoCodec }