fcr-core 3.8.1 → 3.9.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/lib/chat-connector/type.d.ts +40 -0
  2. package/lib/{chat-connection → chat-connector}/type.js +1 -1
  3. package/lib/engine/index.d.ts +10 -11
  4. package/lib/engine/index.js +63 -72
  5. package/lib/engine/type.d.ts +96 -0
  6. package/lib/engine/type.js +5 -0
  7. package/lib/imports.d.ts +7 -4
  8. package/lib/imports.js +30 -4
  9. package/lib/index.d.ts +3 -2
  10. package/lib/index.js +21 -2
  11. package/lib/media-control/desktop.js +12 -12
  12. package/lib/media-control/mobile.js +4 -0
  13. package/lib/media-control/type.d.ts +32 -33
  14. package/lib/monitor-control/index.js +3 -3
  15. package/lib/peer-session/index.js +14 -14
  16. package/lib/peer-session/type.d.ts +1 -1
  17. package/lib/plugins/chat/chatroom.js +417 -0
  18. package/lib/{chat-connection → plugins/chat}/config.d.ts +1 -0
  19. package/lib/{room-control/chatroom-control → plugins/chat}/config.js +2 -1
  20. package/lib/plugins/chat/connector.d.ts +38 -0
  21. package/lib/{chat-connection/index.js → plugins/chat/connector.js} +181 -61
  22. package/lib/room-control/ability-control/index.js +5 -4
  23. package/lib/room-control/ability-control/type.d.ts +5 -1
  24. package/lib/room-control/ability-control/type.js +4 -0
  25. package/lib/room-control/chatroom-control/type.d.ts +44 -35
  26. package/lib/room-control/group-control/index.js +9 -9
  27. package/lib/room-control/index.js +37 -22
  28. package/lib/room-control/interpreter-control/index.js +7 -4
  29. package/lib/room-control/interpreter-control/room.js +3 -3
  30. package/lib/room-control/interpreter-control/types.d.ts +2 -2
  31. package/lib/room-control/join-before-host-waitingroom-control/index.js +3 -3
  32. package/lib/room-control/mainroom-control/index.js +15 -13
  33. package/lib/room-control/privilege-control/index.js +39 -24
  34. package/lib/room-control/privilege-control/type.d.ts +15 -15
  35. package/lib/room-control/room-connector-control/index.js +7 -5
  36. package/lib/room-control/room-connector-control/type.d.ts +1 -1
  37. package/lib/room-control/room-control-factory.d.ts +3 -3
  38. package/lib/room-control/room-control-factory.js +7 -7
  39. package/lib/room-control/room-session/index.js +17 -15
  40. package/lib/room-control/room-session/type.d.ts +3 -3
  41. package/lib/room-control/sharing-control/index.js +13 -7
  42. package/lib/room-control/stream-control/index.js +18 -16
  43. package/lib/room-control/stream-control/type.d.ts +5 -5
  44. package/lib/room-control/stt-control/index.js +38 -31
  45. package/lib/room-control/type.d.ts +19 -19
  46. package/lib/room-control/user-control/index.js +20 -22
  47. package/lib/room-control/user-control/type.d.ts +1 -1
  48. package/lib/room-control/waitingroom-control/index.js +11 -11
  49. package/lib/room-control/whiteboard-control-v1/board-window.d.ts +21 -20
  50. package/lib/room-control/whiteboard-control-v1/board-window.js +27 -8
  51. package/lib/room-control/whiteboard-control-v1/factory.js +1 -1
  52. package/lib/room-control/whiteboard-control-v1/index.js +26 -18
  53. package/lib/room-control/whiteboard-control-v1/type.d.ts +26 -25
  54. package/lib/room-control/whiteboard-control-v1/type.js +1 -0
  55. package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +15 -6
  56. package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
  57. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +4 -5
  58. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +6 -5
  59. package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +7 -1
  60. package/lib/room-control/whiteboard-control-v2/base/index.d.ts +9 -8
  61. package/lib/room-control/whiteboard-control-v2/base/index.js +84 -42
  62. package/lib/room-control/whiteboard-control-v2/base/main-window.d.ts +16 -15
  63. package/lib/room-control/whiteboard-control-v2/base/main-window.js +23 -4
  64. package/lib/room-control/whiteboard-control-v2/type.d.ts +17 -17
  65. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +12 -6
  66. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +64 -18
  67. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +2 -2
  68. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
  69. package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +1 -1
  70. package/lib/room-router/index.js +10 -7
  71. package/lib/room-router/type.d.ts +1 -1
  72. package/lib/schema.d.ts +24 -46
  73. package/lib/schema.js +1 -2
  74. package/lib/service/api.d.ts +5 -3
  75. package/lib/service/api.js +17 -12
  76. package/lib/type.d.ts +64 -45
  77. package/lib/type.js +76 -11
  78. package/lib/utilities/abortable-retry.d.ts +38 -0
  79. package/lib/utilities/abortable-retry.js +61 -0
  80. package/lib/utilities/dual-video-stream-config.d.ts +6 -0
  81. package/lib/utilities/dual-video-stream-config.js +25 -0
  82. package/lib/utilities/error-helpers.d.ts +10 -9
  83. package/lib/utilities/error-helpers.js +12 -11
  84. package/lib/utilities/error.d.ts +4 -40
  85. package/lib/utilities/error.js +20 -77
  86. package/lib/utilities/join-helper.js +2 -2
  87. package/lib/utilities/logger.d.ts +2 -2
  88. package/lib/utilities/logger.js +6 -25
  89. package/lib/utilities/package-info.d.ts +1 -2
  90. package/lib/utilities/package-info.js +4 -8
  91. package/lib/utilities/parameters.js +88 -15
  92. package/lib/utilities/validate-params.js +1 -1
  93. package/lib/utilities/video-encoder-config.d.ts +9 -0
  94. package/lib/utilities/video-encoder-config.js +109 -0
  95. package/lib-es/base-session.js +1 -0
  96. package/lib-es/chat-connector/type.js +6 -0
  97. package/lib-es/engine/index.js +412 -0
  98. package/lib-es/engine/type.js +1 -0
  99. package/lib-es/imports.js +59 -0
  100. package/lib-es/index.js +8 -0
  101. package/lib-es/media-control/desktop.js +172 -0
  102. package/lib-es/media-control/mobile.js +198 -0
  103. package/lib-es/media-control/type.js +6 -0
  104. package/lib-es/monitor-control/index.js +46 -0
  105. package/lib-es/monitor-control/type.js +1 -0
  106. package/lib-es/peer-session/index.js +279 -0
  107. package/lib-es/peer-session/type.js +1 -0
  108. package/lib-es/plugins/chat/chatroom.js +409 -0
  109. package/{lib/chat-connection → lib-es/plugins/chat}/config.js +5 -9
  110. package/lib-es/plugins/chat/connector.js +269 -0
  111. package/lib-es/plugins/electron-rtc-plugin.js +1 -0
  112. package/lib-es/plugins/rtm-plugin.js +1 -0
  113. package/lib-es/plugins/web-rtc-plugin.js +1 -0
  114. package/lib-es/room-control/ability-control/index.js +58 -0
  115. package/lib-es/room-control/ability-control/type.js +15 -0
  116. package/lib-es/room-control/chatroom-control/type.js +12 -0
  117. package/lib-es/room-control/group-control/index.js +256 -0
  118. package/lib-es/room-control/helpers/constants.js +92 -0
  119. package/lib-es/room-control/helpers/index.js +20 -0
  120. package/lib-es/room-control/helpers/validation-helper.js +46 -0
  121. package/lib-es/room-control/index.js +623 -0
  122. package/lib-es/room-control/interpreter-control/index.js +172 -0
  123. package/lib-es/room-control/interpreter-control/room.js +28 -0
  124. package/lib-es/room-control/interpreter-control/types.js +26 -0
  125. package/lib-es/room-control/join-before-host-waitingroom-control/index.js +29 -0
  126. package/lib-es/room-control/mainroom-control/index.js +248 -0
  127. package/lib-es/room-control/privilege-control/helper.js +97 -0
  128. package/lib-es/room-control/privilege-control/index.js +339 -0
  129. package/lib-es/room-control/privilege-control/type.js +159 -0
  130. package/lib-es/room-control/room-connector-control/index.js +182 -0
  131. package/lib-es/room-control/room-connector-control/type.js +28 -0
  132. package/lib-es/room-control/room-control-factory.js +77 -0
  133. package/lib-es/room-control/room-session/index.js +292 -0
  134. package/lib-es/room-control/room-session/type.js +1 -0
  135. package/lib-es/room-control/shared-cache.js +47 -0
  136. package/lib-es/room-control/sharing-control/index.js +307 -0
  137. package/lib-es/room-control/sharing-control/type.js +16 -0
  138. package/lib-es/room-control/stream-control/index.js +536 -0
  139. package/lib-es/room-control/stream-control/type.js +1 -0
  140. package/lib-es/room-control/stt-control/de-compress-gzip.js +33 -0
  141. package/lib-es/room-control/stt-control/index.js +350 -0
  142. package/lib-es/room-control/stt-control/type.js +10 -0
  143. package/lib-es/room-control/type.js +30 -0
  144. package/lib-es/room-control/user-control/index.js +344 -0
  145. package/lib-es/room-control/user-control/type.js +21 -0
  146. package/lib-es/room-control/waitingroom-control/index.js +68 -0
  147. package/lib-es/room-control/whiteboard-control/enum.js +18 -0
  148. package/lib-es/room-control/whiteboard-control/type.js +10 -0
  149. package/lib-es/room-control/whiteboard-control/utils.js +13 -0
  150. package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +18 -0
  151. package/lib-es/room-control/whiteboard-control-v1/board-window.js +573 -0
  152. package/lib-es/room-control/whiteboard-control-v1/enum.js +157 -0
  153. package/lib-es/room-control/whiteboard-control-v1/factory.js +12 -0
  154. package/lib-es/room-control/whiteboard-control-v1/index.js +427 -0
  155. package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +6 -0
  156. package/lib-es/room-control/whiteboard-control-v1/type.js +8 -0
  157. package/lib-es/room-control/whiteboard-control-v1/utils.js +273 -0
  158. package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +76 -0
  159. package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +37 -0
  160. package/lib-es/room-control/whiteboard-control-v2/annotation-control/type.js +1 -0
  161. package/lib-es/room-control/whiteboard-control-v2/base/index.js +347 -0
  162. package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +269 -0
  163. package/lib-es/room-control/whiteboard-control-v2/constant.js +9 -0
  164. package/lib-es/room-control/whiteboard-control-v2/enum.js +28 -0
  165. package/lib-es/room-control/whiteboard-control-v2/type.js +1 -0
  166. package/lib-es/room-control/whiteboard-control-v2/utils.js +92 -0
  167. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +204 -0
  168. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +61 -0
  169. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/type.js +1 -0
  170. package/lib-es/room-router/index.js +263 -0
  171. package/lib-es/room-router/type.js +5 -0
  172. package/lib-es/schema.js +231 -0
  173. package/lib-es/service/api.js +1211 -0
  174. package/lib-es/service/type.js +1 -0
  175. package/lib-es/type.js +222 -0
  176. package/lib-es/utilities/abortable-retry.js +54 -0
  177. package/lib-es/utilities/cmd.js +1 -0
  178. package/lib-es/utilities/collection.js +64 -0
  179. package/lib-es/utilities/dual-video-stream-config.js +19 -0
  180. package/lib-es/utilities/error-helpers.js +224 -0
  181. package/lib-es/utilities/error.js +43 -0
  182. package/lib-es/utilities/join-helper.js +219 -0
  183. package/lib-es/utilities/logger.js +7 -0
  184. package/lib-es/utilities/package-info.js +5 -0
  185. package/lib-es/utilities/parameters.js +106 -0
  186. package/lib-es/utilities/retry-helpers.js +66 -0
  187. package/lib-es/utilities/shared-storage.js +31 -0
  188. package/lib-es/utilities/stream.js +18 -0
  189. package/lib-es/utilities/user.js +30 -0
  190. package/lib-es/utilities/validate-params.js +8 -0
  191. package/lib-es/utilities/video-encoder-config.js +103 -0
  192. package/package.json +11 -10
  193. package/lib/chat-connection/index.d.ts +0 -24
  194. package/lib/chat-connection/type.d.ts +0 -17
  195. package/lib/plugins/chatroom.js +0 -454
  196. package/lib/room-control/chatroom-control/config.d.ts +0 -51
  197. package/lib/utilities/storage.d.ts +0 -8
  198. package/lib/utilities/storage.js +0 -33
  199. /package/lib/plugins/{chatroom.d.ts → chat/chatroom.d.ts} +0 -0
