-
Notifications
You must be signed in to change notification settings - Fork 70
/
types.ts
207 lines (183 loc) · 5.86 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// Copyright (c) 2023 Sourcefuse Technologies
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
import {SessionAttendees} from './models/session-attendees.model';
import {VideoChatSession} from './models/video-chat-session.model';
import {VonageSessionWebhookPayload} from './providers';
/**
* @interface ResponseInterface
* @param message
* describes sucess/failure or any descriptive message w.r.t any API/function executed
*/
export interface ResponseInterface {
message: string;
}
export interface IConfig {
timeToStart: number;
}
export interface VideoChatInterface {
/**
* @function getMeetingLink Generates a meeting Id which is further used for sharing links
* @param options: object with type @interface MeetingOptions which is defined as an Interface
* @returns Promise when resolved returns object of @interface MeetingResponse
*/
getMeetingLink(options: MeetingOptions): Promise<MeetingResponse>;
/**
* @function getToken Generates a token which is used for authorization to connect to a room
* @param options: object with type @interface SessionOptions
* @returns Promise when resolved returns object of type @interface SessionResponse
*/
getToken(
sessionId: string,
options: SessionOptions,
): Promise<SessionResponse>;
/**
* @function getArchives get a specific recorded/composed archive or a list of archives
* @param archiveId: optional archive id of type number
* @returns a list of archives after resolving promise
*/
getArchives(
archiveId: string | null,
): Promise<ArchiveResponse | ArchiveResponseList>;
/**
* @function deleteArchive delete a specific archive
* @param archiveId id of an archive
* @returns Promise then returns a successful message for deleting if promise is resolved
*/
deleteArchive(archiveId: string): Promise<void>;
/**
* @function setUploadTarget set the upload target
* @param config of type @interface S3TargetOptions or @interface AzureTargetOptions
*/
setUploadTarget(config: ExternalStorageOptions): Promise<void>;
// /**
// * @function deleteUploadTarget delete the upload target from s3/azure
// */
// deleteUploadTarget(): Promise<void>;
getFeatures(): VideoChatFeatures;
checkWebhookPayload(webhookPayload: WebhookPayloadParameters): Promise<void>;
}
export interface VideoChatFeatures {
schedule: boolean;
archive: boolean;
}
/**
* @interface SessionResponse
* @param sessionId unique room name which is sent as a response to connect to a room.
* @param token token generated for authorization
*/
export interface SessionResponse {
sessionId: string;
token: string;
}
/**
* @interface ArchiveResponse
* @param name Optional name of an archive
* @param sessionId Session Id of the meeting that has been used for archiving
*/
export interface ArchiveResponse {
name?: string;
sessionId: string;
metaData: object;
}
/**
* @interface ArchiveResponseList
* @param count Number of archives
* @param items array containing list of @interface ArchiveResponse
*/
export interface ArchiveResponseList {
count: number;
items: ArchiveResponse[];
}
/**
* @interface ExternalStorageOptions
* @param name name of the external storage, For example : 'AWSS3', 'AZURE'
*/
export interface ExternalStorageOptions {
name: ExternalStorageName;
}
/**
* @interface S3TargetOptions
* @param config object containing azure/s3 details
* @param bucket s3 bucket name
*/
export enum ExternalStorageName {
AWSS3 = 'AWSS3',
AZURE = 'AZURE',
}
/**
* @interface AzureTargetOptions
* @param accountName The Windows Azure account name
* @param accountKey The Windows Azure account key
* @param container The Windows Azure container name
* @param domain (optional) — The Windows Azure domain in which the container resides.
*/
export interface AzureTargetOptions extends ExternalStorageOptions {
accountName: string;
domain?: string;
}
export interface WebhookPayloadParameters {
event?: string;
}
/**
* @interface MeetingOptions
* @param archiveMode optional parameter to enable/disable recordings. Default will be false
* @param isScheduled
* parameter to check whether a meeting is booked now if @param isScheduled=false
* or scheduled at a later time if @param isScheduled=true.
* @param scheduleTime not required if @param isScheduled is false,
* else set a later time for scheduling meeting
*
*/
export interface MeetingOptions {
isScheduled: boolean;
scheduleTime?: Date;
enableArchiving?: boolean;
}
export interface MeetingResponse {
sessionId: string;
isArchived?: boolean;
meetingId?: string;
}
/**
* @interface SessionOptions
* @param meetingId unique meetingId which is used inside sharing link urls.
* @param expireTime set the ttl (time to live) for a session created For twilio,
* it is max 4 hours.
*/
export interface SessionOptions {
meetingLink?: string;
expireTime?: Date;
data?: string;
meetingLinkId?: string;
}
export interface IArchiveService {
getArchive(archiveId: string): void;
getArchives(): void;
deleteArchive(archiveId: string): Promise<void>;
setUploadTarget(body: ExternalStorageOptions): Promise<void>;
}
export interface ISessionService {
getMeetingLink(options: MeetingOptions): Promise<string>;
getMeetingToken(
sessionOptions: SessionOptions,
meetingLinkId: string,
): Promise<SessionResponse>;
editMeeting(
meetingLinkId: string,
body: Partial<VideoChatSession>,
): Promise<void>;
endSession(meetingLinkId: string): Promise<void>;
checkWebhookPayload(webhookPayload: VonageSessionWebhookPayload): void;
processStreamDestroyedEvent(
webhookPayload: VonageSessionWebhookPayload,
sessionAttendeeDetail: SessionAttendees,
updatedAttendee: Partial<SessionAttendees>,
): void;
getAttendeesList(
meetingLinkId: string,
active: string,
): Promise<SessionAttendees[]>;
}
export {SessionAttendees};