@stream-io/node-sdk 0.3.1 → 0.4.1

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 (69) hide show
  1. package/dist/index.cjs.js +4136 -9282
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +2 -3
  4. package/dist/index.es.js +4136 -9206
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/src/BaseApi.d.ts +10 -0
  7. package/dist/src/StreamCall.d.ts +5 -37
  8. package/dist/src/StreamChannel.d.ts +7 -34
  9. package/dist/src/StreamChatClient.d.ts +2 -25
  10. package/dist/src/StreamClient.d.ts +51 -59
  11. package/dist/src/StreamModerationClient.d.ts +3 -0
  12. package/dist/src/StreamVideoClient.d.ts +2 -18
  13. package/dist/src/gen/chat/ChannelApi.d.ts +33 -0
  14. package/dist/src/gen/chat/ChatApi.d.ts +241 -0
  15. package/dist/src/gen/common/CommonApi.d.ts +99 -0
  16. package/dist/src/gen/model-decoders/index.d.ts +3 -0
  17. package/dist/src/gen/models/index.d.ts +3881 -0
  18. package/dist/src/gen/moderation/ModerationApi.d.ts +38 -0
  19. package/dist/src/gen/video/CallApi.d.ts +56 -0
  20. package/dist/src/gen/video/VideoApi.d.ts +151 -0
  21. package/dist/src/types.d.ts +25 -0
  22. package/dist/src/utils/create-token.d.ts +2 -0
  23. package/dist/src/utils/rate-limit.d.ts +2 -0
  24. package/index.ts +2 -3
  25. package/package.json +5 -4
  26. package/src/BaseApi.ts +115 -0
  27. package/src/StreamCall.ts +9 -199
  28. package/src/StreamChannel.ts +23 -246
  29. package/src/StreamChatClient.ts +3 -122
  30. package/src/StreamClient.ts +101 -345
  31. package/src/StreamModerationClient.ts +3 -0
  32. package/src/StreamVideoClient.ts +3 -95
  33. package/src/gen/chat/ChannelApi.ts +270 -0
  34. package/src/gen/chat/ChatApi.ts +1857 -0
  35. package/src/gen/common/CommonApi.ts +1004 -0
  36. package/src/gen/model-decoders/index.ts +1897 -0
  37. package/src/gen/models/index.ts +6794 -0
  38. package/src/gen/moderation/ModerationApi.ts +476 -0
  39. package/src/gen/video/CallApi.ts +309 -0
  40. package/src/gen/video/VideoApi.ts +1007 -0
  41. package/src/types.ts +35 -0
  42. package/src/utils/create-token.ts +6 -1
  43. package/src/utils/rate-limit.ts +21 -0
  44. package/dist/src/gen/chat/apis/ProductchatApi.d.ts +0 -1750
  45. package/dist/src/gen/chat/apis/index.d.ts +0 -1
  46. package/dist/src/gen/chat/index.d.ts +0 -3
  47. package/dist/src/gen/chat/models/index.d.ts +0 -14865
  48. package/dist/src/gen/chat/runtime.d.ts +0 -180
  49. package/dist/src/gen/video/apis/ProductvideoApi.d.ts +0 -648
  50. package/dist/src/gen/video/apis/index.d.ts +0 -1
  51. package/dist/src/gen/video/index.d.ts +0 -3
  52. package/dist/src/gen/video/models/index.d.ts +0 -5011
  53. package/dist/src/gen/video/runtime.d.ts +0 -180
  54. package/src/gen/chat/.openapi-generator/FILES +0 -6
  55. package/src/gen/chat/.openapi-generator/VERSION +0 -1
  56. package/src/gen/chat/.openapi-generator-ignore +0 -23
  57. package/src/gen/chat/apis/ProductchatApi.ts +0 -7007
  58. package/src/gen/chat/apis/index.ts +0 -3
  59. package/src/gen/chat/index.ts +0 -5
  60. package/src/gen/chat/models/index.ts +0 -14766
  61. package/src/gen/chat/runtime.ts +0 -415
  62. package/src/gen/video/.openapi-generator/FILES +0 -6
  63. package/src/gen/video/.openapi-generator/VERSION +0 -1
  64. package/src/gen/video/.openapi-generator-ignore +0 -23
  65. package/src/gen/video/apis/ProductvideoApi.ts +0 -2575
  66. package/src/gen/video/apis/index.ts +0 -3
  67. package/src/gen/video/index.ts +0 -5
  68. package/src/gen/video/models/index.ts +0 -5000
  69. package/src/gen/video/runtime.ts +0 -415