@@ -0,0 +1,1211 @@
1
+ import "core-js/modules/esnext.iterator.constructor.js";
2
+ import "core-js/modules/esnext.iterator.map.js";
3
+ import { toLower } from '../imports';
4
+ import { FcrPrivilegeUserRoleToStringMap } from '../room-control/privilege-control/type';
5
+ import { FcrUserKickedOutType } from '../room-control/user-control/type';
6
+ import { getLogger } from '../utilities/logger';
7
+ export class FcrCoreServiceApi {
8
+ logger = getLogger();
9
+ constructor(_client, appId, region, pathIncludeRegion = true) {
10
+ this._client = _client;
11
+ let pathPrefix = `/conference/apps/${appId}`;
12
+ if (pathIncludeRegion) {
13
+ pathPrefix = `/${toLower(region)}${pathPrefix}`;
14
+ }
15
+ this.logger.info('set path prefix for Core Service API:', pathPrefix);
16
+ this._pathPrefix = pathPrefix;
17
+ this._client.setPathPrefix(pathPrefix);
18
+ }
19
+ setRestfulClient(client) {
20
+ this._client = client;
21
+ this._client.setPathPrefix(this._pathPrefix);
22
+ }
23
+ async addGroups(params, opts) {
24
+ const {
25
+ data
26
+ } = await this._client.fetch({
27
+ path: `/v2/rooms/${opts.roomId}/groups`,
28
+ method: 'PUT',
29
+ data: {
30
+ groups: params.map(group => {
31
+ return {
32
+ groupName: group.groupName,
33
+ users: group.userList,
34
+ createGroupRequest: opts.startTime ? {
35
+ roomProperties: {
36
+ schedule: {
37
+ startTime: opts.startTime
38
+ }
39
+ }
40
+ } : undefined
41
+ };
42
+ })
43
+ }
44
+ });
45
+ }
46
+ async updateGroups(params, opts) {
47
+ const {
48
+ data
49
+ } = await this._client.fetch({
50
+ path: `/v2/rooms/${opts.roomId}/groups/info`,
51
+ method: 'PATCH',
52
+ data: {
53
+ groups: params.map(group => {
54
+ return {
55
+ groupUuid: group.groupId,
56
+ groupName: group.groupName
57
+ };
58
+ })
59
+ }
60
+ });
61
+ }
62
+ async deleteGroups(groupIds, opts) {
63
+ const {
64
+ data
65
+ } = await this._client.fetch({
66
+ path: `/v2/rooms/${opts.roomId}/groups/states/1`,
67
+ method: 'DELETE',
68
+ data: {
69
+ removeGroupUuids: groupIds
70
+ }
71
+ });
72
+ }
73
+ async deleteAllGroups(opts) {
74
+ const {
75
+ data
76
+ } = await this._client.fetch({
77
+ path: `/v2/rooms/${opts.roomId}/groups/all`,
78
+ method: 'DELETE'
79
+ });
80
+ }
81
+ async addUsers(userList, groupId, opts) {
82
+ const {
83
+ data
84
+ } = await this._client.fetch({
85
+ path: `/v2/rooms/${opts.roomId}/groups/users`,
86
+ method: 'PATCH',
87
+ data: {
88
+ groups: [{
89
+ groupUuid: groupId,
90
+ addUsers: userList
91
+ }],
92
+ inProgress: opts.inProgress
93
+ }
94
+ });
95
+ }
96
+ async removeUsers(userList, groupId, opts) {
97
+ const {
98
+ data
99
+ } = await this._client.fetch({
100
+ path: `/v2/rooms/${opts.roomId}/groups/users`,
101
+ method: 'PATCH',
102
+ data: {
103
+ groups: [{
104
+ groupUuid: groupId,
105
+ removeUsers: userList
106
+ }],
107
+ inProgress: opts.inProgress
108
+ }
109
+ });
110
+ }
111
+ async moveUsers(userList, fromGroupId, toGroupId, opts) {
112
+ const {
113
+ data
114
+ } = await this._client.fetch({
115
+ path: `/v2/rooms/${opts.roomId}/groups/users`,
116
+ method: 'PATCH',
117
+ data: {
118
+ groups: [{
119
+ groupUuid: toGroupId,
120
+ addUsers: userList
121
+ }],
122
+ inProgress: opts.inProgress
123
+ }
124
+ });
125
+ }
126
+ /*** merge audio ****/
127
+ async mergeAudioStream(userId, opts) {
128
+ const res = await this._client.fetch({
129
+ path: `/v1/rooms/${opts.roomId}/users/${userId}/call/merge`,
130
+ method: 'PUT',
131
+ data: {}
132
+ });
133
+ return res.data;
134
+ }
135
+ /*** split audio ****/
136
+ async splitAudioStream(userId, opts) {
137
+ const res = await this._client.fetch({
138
+ path: `/v1/rooms/${opts.roomId}/users/${userId}/call/split`,
139
+ method: 'PUT',
140
+ data: {}
141
+ });
142
+ return res.data;
143
+ }
144
+ /*** user control****/
145
+ async kickOut(userId, type, opts) {
146
+ const body = {};
147
+ if (type === FcrUserKickedOutType.Forever) {
148
+ body.duration = -1;
149
+ }
150
+ return this._client.fetch({
151
+ path: `/v1/rooms/${opts.roomId}/users/${userId}/ban/${type === FcrUserKickedOutType.Forever ? 1 : 0}`,
152
+ method: 'PUT',
153
+ data: body
154
+ });
155
+ }
156
+ async kickOutByUserRoles(type, opts, userRoles) {
157
+ const body = {
158
+ toRoles: userRoles
159
+ };
160
+ if (type === FcrUserKickedOutType.Forever) {
161
+ body.duration = -1;
162
+ }
163
+ const {
164
+ data
165
+ } = await this._client.fetch({
166
+ path: `/v1/rooms/${opts.roomId}/users/ban/${type === FcrUserKickedOutType.Forever ? 1 : 0}`,
167
+ method: 'PUT',
168
+ data: body
169
+ });
170
+ }
171
+ async kickOutByUserIds(userId, type, opts) {
172
+ const body = {
173
+ toUserUuids: userId
174
+ };
175
+ if (type === FcrUserKickedOutType.Forever) {
176
+ body.duration = -1;
177
+ }
178
+ const {
179
+ data
180
+ } = await this._client.fetch({
181
+ path: `/v1/rooms/${opts.roomId}/users/ban/${type === FcrUserKickedOutType.Forever ? 1 : 0}`,
182
+ method: 'PUT',
183
+ data: body
184
+ });
185
+ }
186
+
187
+ /** room control **/
188
+ async startRoom(roomId) {
189
+ return this._client.fetch({
190
+ path: `/v1/rooms/${roomId}/states/1`,
191
+ method: 'PUT'
192
+ });
193
+ }
194
+ async endRoom(roomId) {
195
+ return this._client.fetch({
196
+ path: `/v1/rooms/${roomId}/states/2`,
197
+ method: 'PUT'
198
+ });
199
+ }
200
+ async closeRoom(roomId) {
201
+ return this._client.fetch({
202
+ path: `/v1/rooms/${roomId}/states/3`,
203
+ method: 'PUT'
204
+ });
205
+ }
206
+ async startCloudRecording(config, roomId) {
207
+ return this._client.fetch({
208
+ path: `/v1/rooms/${roomId}/records/states/1`,
209
+ method: 'PUT',
210
+ data: {
211
+ mode: 'web',
212
+ webRecordConfig: {
213
+ // rootUrl: config.url,
214
+ // audioProfile: config.audioProfile,
215
+ // videoBitrate: config.videoEncoderConfig.bitrate,
216
+ // videoWidth: config.videoEncoderConfig.dimensions.width,
217
+ // videoHeight: config.videoEncoderConfig.dimensions.height,
218
+ // videoFps: config.videoEncoderConfig.frameRate,
219
+ }
220
+ }
221
+ });
222
+ }
223
+ async pauseCloudRecording(roomId) {
224
+ return this._client.fetch({
225
+ path: `/v1/rooms/${roomId}/records/states/1`,
226
+ method: 'PATCH',
227
+ data: {
228
+ mode: 'web',
229
+ webRecordConfig: {
230
+ onhold: true
231
+ }
232
+ }
233
+ });
234
+ }
235
+ async resumeCloudRecording(roomId) {
236
+ return this._client.fetch({
237
+ path: `/v1/rooms/${roomId}/records/states/1`,
238
+ method: 'PATCH',
239
+ data: {
240
+ webRecordConfig: {
241
+ onhold: false
242
+ }
243
+ }
244
+ });
245
+ }
246
+ async stopCloudRecording(roomId) {
247
+ return this._client.fetch({
248
+ path: `/v1/rooms/${roomId}/records/states/0`,
249
+ method: 'PUT'
250
+ });
251
+ }
252
+ async setCloudRecordingReady(roomId) {
253
+ return this._client.fetch({
254
+ path: `/v1/rooms/${roomId}/records/ready`,
255
+ method: 'PUT'
256
+ });
257
+ }
258
+ // async entryRoom(params: EntryRequestParams): Promise<AgoraRteEntryRoomResponse> {
259
+ // this._observable.notifyObservers('beforeJoinRoom');
260
+
261
+ // const resp = await this._client.fetch({
262
+ // path: `/v2/rooms/${params.roomId}/users/${params.userId}/entry`,
263
+ // method: 'POST',
264
+ // data: params,
265
+ // retryFallbackDomainsWhenFail: true,
266
+ // });
267
+ // const statusCode = resp['__status'];
268
+ // const { code } = resp;
269
+
270
+ // this._observable.notifyObservers('afterJoinRoom', statusCode, code);
271
+
272
+ // return resp.data;
273
+ // }
274
+ /** room session */
275
+ async updateRoomSession(params) {
276
+ return this._client.fetch({
277
+ path: `/v1/users/${params.userId}/sessions/${params.sessionKey}/${params.sessionId}`,
278
+ method: 'PUT',
279
+ data: {
280
+ target: 1,
281
+ targetUuids: [params.targetId],
282
+ targetRoles: params.targetRoles,
283
+ payload: params.payload,
284
+ duration: params.duration
285
+ }
286
+ });
287
+ }
288
+ async deleteRoomSession(params) {
289
+ return this._client.fetch({
290
+ path: `/v1/users/${params.userId}/sessions/${params.sessionKey}/${params.sessionId}`,
291
+ method: 'DELETE',
292
+ data: {
293
+ target: params.target,
294
+ targetUuids: params.receiverIds,
295
+ action: params.action,
296
+ payload: params.payload
297
+ }
298
+ });
299
+ }
300
+ /** peer session */
301
+ async updatePeerSession(params) {
302
+ return this._client.fetch({
303
+ path: `/v1/users/${params.userId}/sessions/${params.sessionKey}/${params.sessionId}`,
304
+ method: 'PUT',
305
+ data: {
306
+ target: 2,
307
+ targetUuids: [params.targetId],
308
+ payload: params.payload,
309
+ duration: params.duration
310
+ }
311
+ });
312
+ }
313
+ async deletePeerSession(params) {
314
+ return this._client.fetch({
315
+ path: `/v1/users/${params.userId}/sessions/${params.sessionKey}/${params.sessionId}`,
316
+ method: 'DELETE',
317
+ data: {
318
+ target: 2,
319
+ targetUuids: params.receiverIds,
320
+ action: params.action,
321
+ payload: params.payload
322
+ }
323
+ });
324
+ }
325
+ async checkIn(params) {
326
+ const {
327
+ data,
328
+ ts
329
+ } = await this._client.fetch({
330
+ path: `/v1/rooms/${params.roomId}/users/${params.userId}/entry`,
331
+ method: 'PUT',
332
+ data: {
333
+ password: params.password,
334
+ stream: params.stream,
335
+ streams: params.streams,
336
+ platform: params.platform,
337
+ role: params.userRole,
338
+ userName: params.userName,
339
+ userProperties: params.userProperties,
340
+ version: params.version,
341
+ bypass: params.bypass,
342
+ avatar: params.avatar
343
+ },
344
+ retryFallbackDomainsWhenFail: true,
345
+ maxRetryTimes: 10
346
+ });
347
+ return {
348
+ data,
349
+ ts
350
+ };
351
+ }
352
+ async checkInInternal(params) {
353
+ const {
354
+ data,
355
+ ts
356
+ } = await this._client.fetch({
357
+ path: `/v1/rooms/${params.roomId}/users/${params.userId}/internal/entry`,
358
+ method: 'PUT',
359
+ data: {
360
+ password: params.password,
361
+ stream: params.stream,
362
+ streams: params.streams,
363
+ platform: params.platform,
364
+ role: params.userRole,
365
+ userName: params.userName,
366
+ userProperties: params.userProperties,
367
+ version: params.version,
368
+ ticket: params.ticket,
369
+ bypass: params.bypass
370
+ },
371
+ retryFallbackDomainsWhenFail: true,
372
+ maxRetryTimes: 10
373
+ });
374
+ return {
375
+ data,
376
+ ts
377
+ };
378
+ }
379
+ async updateUserName(params) {
380
+ const {
381
+ userName,
382
+ roomId,
383
+ userId
384
+ } = params;
385
+ const res = await this._client.fetch({
386
+ path: `/v1/rooms/${roomId}/users/${userId}/info`,
387
+ method: 'PATCH',
388
+ data: {
389
+ userName
390
+ }
391
+ });
392
+ return res.data;
393
+ }
394
+ async updateUserProperties({
395
+ roomId,
396
+ userUuid,
397
+ properties,
398
+ increments,
399
+ cause
400
+ }) {
401
+ const data = {
402
+ properties,
403
+ cause,
404
+ increments
405
+ };
406
+ const res = await this._client.fetch({
407
+ path: `/v1/rooms/${roomId}/users/${userUuid}/properties`,
408
+ method: 'PUT',
409
+ data: data
410
+ });
411
+ return res.data;
412
+ }
413
+ async deleteUserProperties({
414
+ roomId,
415
+ userUuid,
416
+ properties,
417
+ cause
418
+ }) {
419
+ const data = {
420
+ properties,
421
+ cause
422
+ };
423
+ const res = await this._client.fetch({
424
+ path: `/v1/rooms/${roomId}/users/${userUuid}/properties`,
425
+ method: 'DELETE',
426
+ data: data
427
+ });
428
+ return res.data;
429
+ }
430
+ async updateRoomProperties({
431
+ roomId,
432
+ properties,
433
+ increments,
434
+ cause
435
+ }) {
436
+ const data = {
437
+ properties,
438
+ cause,
439
+ increments
440
+ };
441
+ const res = await this._client.fetch({
442
+ path: `/v1/rooms/${roomId}/properties`,
443
+ method: 'PUT',
444
+ data: data
445
+ });
446
+ return res.data;
447
+ }
448
+ async deleteRoomProperties({
449
+ roomId,
450
+ properties,
451
+ cause
452
+ }) {
453
+ const data = {
454
+ properties,
455
+ cause
456
+ };
457
+ const res = await this._client.fetch({
458
+ path: `/v1/rooms/${roomId}/properties`,
459
+ method: 'DELETE',
460
+ data: data
461
+ });
462
+ return res.data;
463
+ }
464
+ async getChatRoomToken(roomId, userId) {
465
+ const res = await this._client.fetch({
466
+ path: `/v1/rooms/${roomId}/users/${userId}/widgets/easemobIM/token`,
467
+ method: 'GET'
468
+ });
469
+ return res.data;
470
+ }
471
+ async getUserToken(userId) {
472
+ const res = await this._client.fetch({
473
+ path: `/v1/users/${userId}/widgets/easemobIM/token`,
474
+ method: 'GET'
475
+ });
476
+ return res.data;
477
+ }
478
+ async enableLockedRoom({
479
+ roomId,
480
+ enable,
481
+ targetRoles
482
+ }) {
483
+ const res = await this._client.fetch({
484
+ path: `/v1/rooms/${roomId}/lock/${enable ? 1 : 0}`,
485
+ method: 'PUT',
486
+ data: {
487
+ targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role])
488
+ }
489
+ });
490
+ return res.data;
491
+ }
492
+ async enablePassword({
493
+ roomId,
494
+ enable,
495
+ password
496
+ }) {
497
+ const res = await this._client.fetch({
498
+ path: `/v1/rooms/${roomId}/password/${enable ? 1 : 0}`,
499
+ method: 'PUT',
500
+ data: {
501
+ password
502
+ }
503
+ });
504
+ return res.data;
505
+ }
506
+ async enableWaitingRoom({
507
+ roomId,
508
+ enable
509
+ }) {
510
+ const res = await this._client.fetch({
511
+ path: `/v1/rooms/${roomId}/waiting/${enable ? 1 : 0}`,
512
+ method: 'PUT'
513
+ });
514
+ return res.data;
515
+ }
516
+ async moveToWaitingRoomByUserIds(userIds, roomId) {
517
+ const res = await this._client.fetch({
518
+ path: `/v1/rooms/${roomId}/waiting/users`,
519
+ method: 'PUT',
520
+ data: {
521
+ toUserUuids: userIds
522
+ }
523
+ });
524
+ return res.data;
525
+ }
526
+ async moveToWaitingRoomByUserRoles(toRoles, roomId) {
527
+ const res = await this._client.fetch({
528
+ path: `/v1/rooms/${roomId}/waiting/users`,
529
+ method: 'PUT',
530
+ data: {
531
+ toRoles
532
+ }
533
+ });
534
+ return res.data;
535
+ }
536
+ async moveToMainRoomByUserIds(userIds, roomId) {
537
+ const res = await this._client.fetch({
538
+ path: `/v1/rooms/${roomId}/waiting/users`,
539
+ method: 'DELETE',
540
+ data: {
541
+ toUserUuids: userIds
542
+ }
543
+ });
544
+ return res.data;
545
+ }
546
+ async moveToMainRoomByUserRoles(toRoles, roomId) {
547
+ const res = await this._client.fetch({
548
+ path: `/v1/rooms/${roomId}/waiting/users`,
549
+ method: 'DELETE',
550
+ data: {
551
+ toRoles
552
+ }
553
+ });
554
+ return res.data;
555
+ }
556
+ async allowSendChat({
557
+ roomId,
558
+ enable,
559
+ targetRoles,
560
+ payload
561
+ }) {
562
+ const res = await this._client.fetch({
563
+ path: `/v1/rooms/${roomId}/security/chat/${enable ? 1 : 0}`,
564
+ method: 'PUT',
565
+ data: {
566
+ targetRoles,
567
+ payload: {
568
+ public: payload?.public === undefined ? undefined : payload.public ? 1 : 0,
569
+ private: payload?.private === undefined ? undefined : {
570
+ host: payload.private.host ? 1 : 0,
571
+ cohost: payload.private.cohost ? 1 : 0,
572
+ participant: payload.private.participant ? 1 : 0
573
+ }
574
+ }
575
+ }
576
+ });
577
+ return res.data;
578
+ }
579
+ async allowChangeName({
580
+ roomId,
581
+ enable,
582
+ targetRoles
583
+ }) {
584
+ const res = await this._client.fetch({
585
+ path: `/v1/rooms/${roomId}/security/changeName/${enable ? 1 : 0}`,
586
+ method: 'PUT',
587
+ data: {
588
+ targetRoles
589
+ }
590
+ });
591
+ return res.data;
592
+ }
593
+ async allowStartAudio({
594
+ roomId,
595
+ enable,
596
+ targetRoles
597
+ }) {
598
+ const res = await this._client.fetch({
599
+ path: `/v1/rooms/${roomId}/security/unmuteAudio/${enable ? 1 : 0}`,
600
+ method: 'PUT',
601
+ data: {
602
+ targetRoles
603
+ }
604
+ });
605
+ return res.data;
606
+ }
607
+ async allowWatermark(params) {
608
+ const {
609
+ roomId,
610
+ enable,
611
+ targetRoles,
612
+ payload
613
+ } = params;
614
+ const res = await this._client.fetch({
615
+ path: `/v1/rooms/${roomId}/security/watermark/${enable ? 1 : 0}`,
616
+ method: 'PUT',
617
+ data: {
618
+ targetRoles,
619
+ payload: {
620
+ ...payload
621
+ }
622
+ }
623
+ });
624
+ return res.data;
625
+ }
626
+ async allowChangeUserName(params) {
627
+ const {
628
+ roomId,
629
+ enable,
630
+ targetRoles
631
+ } = params;
632
+ const res = await this._client.fetch({
633
+ path: `/v1/rooms/${roomId}/security/changeName/${enable ? 1 : 0}`,
634
+ method: 'PUT',
635
+ data: {
636
+ targetRoles
637
+ }
638
+ });
639
+ return res.data;
640
+ }
641
+ async allowJoinWithPromptSound({
642
+ roomId,
643
+ enable,
644
+ targetRoles
645
+ }) {
646
+ const res = await this._client.fetch({
647
+ path: `/v1/rooms/${roomId}/security/joinWithPromptSound/${enable ? 1 : 0}`,
648
+ method: 'PUT',
649
+ data: {
650
+ targetRoles
651
+ }
652
+ });
653
+ return res.data;
654
+ }
655
+ async allowStartVideo({
656
+ roomId,
657
+ enable,
658
+ targetRoles
659
+ }) {
660
+ const res = await this._client.fetch({
661
+ path: `/v1/rooms/${roomId}/security/openVideo/${enable ? 1 : 0}`,
662
+ method: 'PUT',
663
+ data: {
664
+ targetRoles
665
+ }
666
+ });
667
+ return res.data;
668
+ }
669
+ async allowJoinWithMuteAudio({
670
+ roomId,
671
+ enable,
672
+ targetRoles
673
+ }) {
674
+ const res = await this._client.fetch({
675
+ path: `/v1/rooms/${roomId}/security/joinWithMuteAudio/${enable ? 1 : 0}`,
676
+ method: 'PUT',
677
+ data: {
678
+ targetRoles
679
+ }
680
+ });
681
+ return res.data;
682
+ }
683
+ async allowJoinWithMutedVideo({
684
+ roomId,
685
+ enable,
686
+ targetRoles
687
+ }) {
688
+ const res = await this._client.fetch({
689
+ path: `/v1/rooms/${roomId}/security/joinWithCloseVideo/${enable ? 1 : 0}`,
690
+ method: 'PUT',
691
+ data: {
692
+ targetRoles
693
+ }
694
+ });
695
+ return res.data;
696
+ }
697
+ async updateUserRole({
698
+ roomId,
699
+ localRole,
700
+ remoteRole,
701
+ userId
702
+ }) {
703
+ const res = await this._client.fetch({
704
+ path: `/v1/rooms/${roomId}/users/${userId}/role`,
705
+ method: 'PUT',
706
+ data: {
707
+ remoteRole,
708
+ localRole
709
+ }
710
+ });
711
+ return res.data;
712
+ }
713
+ async revokeUserRole({
714
+ roomId,
715
+ remoteRole
716
+ }) {
717
+ const res = await this._client.fetch({
718
+ path: `/v1/rooms/${roomId}/claim/host`,
719
+ method: 'POST',
720
+ data: {
721
+ remoteRole
722
+ }
723
+ });
724
+ return res.data;
725
+ }
726
+ async claimHost({
727
+ roomId,
728
+ userId,
729
+ hostKey
730
+ }) {
731
+ const res = await this._client.fetch({
732
+ path: `/v1/rooms/${roomId}/users/${userId}/claim/host`,
733
+ method: 'POST',
734
+ data: {
735
+ hostKey
736
+ }
737
+ });
738
+ return res.data;
739
+ }
740
+ async stopLiveStreaming(roomId) {
741
+ const res = await this._client.fetch({
742
+ path: `/v1/rooms/${roomId}/live/states/0`,
743
+ method: 'PUT'
744
+ });
745
+ return res;
746
+ }
747
+ async updateLiveStreamingLayout(roomId, layoutType) {
748
+ const res = await this._client.fetch({
749
+ path: `/v1/rooms/${roomId}/live/states/1`,
750
+ method: 'PATCH',
751
+ data: {
752
+ layoutType: layoutType
753
+ }
754
+ });
755
+ return res;
756
+ }
757
+ async startLiveStreaming(roomId, data) {
758
+ const res = await this._client.fetch({
759
+ path: `/v1/rooms/${roomId}/live/states/1`,
760
+ method: 'PUT',
761
+ data: {
762
+ streamUrl: data.pushStreamingUrl,
763
+ streamKey: data.pushStreamingKey,
764
+ pageUrl: data.pullStreamingUrl,
765
+ layoutType: data.layoutType
766
+ }
767
+ });
768
+ return res;
769
+ }
770
+ async callIp({
771
+ roomId,
772
+ callType,
773
+ ipAddress
774
+ }) {
775
+ const res = await this._client.fetch({
776
+ path: `/v1/rooms/${roomId}/call/${callType}`,
777
+ method: 'POST',
778
+ data: {
779
+ ipAddress
780
+ }
781
+ });
782
+ return res;
783
+ }
784
+ async callPstn({
785
+ roomId,
786
+ userName,
787
+ userId,
788
+ callNumber
789
+ }) {
790
+ const res = await this._client.fetch({
791
+ path: `/v1/rooms/${roomId}/call/pstn`,
792
+ method: 'POST',
793
+ data: {
794
+ callNumber,
795
+ userName,
796
+ userUuid: userId
797
+ }
798
+ });
799
+ return res;
800
+ }
801
+ async hangup({
802
+ roomId,
803
+ userId,
804
+ callId
805
+ }) {
806
+ const res = await this._client.fetch({
807
+ path: `/v1/rooms/${roomId}/users/${userId}/call/${callId}`,
808
+ method: 'DELETE'
809
+ });
810
+ return res;
811
+ }
812
+
813
+ /**
814
+ * @description 获取白板信息
815
+ */
816
+ async getWhiteboardToken({
817
+ roomId,
818
+ userId
819
+ }) {
820
+ return this._client.fetch({
821
+ path: `/v1/rooms/${roomId}/users/${userId}/widgets/netlessBoard/token`,
822
+ method: 'GET'
823
+ });
824
+ }
825
+
826
+ /**
827
+ * @description 获取批注token
828
+ */
829
+ async getAnnotationToken({
830
+ roomId,
831
+ userId
832
+ }) {
833
+ return this._client.fetch({
834
+ path: `/v1/rooms/${roomId}/users/${userId}/widgets/annotation/token`,
835
+ method: 'GET'
836
+ });
837
+ }
838
+
839
+ /**
840
+ * @description 开启/关闭屏幕共享标注权限
841
+ */
842
+ async toggleAnnotationActivityState(roomId, state) {
843
+ return this._client.fetch({
844
+ path: `/v1/rooms/${roomId}/widgets/annotation/states/${state}`,
845
+ method: 'PUT'
846
+ });
847
+ }
848
+
849
+ /**
850
+ * @description 开启/关闭屏幕共享标注权限
851
+ */
852
+ async syncScreenShareOwnerAnnotationOpenDone(roomId) {
853
+ return this._client.fetch({
854
+ path: `/v1/rooms/${roomId}/widgets/annotation/states/1`,
855
+ method: 'PUT',
856
+ retryFallbackDomainsWhenFail: true
857
+ });
858
+ }
859
+
860
+ /**
861
+ * @description 启用/禁用屏幕共享&白板
862
+ */
863
+ async toggleShareEnable(params) {
864
+ const {
865
+ roomId,
866
+ enable,
867
+ targetRoles,
868
+ payload
869
+ } = params;
870
+ return this._client.fetch({
871
+ path: `/v1/rooms/${roomId}/security/sharing/${enable ? 1 : 0}`,
872
+ method: 'PUT',
873
+ data: {
874
+ targetRoles,
875
+ payload: {
876
+ ...payload
877
+ }
878
+ }
879
+ });
880
+ }
881
+
882
+ /**
883
+ * @description 设置'启用/禁用屏幕共享&白板'的用户列表
884
+ */
885
+ async toggleShareEnableByUserIds(params) {
886
+ const {
887
+ roomId,
888
+ enable,
889
+ toUserUuids,
890
+ payload
891
+ } = params;
892
+ return this._client.fetch({
893
+ path: `/v1/rooms/${roomId}/security/sharing/users/${enable ? 1 : 0}`,
894
+ method: 'PUT',
895
+ data: {
896
+ toUserUuids,
897
+ payload: {
898
+ ...payload
899
+ }
900
+ }
901
+ });
902
+ }
903
+
904
+ /**
905
+ * @description 开启 / 关闭屏幕共享
906
+ */
907
+ async toggleScreenShare(params) {
908
+ const {
909
+ roomId,
910
+ userId,
911
+ enable,
912
+ data
913
+ } = params;
914
+ return this._client.fetch({
915
+ path: `/v1/rooms/${roomId}/users/${userId}/streams/screen/states/${enable ? 1 : 0}`,
916
+ method: 'PUT',
917
+ data
918
+ });
919
+ }
920
+
921
+ /**
922
+ * @description 准备 / 取消白板
923
+ */
924
+ async toggleWhiteboardPreloadState(roomId, state) {
925
+ return this._client.fetch({
926
+ path: `/v1/rooms/${roomId}/widgets/netlessBoard/preload/${state}`,
927
+ method: 'PUT'
928
+ });
929
+ }
930
+
931
+ /**
932
+ * @description 开 / 关白板
933
+ */
934
+ async toggleWhiteboardActivityState(roomId, state) {
935
+ return this._client.fetch({
936
+ path: `/v2/rooms/${roomId}/widgets/netlessBoard/states/${state}`,
937
+ method: 'PUT'
938
+ });
939
+ }
940
+
941
+ /**
942
+ * @description 启用/禁用屏幕共享&白板
943
+ */
944
+ async toggleAnnotation(params) {
945
+ const {
946
+ roomId,
947
+ enable,
948
+ payload,
949
+ targetRoles
950
+ } = params;
951
+ return this._client.fetch({
952
+ path: `/v1/rooms/${roomId}/security/annotation/${1}`,
953
+ method: 'PUT',
954
+ data: {
955
+ targetRoles,
956
+ payload: {
957
+ ...payload
958
+ }
959
+ }
960
+ });
961
+ }
962
+
963
+ /**
964
+ * @description 修改白板背景
965
+ */
966
+ async setBackgroundColor(params) {
967
+ const {
968
+ roomId,
969
+ backgroundColor
970
+ } = params;
971
+ return this._client.fetch({
972
+ path: `/v1/rooms/${roomId}/widgets/netlessBoard/info`,
973
+ method: 'PUT',
974
+ data: {
975
+ backgroundColor
976
+ }
977
+ });
978
+ }
979
+ async startShareScreen(params) {
980
+ const {
981
+ roomId,
982
+ userId,
983
+ config
984
+ } = params;
985
+ const res = this._client.fetch({
986
+ path: `/v1/rooms/${roomId}/users/${userId}/streams/screen/states/1`,
987
+ method: 'PUT',
988
+ data: config
989
+ });
990
+ return res;
991
+ }
992
+ async stopShareScreen(params) {
993
+ const {
994
+ roomId,
995
+ userId
996
+ } = params;
997
+ const res = this._client.fetch({
998
+ path: `/v1/rooms/${roomId}/users/${userId}/streams/screen/states/0`,
999
+ method: 'PUT'
1000
+ });
1001
+ return res;
1002
+ }
1003
+ async openInterpreter(params) {
1004
+ const {
1005
+ roomId,
1006
+ data
1007
+ } = params;
1008
+ const res = this._client.fetch({
1009
+ path: `/v1/rooms/${roomId}/interpreter/states/1`,
1010
+ method: 'PUT',
1011
+ data
1012
+ });
1013
+ return res;
1014
+ }
1015
+ async updateInterpreter(params) {
1016
+ return this.openInterpreter(params);
1017
+ }
1018
+ async closeInterpreter(params) {
1019
+ const {
1020
+ roomId
1021
+ } = params;
1022
+ const res = this._client.fetch({
1023
+ path: `/v1/rooms/${roomId}/interpreter/states/0`,
1024
+ method: 'PUT',
1025
+ data: {}
1026
+ });
1027
+ return res;
1028
+ }
1029
+ async createStreamBatch(roomUuid, streams) {
1030
+ return await this._client.fetch({
1031
+ path: `/v1/rooms/${roomUuid}/streams`,
1032
+ method: 'POST',
1033
+ data: {
1034
+ streams
1035
+ }
1036
+ });
1037
+ }
1038
+ async updateStreamBatch(roomUuid, streams) {
1039
+ return await this._client.fetch({
1040
+ path: `/v1/rooms/${roomUuid}/streams`,
1041
+ method: 'PUT',
1042
+ data: {
1043
+ streams
1044
+ }
1045
+ });
1046
+ }
1047
+ async updateStreamBatchByCondition({
1048
+ roomUuid,
1049
+ videoState,
1050
+ audioState,
1051
+ includeRoles,
1052
+ excludeRoles,
1053
+ condition
1054
+ }) {
1055
+ return await this._client.fetch({
1056
+ path: `/v1/rooms/${roomUuid}/conditions/streams`,
1057
+ method: 'PUT',
1058
+ data: {
1059
+ includeRoles,
1060
+ excludeRoles,
1061
+ stream: {
1062
+ videoState,
1063
+ audioState
1064
+ },
1065
+ condition
1066
+ }
1067
+ });
1068
+ }
1069
+ async deleteStreamBatch(roomUuid, streams) {
1070
+ return await this._client.fetch({
1071
+ path: `/v1/rooms/${roomUuid}/streams`,
1072
+ method: 'DELETE',
1073
+ data: {
1074
+ streams
1075
+ }
1076
+ });
1077
+ }
1078
+ async startCaption(params) {
1079
+ const {
1080
+ roomUuid,
1081
+ userUuid,
1082
+ config
1083
+ } = params;
1084
+ return await this._client.fetch({
1085
+ path: `/v1/rooms/${roomUuid}/users/${userUuid}/widgets/stt/caption/states/1`,
1086
+ method: 'PUT',
1087
+ data: {
1088
+ source: config.sourceLanguage,
1089
+ target: config.targetLanguage ? [config.targetLanguage] : undefined
1090
+ }
1091
+ });
1092
+ }
1093
+ async stopCaption(params) {
1094
+ const {
1095
+ roomUuid,
1096
+ userUuid
1097
+ } = params;
1098
+ return await this._client.fetch({
1099
+ path: `/v1/rooms/${roomUuid}/users/${userUuid}/widgets/stt/caption/states/0`,
1100
+ method: 'PUT'
1101
+ });
1102
+ }
1103
+ async startTranscribing(params) {
1104
+ const {
1105
+ roomUuid,
1106
+ userUuid,
1107
+ config
1108
+ } = params;
1109
+ return await this._client.fetch({
1110
+ path: `/v1/rooms/${roomUuid}/users/${userUuid}/widgets/stt/transcribe/states/1`,
1111
+ method: 'PUT',
1112
+ data: {
1113
+ source: config.sourceLanguage,
1114
+ target: config.targetLanguage ? [config.targetLanguage] : undefined
1115
+ }
1116
+ });
1117
+ }
1118
+ async stopTranscribing(params) {
1119
+ const {
1120
+ roomUuid,
1121
+ userUuid
1122
+ } = params;
1123
+ return await this._client.fetch({
1124
+ path: `/v1/rooms/${roomUuid}/users/${userUuid}/widgets/stt/transcribe/states/0`,
1125
+ method: 'PUT'
1126
+ });
1127
+ }
1128
+ async updateSourceLanguage(params) {
1129
+ const {
1130
+ roomUuid,
1131
+ userUuid,
1132
+ language
1133
+ } = params;
1134
+ return await this._client.fetch({
1135
+ path: `/v1/rooms/${roomUuid}/users/${userUuid}/widgets/stt/language/speech`,
1136
+ method: 'PATCH',
1137
+ data: {
1138
+ source: language
1139
+ }
1140
+ });
1141
+ }
1142
+ async subscribeTranscribingLanguage(params) {
1143
+ const {
1144
+ roomUuid,
1145
+ userUuid,
1146
+ language
1147
+ } = params;
1148
+ return await this._client.fetch({
1149
+ path: `/v1/rooms/${roomUuid}/users/${userUuid}/widgets/stt/language/subscribe/1`,
1150
+ method: 'PATCH',
1151
+ data: {
1152
+ target: [language]
1153
+ }
1154
+ });
1155
+ }
1156
+ async unsubscribeTranscribingLanguage(params) {
1157
+ const {
1158
+ roomUuid,
1159
+ userUuid
1160
+ } = params;
1161
+ return await this._client.fetch({
1162
+ path: `/v1/rooms/${roomUuid}/users/${userUuid}/widgets/stt/language/subscribe/0`,
1163
+ method: 'PATCH'
1164
+ });
1165
+ }
1166
+ async allowStartCaption(params) {
1167
+ const {
1168
+ roomUuid,
1169
+ enable,
1170
+ targetRoles
1171
+ } = params;
1172
+ return await this._client.fetch({
1173
+ path: `/v1/rooms/${roomUuid}/security/caption/${enable ? 1 : 0}`,
1174
+ method: 'PUT',
1175
+ data: {
1176
+ targetRoles
1177
+ }
1178
+ });
1179
+ }
1180
+ async allowStartTranscribing(params) {
1181
+ const {
1182
+ roomUuid,
1183
+ enable,
1184
+ targetRoles
1185
+ } = params;
1186
+ return await this._client.fetch({
1187
+ path: `/v1/rooms/${roomUuid}/security/transcribe/${enable ? 1 : 0}`,
1188
+ method: 'PUT',
1189
+ data: {
1190
+ targetRoles
1191
+ }
1192
+ });
1193
+ }
1194
+ async allowUpdateSttSourceLanguage(params) {
1195
+ const {
1196
+ roomUuid,
1197
+ enable,
1198
+ targetRoles
1199
+ } = params;
1200
+ return await this._client.fetch({
1201
+ path: `/v1/rooms/${roomUuid}/security/stt/${enable ? 1 : 0}`,
1202
+ method: 'PUT',
1203
+ data: {
1204
+ targetRoles,
1205
+ payload: {
1206
+ modify: enable ? 1 : 0
1207
+ }
1208
+ }
1209
+ });
1210
+ }
1211
+ }