@@ -0,0 +1,1007 @@
1
+ import { BaseApi } from '../../BaseApi';
2
+ import { StreamResponse } from '../../types';
3
+ import {
4
+ BlockUserRequest,
5
+ BlockUserResponse,
6
+ CollectUserFeedbackRequest,
7
+ CollectUserFeedbackResponse,
8
+ CreateCallTypeRequest,
9
+ CreateCallTypeResponse,
10
+ DeleteCallRequest,
11
+ DeleteCallResponse,
12
+ DeleteRecordingResponse,
13
+ DeleteTranscriptionResponse,
14
+ EndCallResponse,
15
+ GetCallResponse,
16
+ GetCallStatsResponse,
17
+ GetCallTypeResponse,
18
+ GetEdgesResponse,
19
+ GetOrCreateCallRequest,
20
+ GetOrCreateCallResponse,
21
+ GoLiveRequest,
22
+ GoLiveResponse,
23
+ ListCallTypeResponse,
24
+ ListRecordingsResponse,
25
+ ListTranscriptionsResponse,
26
+ MuteUsersRequest,
27
+ MuteUsersResponse,
28
+ PinRequest,
29
+ PinResponse,
30
+ QueryCallMembersRequest,
31
+ QueryCallMembersResponse,
32
+ QueryCallStatsRequest,
33
+ QueryCallStatsResponse,
34
+ QueryCallsRequest,
35
+ QueryCallsResponse,
36
+ Response,
37
+ SendCallEventRequest,
38
+ SendCallEventResponse,
39
+ StartHLSBroadcastingResponse,
40
+ StartRTMPBroadcastsRequest,
41
+ StartRTMPBroadcastsResponse,
42
+ StartRecordingRequest,
43
+ StartRecordingResponse,
44
+ StartTranscriptionRequest,
45
+ StartTranscriptionResponse,
46
+ StopAllRTMPBroadcastsResponse,
47
+ StopHLSBroadcastingResponse,
48
+ StopLiveResponse,
49
+ StopRTMPBroadcastsRequest,
50
+ StopRTMPBroadcastsResponse,
51
+ StopRecordingResponse,
52
+ StopTranscriptionResponse,
53
+ UnblockUserRequest,
54
+ UnblockUserResponse,
55
+ UnpinRequest,
56
+ UnpinResponse,
57
+ UpdateCallMembersRequest,
58
+ UpdateCallMembersResponse,
59
+ UpdateCallRequest,
60
+ UpdateCallResponse,
61
+ UpdateCallTypeRequest,
62
+ UpdateCallTypeResponse,
63
+ UpdateUserPermissionsRequest,
64
+ UpdateUserPermissionsResponse,
65
+ } from '../models';
66
+ import { decoders } from '../model-decoders';
67
+
68
+ export class VideoApi extends BaseApi {
69
+ queryCallMembers = async (
70
+ request: QueryCallMembersRequest,
71
+ ): Promise<StreamResponse<QueryCallMembersResponse>> => {
72
+ const body = {
73
+ id: request?.id,
74
+ type: request?.type,
75
+ limit: request?.limit,
76
+ next: request?.next,
77
+ prev: request?.prev,
78
+ sort: request?.sort,
79
+ filter_conditions: request?.filter_conditions,
80
+ };
81
+
82
+ const response = await this.sendRequest<
83
+ StreamResponse<QueryCallMembersResponse>
84
+ >('POST', '/api/v2/video/call/members', undefined, undefined, body);
85
+
86
+ decoders.QueryCallMembersResponse?.(response.body);
87
+
88
+ return { ...response.body, metadata: response.metadata };
89
+ };
90
+
91
+ queryCallStats = async (
92
+ request?: QueryCallStatsRequest,
93
+ ): Promise<StreamResponse<QueryCallStatsResponse>> => {
94
+ const body = {
95
+ limit: request?.limit,
96
+ next: request?.next,
97
+ prev: request?.prev,
98
+ sort: request?.sort,
99
+ filter_conditions: request?.filter_conditions,
100
+ };
101
+
102
+ const response = await this.sendRequest<
103
+ StreamResponse<QueryCallStatsResponse>
104
+ >('POST', '/api/v2/video/call/stats', undefined, undefined, body);
105
+
106
+ decoders.QueryCallStatsResponse?.(response.body);
107
+
108
+ return { ...response.body, metadata: response.metadata };
109
+ };
110
+
111
+ getCall = async (request: {
112
+ type: string;
113
+ id: string;
114
+ members_limit?: number;
115
+ ring?: boolean;
116
+ notify?: boolean;
117
+ video?: boolean;
118
+ }): Promise<StreamResponse<GetCallResponse>> => {
119
+ const queryParams = {
120
+ members_limit: request?.members_limit,
121
+ ring: request?.ring,
122
+ notify: request?.notify,
123
+ video: request?.video,
124
+ };
125
+ const pathParams = {
126
+ type: request?.type,
127
+ id: request?.id,
128
+ };
129
+
130
+ const response = await this.sendRequest<StreamResponse<GetCallResponse>>(
131
+ 'GET',
132
+ '/api/v2/video/call/{type}/{id}',
133
+ pathParams,
134
+ queryParams,
135
+ );
136
+
137
+ decoders.GetCallResponse?.(response.body);
138
+
139
+ return { ...response.body, metadata: response.metadata };
140
+ };
141
+
142
+ updateCall = async (
143
+ request: UpdateCallRequest & { type: string; id: string },
144
+ ): Promise<StreamResponse<UpdateCallResponse>> => {
145
+ const pathParams = {
146
+ type: request?.type,
147
+ id: request?.id,
148
+ };
149
+ const body = {
150
+ starts_at: request?.starts_at,
151
+ custom: request?.custom,
152
+ settings_override: request?.settings_override,
153
+ };
154
+
155
+ const response = await this.sendRequest<StreamResponse<UpdateCallResponse>>(
156
+ 'PATCH',
157
+ '/api/v2/video/call/{type}/{id}',
158
+ pathParams,
159
+ undefined,
160
+ body,
161
+ );
162
+
163
+ decoders.UpdateCallResponse?.(response.body);
164
+
165
+ return { ...response.body, metadata: response.metadata };
166
+ };
167
+
168
+ getOrCreateCall = async (
169
+ request: GetOrCreateCallRequest & { type: string; id: string },
170
+ ): Promise<StreamResponse<GetOrCreateCallResponse>> => {
171
+ const pathParams = {
172
+ type: request?.type,
173
+ id: request?.id,
174
+ };
175
+ const body = {
176
+ members_limit: request?.members_limit,
177
+ notify: request?.notify,
178
+ ring: request?.ring,
179
+ video: request?.video,
180
+ data: request?.data,
181
+ };
182
+
183
+ const response = await this.sendRequest<
184
+ StreamResponse<GetOrCreateCallResponse>
185
+ >('POST', '/api/v2/video/call/{type}/{id}', pathParams, undefined, body);
186
+
187
+ decoders.GetOrCreateCallResponse?.(response.body);
188
+
189
+ return { ...response.body, metadata: response.metadata };
190
+ };
191
+
192
+ blockUser = async (
193
+ request: BlockUserRequest & { type: string; id: string },
194
+ ): Promise<StreamResponse<BlockUserResponse>> => {
195
+ const pathParams = {
196
+ type: request?.type,
197
+ id: request?.id,
198
+ };
199
+ const body = {
200
+ user_id: request?.user_id,
201
+ };
202
+
203
+ const response = await this.sendRequest<StreamResponse<BlockUserResponse>>(
204
+ 'POST',
205
+ '/api/v2/video/call/{type}/{id}/block',
206
+ pathParams,
207
+ undefined,
208
+ body,
209
+ );
210
+
211
+ decoders.BlockUserResponse?.(response.body);
212
+
213
+ return { ...response.body, metadata: response.metadata };
214
+ };
215
+
216
+ deleteCall = async (
217
+ request: DeleteCallRequest & { type: string; id: string },
218
+ ): Promise<StreamResponse<DeleteCallResponse>> => {
219
+ const pathParams = {
220
+ type: request?.type,
221
+ id: request?.id,
222
+ };
223
+ const body = {
224
+ hard: request?.hard,
225
+ };
226
+
227
+ const response = await this.sendRequest<StreamResponse<DeleteCallResponse>>(
228
+ 'POST',
229
+ '/api/v2/video/call/{type}/{id}/delete',
230
+ pathParams,
231
+ undefined,
232
+ body,
233
+ );
234
+
235
+ decoders.DeleteCallResponse?.(response.body);
236
+
237
+ return { ...response.body, metadata: response.metadata };
238
+ };
239
+
240
+ sendCallEvent = async (
241
+ request: SendCallEventRequest & { type: string; id: string },
242
+ ): Promise<StreamResponse<SendCallEventResponse>> => {
243
+ const pathParams = {
244
+ type: request?.type,
245
+ id: request?.id,
246
+ };
247
+ const body = {
248
+ user_id: request?.user_id,
249
+ custom: request?.custom,
250
+ user: request?.user,
251
+ };
252
+
253
+ const response = await this.sendRequest<
254
+ StreamResponse<SendCallEventResponse>
255
+ >(
256
+ 'POST',
257
+ '/api/v2/video/call/{type}/{id}/event',
258
+ pathParams,
259
+ undefined,
260
+ body,
261
+ );
262
+
263
+ decoders.SendCallEventResponse?.(response.body);
264
+
265
+ return { ...response.body, metadata: response.metadata };
266
+ };
267
+
268
+ collectUserFeedback = async (
269
+ request: CollectUserFeedbackRequest & {
270
+ type: string;
271
+ id: string;
272
+ session: string;
273
+ },
274
+ ): Promise<StreamResponse<CollectUserFeedbackResponse>> => {
275
+ const pathParams = {
276
+ type: request?.type,
277
+ id: request?.id,
278
+ session: request?.session,
279
+ };
280
+ const body = {
281
+ rating: request?.rating,
282
+ sdk: request?.sdk,
283
+ sdk_version: request?.sdk_version,
284
+ user_session_id: request?.user_session_id,
285
+ reason: request?.reason,
286
+ custom: request?.custom,
287
+ };
288
+
289
+ const response = await this.sendRequest<
290
+ StreamResponse<CollectUserFeedbackResponse>
291
+ >(
292
+ 'POST',
293
+ '/api/v2/video/call/{type}/{id}/feedback/{session}',
294
+ pathParams,
295
+ undefined,
296
+ body,
297
+ );
298
+
299
+ decoders.CollectUserFeedbackResponse?.(response.body);
300
+
301
+ return { ...response.body, metadata: response.metadata };
302
+ };
303
+
304
+ goLive = async (
305
+ request: GoLiveRequest & { type: string; id: string },
306
+ ): Promise<StreamResponse<GoLiveResponse>> => {
307
+ const pathParams = {
308
+ type: request?.type,
309
+ id: request?.id,
310
+ };
311
+ const body = {
312
+ recording_storage_name: request?.recording_storage_name,
313
+ start_hls: request?.start_hls,
314
+ start_recording: request?.start_recording,
315
+ start_rtmp_broadcasts: request?.start_rtmp_broadcasts,
316
+ start_transcription: request?.start_transcription,
317
+ transcription_storage_name: request?.transcription_storage_name,
318
+ };
319
+
320
+ const response = await this.sendRequest<StreamResponse<GoLiveResponse>>(
321
+ 'POST',
322
+ '/api/v2/video/call/{type}/{id}/go_live',
323
+ pathParams,
324
+ undefined,
325
+ body,
326
+ );
327
+
328
+ decoders.GoLiveResponse?.(response.body);
329
+
330
+ return { ...response.body, metadata: response.metadata };
331
+ };
332
+
333
+ endCall = async (request: {
334
+ type: string;
335
+ id: string;
336
+ }): Promise<StreamResponse<EndCallResponse>> => {
337
+ const pathParams = {
338
+ type: request?.type,
339
+ id: request?.id,
340
+ };
341
+
342
+ const response = await this.sendRequest<StreamResponse<EndCallResponse>>(
343
+ 'POST',
344
+ '/api/v2/video/call/{type}/{id}/mark_ended',
345
+ pathParams,
346
+ undefined,
347
+ );
348
+
349
+ decoders.EndCallResponse?.(response.body);
350
+
351
+ return { ...response.body, metadata: response.metadata };
352
+ };
353
+
354
+ updateCallMembers = async (
355
+ request: UpdateCallMembersRequest & { type: string; id: string },
356
+ ): Promise<StreamResponse<UpdateCallMembersResponse>> => {
357
+ const pathParams = {
358
+ type: request?.type,
359
+ id: request?.id,
360
+ };
361
+ const body = {
362
+ remove_members: request?.remove_members,
363
+ update_members: request?.update_members,
364
+ };
365
+
366
+ const response = await this.sendRequest<
367
+ StreamResponse<UpdateCallMembersResponse>
368
+ >(
369
+ 'POST',
370
+ '/api/v2/video/call/{type}/{id}/members',
371
+ pathParams,
372
+ undefined,
373
+ body,
374
+ );
375
+
376
+ decoders.UpdateCallMembersResponse?.(response.body);
377
+
378
+ return { ...response.body, metadata: response.metadata };
379
+ };
380
+
381
+ muteUsers = async (
382
+ request: MuteUsersRequest & { type: string; id: string },
383
+ ): Promise<StreamResponse<MuteUsersResponse>> => {
384
+ const pathParams = {
385
+ type: request?.type,
386
+ id: request?.id,
387
+ };
388
+ const body = {
389
+ audio: request?.audio,
390
+ mute_all_users: request?.mute_all_users,
391
+ muted_by_id: request?.muted_by_id,
392
+ screenshare: request?.screenshare,
393
+ screenshare_audio: request?.screenshare_audio,
394
+ video: request?.video,
395
+ user_ids: request?.user_ids,
396
+ muted_by: request?.muted_by,
397
+ };
398
+
399
+ const response = await this.sendRequest<StreamResponse<MuteUsersResponse>>(
400
+ 'POST',
401
+ '/api/v2/video/call/{type}/{id}/mute_users',
402
+ pathParams,
403
+ undefined,
404
+ body,
405
+ );
406
+
407
+ decoders.MuteUsersResponse?.(response.body);
408
+
409
+ return { ...response.body, metadata: response.metadata };
410
+ };
411
+
412
+ videoPin = async (
413
+ request: PinRequest & { type: string; id: string },
414
+ ): Promise<StreamResponse<PinResponse>> => {
415
+ const pathParams = {
416
+ type: request?.type,
417
+ id: request?.id,
418
+ };
419
+ const body = {
420
+ session_id: request?.session_id,
421
+ user_id: request?.user_id,
422
+ };
423
+
424
+ const response = await this.sendRequest<StreamResponse<PinResponse>>(
425
+ 'POST',
426
+ '/api/v2/video/call/{type}/{id}/pin',
427
+ pathParams,
428
+ undefined,
429
+ body,
430
+ );
431
+
432
+ decoders.PinResponse?.(response.body);
433
+
434
+ return { ...response.body, metadata: response.metadata };
435
+ };
436
+
437
+ listRecordings = async (request: {
438
+ type: string;
439
+ id: string;
440
+ }): Promise<StreamResponse<ListRecordingsResponse>> => {
441
+ const pathParams = {
442
+ type: request?.type,
443
+ id: request?.id,
444
+ };
445
+
446
+ const response = await this.sendRequest<
447
+ StreamResponse<ListRecordingsResponse>
448
+ >(
449
+ 'GET',
450
+ '/api/v2/video/call/{type}/{id}/recordings',
451
+ pathParams,
452
+ undefined,
453
+ );
454
+
455
+ decoders.ListRecordingsResponse?.(response.body);
456
+
457
+ return { ...response.body, metadata: response.metadata };
458
+ };
459
+
460
+ startRTMPBroadcasts = async (
461
+ request: StartRTMPBroadcastsRequest & { type: string; id: string },
462
+ ): Promise<StreamResponse<StartRTMPBroadcastsResponse>> => {
463
+ const pathParams = {
464
+ type: request?.type,
465
+ id: request?.id,
466
+ };
467
+ const body = {
468
+ broadcasts: request?.broadcasts,
469
+ };
470
+
471
+ const response = await this.sendRequest<
472
+ StreamResponse<StartRTMPBroadcastsResponse>
473
+ >(
474
+ 'POST',
475
+ '/api/v2/video/call/{type}/{id}/rtmp_broadcasts',
476
+ pathParams,
477
+ undefined,
478
+ body,
479
+ );
480
+
481
+ decoders.StartRTMPBroadcastsResponse?.(response.body);
482
+
483
+ return { ...response.body, metadata: response.metadata };
484
+ };
485
+
486
+ stopAllRTMPBroadcasts = async (request: {
487
+ type: string;
488
+ id: string;
489
+ }): Promise<StreamResponse<StopAllRTMPBroadcastsResponse>> => {
490
+ const pathParams = {
491
+ type: request?.type,
492
+ id: request?.id,
493
+ };
494
+
495
+ const response = await this.sendRequest<
496
+ StreamResponse<StopAllRTMPBroadcastsResponse>
497
+ >(
498
+ 'POST',
499
+ '/api/v2/video/call/{type}/{id}/rtmp_broadcasts/stop',
500
+ pathParams,
501
+ undefined,
502
+ );
503
+
504
+ decoders.StopAllRTMPBroadcastsResponse?.(response.body);
505
+
506
+ return { ...response.body, metadata: response.metadata };
507
+ };
508
+
509
+ stopRTMPBroadcast = async (
510
+ request: StopRTMPBroadcastsRequest & {
511
+ type: string;
512
+ id: string;
513
+ name: string;
514
+ },
515
+ ): Promise<StreamResponse<StopRTMPBroadcastsResponse>> => {
516
+ const pathParams = {
517
+ type: request?.type,
518
+ id: request?.id,
519
+ name: request?.name,
520
+ };
521
+ const body = {};
522
+
523
+ const response = await this.sendRequest<
524
+ StreamResponse<StopRTMPBroadcastsResponse>
525
+ >(
526
+ 'POST',
527
+ '/api/v2/video/call/{type}/{id}/rtmp_broadcasts/{name}/stop',
528
+ pathParams,
529
+ undefined,
530
+ body,
531
+ );
532
+
533
+ decoders.StopRTMPBroadcastsResponse?.(response.body);
534
+
535
+ return { ...response.body, metadata: response.metadata };
536
+ };
537
+
538
+ startHLSBroadcasting = async (request: {
539
+ type: string;
540
+ id: string;
541
+ }): Promise<StreamResponse<StartHLSBroadcastingResponse>> => {
542
+ const pathParams = {
543
+ type: request?.type,
544
+ id: request?.id,
545
+ };
546
+
547
+ const response = await this.sendRequest<
548
+ StreamResponse<StartHLSBroadcastingResponse>
549
+ >(
550
+ 'POST',
551
+ '/api/v2/video/call/{type}/{id}/start_broadcasting',
552
+ pathParams,
553
+ undefined,
554
+ );
555
+
556
+ decoders.StartHLSBroadcastingResponse?.(response.body);
557
+
558
+ return { ...response.body, metadata: response.metadata };
559
+ };
560
+
561
+ startRecording = async (
562
+ request: StartRecordingRequest & { type: string; id: string },
563
+ ): Promise<StreamResponse<StartRecordingResponse>> => {
564
+ const pathParams = {
565
+ type: request?.type,
566
+ id: request?.id,
567
+ };
568
+ const body = {
569
+ recording_external_storage: request?.recording_external_storage,
570
+ };
571
+
572
+ const response = await this.sendRequest<
573
+ StreamResponse<StartRecordingResponse>
574
+ >(
575
+ 'POST',
576
+ '/api/v2/video/call/{type}/{id}/start_recording',
577
+ pathParams,
578
+ undefined,
579
+ body,
580
+ );
581
+
582
+ decoders.StartRecordingResponse?.(response.body);
583
+
584
+ return { ...response.body, metadata: response.metadata };
585
+ };
586
+
587
+ startTranscription = async (
588
+ request: StartTranscriptionRequest & { type: string; id: string },
589
+ ): Promise<StreamResponse<StartTranscriptionResponse>> => {
590
+ const pathParams = {
591
+ type: request?.type,
592
+ id: request?.id,
593
+ };
594
+ const body = {
595
+ transcription_external_storage: request?.transcription_external_storage,
596
+ };
597
+
598
+ const response = await this.sendRequest<
599
+ StreamResponse<StartTranscriptionResponse>
600
+ >(
601
+ 'POST',
602
+ '/api/v2/video/call/{type}/{id}/start_transcription',
603
+ pathParams,
604
+ undefined,
605
+ body,
606
+ );
607
+
608
+ decoders.StartTranscriptionResponse?.(response.body);
609
+
610
+ return { ...response.body, metadata: response.metadata };
611
+ };
612
+
613
+ getCallStats = async (request: {
614
+ type: string;
615
+ id: string;
616
+ session: string;
617
+ }): Promise<StreamResponse<GetCallStatsResponse>> => {
618
+ const pathParams = {
619
+ type: request?.type,
620
+ id: request?.id,
621
+ session: request?.session,
622
+ };
623
+
624
+ const response = await this.sendRequest<
625
+ StreamResponse<GetCallStatsResponse>
626
+ >(
627
+ 'GET',
628
+ '/api/v2/video/call/{type}/{id}/stats/{session}',
629
+ pathParams,
630
+ undefined,
631
+ );
632
+
633
+ decoders.GetCallStatsResponse?.(response.body);
634
+
635
+ return { ...response.body, metadata: response.metadata };
636
+ };
637
+
638
+ stopHLSBroadcasting = async (request: {
639
+ type: string;
640
+ id: string;
641
+ }): Promise<StreamResponse<StopHLSBroadcastingResponse>> => {
642
+ const pathParams = {
643
+ type: request?.type,
644
+ id: request?.id,
645
+ };
646
+
647
+ const response = await this.sendRequest<
648
+ StreamResponse<StopHLSBroadcastingResponse>
649
+ >(
650
+ 'POST',
651
+ '/api/v2/video/call/{type}/{id}/stop_broadcasting',
652
+ pathParams,
653
+ undefined,
654
+ );
655
+
656
+ decoders.StopHLSBroadcastingResponse?.(response.body);
657
+
658
+ return { ...response.body, metadata: response.metadata };
659
+ };
660
+
661
+ stopLive = async (request: {
662
+ type: string;
663
+ id: string;
664
+ }): Promise<StreamResponse<StopLiveResponse>> => {
665
+ const pathParams = {
666
+ type: request?.type,
667
+ id: request?.id,
668
+ };
669
+
670
+ const response = await this.sendRequest<StreamResponse<StopLiveResponse>>(
671
+ 'POST',
672
+ '/api/v2/video/call/{type}/{id}/stop_live',
673
+ pathParams,
674
+ undefined,
675
+ );
676
+
677
+ decoders.StopLiveResponse?.(response.body);
678
+
679
+ return { ...response.body, metadata: response.metadata };
680
+ };
681
+
682
+ stopRecording = async (request: {
683
+ type: string;
684
+ id: string;
685
+ }): Promise<StreamResponse<StopRecordingResponse>> => {
686
+ const pathParams = {
687
+ type: request?.type,
688
+ id: request?.id,
689
+ };
690
+
691
+ const response = await this.sendRequest<
692
+ StreamResponse<StopRecordingResponse>
693
+ >(
694
+ 'POST',
695
+ '/api/v2/video/call/{type}/{id}/stop_recording',
696
+ pathParams,
697
+ undefined,
698
+ );
699
+
700
+ decoders.StopRecordingResponse?.(response.body);
701
+
702
+ return { ...response.body, metadata: response.metadata };
703
+ };
704
+
705
+ stopTranscription = async (request: {
706
+ type: string;
707
+ id: string;
708
+ }): Promise<StreamResponse<StopTranscriptionResponse>> => {
709
+ const pathParams = {
710
+ type: request?.type,
711
+ id: request?.id,
712
+ };
713
+
714
+ const response = await this.sendRequest<
715
+ StreamResponse<StopTranscriptionResponse>
716
+ >(
717
+ 'POST',
718
+ '/api/v2/video/call/{type}/{id}/stop_transcription',
719
+ pathParams,
720
+ undefined,
721
+ );
722
+
723
+ decoders.StopTranscriptionResponse?.(response.body);
724
+
725
+ return { ...response.body, metadata: response.metadata };
726
+ };
727
+
728
+ listTranscriptions = async (request: {
729
+ type: string;
730
+ id: string;
731
+ }): Promise<StreamResponse<ListTranscriptionsResponse>> => {
732
+ const pathParams = {
733
+ type: request?.type,
734
+ id: request?.id,
735
+ };
736
+
737
+ const response = await this.sendRequest<
738
+ StreamResponse<ListTranscriptionsResponse>
739
+ >(
740
+ 'GET',
741
+ '/api/v2/video/call/{type}/{id}/transcriptions',
742
+ pathParams,
743
+ undefined,
744
+ );
745
+
746
+ decoders.ListTranscriptionsResponse?.(response.body);
747
+
748
+ return { ...response.body, metadata: response.metadata };
749
+ };
750
+
751
+ unblockUser = async (
752
+ request: UnblockUserRequest & { type: string; id: string },
753
+ ): Promise<StreamResponse<UnblockUserResponse>> => {
754
+ const pathParams = {
755
+ type: request?.type,
756
+ id: request?.id,
757
+ };
758
+ const body = {
759
+ user_id: request?.user_id,
760
+ };
761
+
762
+ const response = await this.sendRequest<
763
+ StreamResponse<UnblockUserResponse>
764
+ >(
765
+ 'POST',
766
+ '/api/v2/video/call/{type}/{id}/unblock',
767
+ pathParams,
768
+ undefined,
769
+ body,
770
+ );
771
+
772
+ decoders.UnblockUserResponse?.(response.body);
773
+
774
+ return { ...response.body, metadata: response.metadata };
775
+ };
776
+
777
+ videoUnpin = async (
778
+ request: UnpinRequest & { type: string; id: string },
779
+ ): Promise<StreamResponse<UnpinResponse>> => {
780
+ const pathParams = {
781
+ type: request?.type,
782
+ id: request?.id,
783
+ };
784
+ const body = {
785
+ session_id: request?.session_id,
786
+ user_id: request?.user_id,
787
+ };
788
+
789
+ const response = await this.sendRequest<StreamResponse<UnpinResponse>>(
790
+ 'POST',
791
+ '/api/v2/video/call/{type}/{id}/unpin',
792
+ pathParams,
793
+ undefined,
794
+ body,
795
+ );
796
+
797
+ decoders.UnpinResponse?.(response.body);
798
+
799
+ return { ...response.body, metadata: response.metadata };
800
+ };
801
+
802
+ updateUserPermissions = async (
803
+ request: UpdateUserPermissionsRequest & { type: string; id: string },
804
+ ): Promise<StreamResponse<UpdateUserPermissionsResponse>> => {
805
+ const pathParams = {
806
+ type: request?.type,
807
+ id: request?.id,
808
+ };
809
+ const body = {
810
+ user_id: request?.user_id,
811
+ grant_permissions: request?.grant_permissions,
812
+ revoke_permissions: request?.revoke_permissions,
813
+ };
814
+
815
+ const response = await this.sendRequest<
816
+ StreamResponse<UpdateUserPermissionsResponse>
817
+ >(
818
+ 'POST',
819
+ '/api/v2/video/call/{type}/{id}/user_permissions',
820
+ pathParams,
821
+ undefined,
822
+ body,
823
+ );
824
+
825
+ decoders.UpdateUserPermissionsResponse?.(response.body);
826
+
827
+ return { ...response.body, metadata: response.metadata };
828
+ };
829
+
830
+ deleteRecording = async (request: {
831
+ type: string;
832
+ id: string;
833
+ session: string;
834
+ filename: string;
835
+ }): Promise<StreamResponse<DeleteRecordingResponse>> => {
836
+ const pathParams = {
837
+ type: request?.type,
838
+ id: request?.id,
839
+ session: request?.session,
840
+ filename: request?.filename,
841
+ };
842
+
843
+ const response = await this.sendRequest<
844
+ StreamResponse<DeleteRecordingResponse>
845
+ >(
846
+ 'DELETE',
847
+ '/api/v2/video/call/{type}/{id}/{session}/recordings/{filename}',
848
+ pathParams,
849
+ undefined,
850
+ );
851
+
852
+ decoders.DeleteRecordingResponse?.(response.body);
853
+
854
+ return { ...response.body, metadata: response.metadata };
855
+ };
856
+
857
+ deleteTranscription = async (request: {
858
+ type: string;
859
+ id: string;
860
+ session: string;
861
+ filename: string;
862
+ }): Promise<StreamResponse<DeleteTranscriptionResponse>> => {
863
+ const pathParams = {
864
+ type: request?.type,
865
+ id: request?.id,
866
+ session: request?.session,
867
+ filename: request?.filename,
868
+ };
869
+
870
+ const response = await this.sendRequest<
871
+ StreamResponse<DeleteTranscriptionResponse>
872
+ >(
873
+ 'DELETE',
874
+ '/api/v2/video/call/{type}/{id}/{session}/transcriptions/{filename}',
875
+ pathParams,
876
+ undefined,
877
+ );
878
+
879
+ decoders.DeleteTranscriptionResponse?.(response.body);
880
+
881
+ return { ...response.body, metadata: response.metadata };
882
+ };
883
+
884
+ queryCalls = async (
885
+ request?: QueryCallsRequest,
886
+ ): Promise<StreamResponse<QueryCallsResponse>> => {
887
+ const body = {
888
+ limit: request?.limit,
889
+ next: request?.next,
890
+ prev: request?.prev,
891
+ sort: request?.sort,
892
+ filter_conditions: request?.filter_conditions,
893
+ };
894
+
895
+ const response = await this.sendRequest<StreamResponse<QueryCallsResponse>>(
896
+ 'POST',
897
+ '/api/v2/video/calls',
898
+ undefined,
899
+ undefined,
900
+ body,
901
+ );
902
+
903
+ decoders.QueryCallsResponse?.(response.body);
904
+
905
+ return { ...response.body, metadata: response.metadata };
906
+ };
907
+
908
+ listCallTypes = async (): Promise<StreamResponse<ListCallTypeResponse>> => {
909
+ const response = await this.sendRequest<
910
+ StreamResponse<ListCallTypeResponse>
911
+ >('GET', '/api/v2/video/calltypes', undefined, undefined);
912
+
913
+ decoders.ListCallTypeResponse?.(response.body);
914
+
915
+ return { ...response.body, metadata: response.metadata };
916
+ };
917
+
918
+ createCallType = async (
919
+ request: CreateCallTypeRequest,
920
+ ): Promise<StreamResponse<CreateCallTypeResponse>> => {
921
+ const body = {
922
+ name: request?.name,
923
+ external_storage: request?.external_storage,
924
+ grants: request?.grants,
925
+ notification_settings: request?.notification_settings,
926
+ settings: request?.settings,
927
+ };
928
+
929
+ const response = await this.sendRequest<
930
+ StreamResponse<CreateCallTypeResponse>
931
+ >('POST', '/api/v2/video/calltypes', undefined, undefined, body);
932
+
933
+ decoders.CreateCallTypeResponse?.(response.body);
934
+
935
+ return { ...response.body, metadata: response.metadata };
936
+ };
937
+
938
+ deleteCallType = async (request: {
939
+ name: string;
940
+ }): Promise<StreamResponse<Response>> => {
941
+ const pathParams = {
942
+ name: request?.name,
943
+ };
944
+
945
+ const response = await this.sendRequest<StreamResponse<Response>>(
946
+ 'DELETE',
947
+ '/api/v2/video/calltypes/{name}',
948
+ pathParams,
949
+ undefined,
950
+ );
951
+
952
+ decoders.Response?.(response.body);
953
+
954
+ return { ...response.body, metadata: response.metadata };
955
+ };
956
+
957
+ getCallType = async (request: {
958
+ name: string;
959
+ }): Promise<StreamResponse<GetCallTypeResponse>> => {
960
+ const pathParams = {
961
+ name: request?.name,
962
+ };
963
+
964
+ const response = await this.sendRequest<
965
+ StreamResponse<GetCallTypeResponse>
966
+ >('GET', '/api/v2/video/calltypes/{name}', pathParams, undefined);
967
+
968
+ decoders.GetCallTypeResponse?.(response.body);
969
+
970
+ return { ...response.body, metadata: response.metadata };
971
+ };
972
+
973
+ updateCallType = async (
974
+ request: UpdateCallTypeRequest & { name: string },
975
+ ): Promise<StreamResponse<UpdateCallTypeResponse>> => {
976
+ const pathParams = {
977
+ name: request?.name,
978
+ };
979
+ const body = {
980
+ external_storage: request?.external_storage,
981
+ grants: request?.grants,
982
+ notification_settings: request?.notification_settings,
983
+ settings: request?.settings,
984
+ };
985
+
986
+ const response = await this.sendRequest<
987
+ StreamResponse<UpdateCallTypeResponse>
988
+ >('PUT', '/api/v2/video/calltypes/{name}', pathParams, undefined, body);
989
+
990
+ decoders.UpdateCallTypeResponse?.(response.body);
991
+
992
+ return { ...response.body, metadata: response.metadata };
993
+ };
994
+
995
+ getEdges = async (): Promise<StreamResponse<GetEdgesResponse>> => {
996
+ const response = await this.sendRequest<StreamResponse<GetEdgesResponse>>(
997
+ 'GET',
998
+ '/api/v2/video/edges',
999
+ undefined,
1000
+ undefined,
1001
+ );
1002
+
1003
+ decoders.GetEdgesResponse?.(response.body);
1004
+
1005
+ return { ...response.body, metadata: response.metadata };
1006
+ };
1007
+ }