@stream-io/node-sdk 0.3.0 → 0.4.0

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 (70) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs.js +4140 -9282
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.d.ts +2 -3
  5. package/dist/index.es.js +4140 -9206
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/src/BaseApi.d.ts +10 -0
  8. package/dist/src/StreamCall.d.ts +5 -37
  9. package/dist/src/StreamChannel.d.ts +7 -34
  10. package/dist/src/StreamChatClient.d.ts +2 -25
  11. package/dist/src/StreamClient.d.ts +51 -59
  12. package/dist/src/StreamModerationClient.d.ts +3 -0
  13. package/dist/src/StreamVideoClient.d.ts +2 -18
  14. package/dist/src/gen/chat/ChannelApi.d.ts +33 -0
  15. package/dist/src/gen/chat/ChatApi.d.ts +241 -0
  16. package/dist/src/gen/common/CommonApi.d.ts +99 -0
  17. package/dist/src/gen/model-decoders/index.d.ts +3 -0
  18. package/dist/src/gen/models/index.d.ts +3878 -0
  19. package/dist/src/gen/moderation/ModerationApi.d.ts +38 -0
  20. package/dist/src/gen/video/CallApi.d.ts +56 -0
  21. package/dist/src/gen/video/VideoApi.d.ts +151 -0
  22. package/dist/src/types.d.ts +25 -0
  23. package/dist/src/utils/create-token.d.ts +2 -0
  24. package/dist/src/utils/rate-limit.d.ts +2 -0
  25. package/index.ts +2 -3
  26. package/package.json +12 -4
  27. package/src/BaseApi.ts +115 -0
  28. package/src/StreamCall.ts +9 -199
  29. package/src/StreamChannel.ts +23 -246
  30. package/src/StreamChatClient.ts +3 -122
  31. package/src/StreamClient.ts +101 -345
  32. package/src/StreamModerationClient.ts +3 -0
  33. package/src/StreamVideoClient.ts +3 -95
  34. package/src/gen/chat/ChannelApi.ts +270 -0
  35. package/src/gen/chat/ChatApi.ts +1857 -0
  36. package/src/gen/common/CommonApi.ts +1004 -0
  37. package/src/gen/model-decoders/index.ts +1897 -0
  38. package/src/gen/models/index.ts +6790 -0
  39. package/src/gen/moderation/ModerationApi.ts +476 -0
  40. package/src/gen/video/CallApi.ts +309 -0
  41. package/src/gen/video/VideoApi.ts +1011 -0
  42. package/src/types.ts +35 -0
  43. package/src/utils/create-token.ts +6 -1
  44. package/src/utils/rate-limit.ts +21 -0
  45. package/dist/src/gen/chat/apis/ProductchatApi.d.ts +0 -1750
  46. package/dist/src/gen/chat/apis/index.d.ts +0 -1
  47. package/dist/src/gen/chat/index.d.ts +0 -3
  48. package/dist/src/gen/chat/models/index.d.ts +0 -14865
  49. package/dist/src/gen/chat/runtime.d.ts +0 -180
  50. package/dist/src/gen/video/apis/ProductvideoApi.d.ts +0 -648
  51. package/dist/src/gen/video/apis/index.d.ts +0 -1
  52. package/dist/src/gen/video/index.d.ts +0 -3
  53. package/dist/src/gen/video/models/index.d.ts +0 -5011
  54. package/dist/src/gen/video/runtime.d.ts +0 -180
  55. package/src/gen/chat/.openapi-generator/FILES +0 -6
  56. package/src/gen/chat/.openapi-generator/VERSION +0 -1
  57. package/src/gen/chat/.openapi-generator-ignore +0 -23
  58. package/src/gen/chat/apis/ProductchatApi.ts +0 -7007
  59. package/src/gen/chat/apis/index.ts +0 -3
  60. package/src/gen/chat/index.ts +0 -5
  61. package/src/gen/chat/models/index.ts +0 -14766
  62. package/src/gen/chat/runtime.ts +0 -415
  63. package/src/gen/video/.openapi-generator/FILES +0 -6
  64. package/src/gen/video/.openapi-generator/VERSION +0 -1
  65. package/src/gen/video/.openapi-generator-ignore +0 -23
  66. package/src/gen/video/apis/ProductvideoApi.ts +0 -2575
  67. package/src/gen/video/apis/index.ts +0 -3
  68. package/src/gen/video/index.ts +0 -5
  69. package/src/gen/video/models/index.ts +0 -5000
  70. package/src/gen/video/runtime.ts +0 -415
@@ -0,0 +1,1011 @@
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
+ startRTMPBroadcast = 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
+ name: request?.name,
469
+ stream_url: request?.stream_url,
470
+ quality: request?.quality,
471
+ stream_key: request?.stream_key,
472
+ layout: request?.layout,
473
+ };
474
+
475
+ const response = await this.sendRequest<
476
+ StreamResponse<StartRTMPBroadcastsResponse>
477
+ >(
478
+ 'POST',
479
+ '/api/v2/video/call/{type}/{id}/rtmp_broadcasts',
480
+ pathParams,
481
+ undefined,
482
+ body,
483
+ );
484
+
485
+ decoders.StartRTMPBroadcastsResponse?.(response.body);
486
+
487
+ return { ...response.body, metadata: response.metadata };
488
+ };
489
+
490
+ stopAllRTMPBroadcasts = async (request: {
491
+ type: string;
492
+ id: string;
493
+ }): Promise<StreamResponse<StopAllRTMPBroadcastsResponse>> => {
494
+ const pathParams = {
495
+ type: request?.type,
496
+ id: request?.id,
497
+ };
498
+
499
+ const response = await this.sendRequest<
500
+ StreamResponse<StopAllRTMPBroadcastsResponse>
501
+ >(
502
+ 'POST',
503
+ '/api/v2/video/call/{type}/{id}/rtmp_broadcasts/stop',
504
+ pathParams,
505
+ undefined,
506
+ );
507
+
508
+ decoders.StopAllRTMPBroadcastsResponse?.(response.body);
509
+
510
+ return { ...response.body, metadata: response.metadata };
511
+ };
512
+
513
+ stopRTMPBroadcast = async (
514
+ request: StopRTMPBroadcastsRequest & {
515
+ type: string;
516
+ id: string;
517
+ name: string;
518
+ },
519
+ ): Promise<StreamResponse<StopRTMPBroadcastsResponse>> => {
520
+ const pathParams = {
521
+ type: request?.type,
522
+ id: request?.id,
523
+ name: request?.name,
524
+ };
525
+ const body = {};
526
+
527
+ const response = await this.sendRequest<
528
+ StreamResponse<StopRTMPBroadcastsResponse>
529
+ >(
530
+ 'POST',
531
+ '/api/v2/video/call/{type}/{id}/rtmp_broadcasts/{name}/stop',
532
+ pathParams,
533
+ undefined,
534
+ body,
535
+ );
536
+
537
+ decoders.StopRTMPBroadcastsResponse?.(response.body);
538
+
539
+ return { ...response.body, metadata: response.metadata };
540
+ };
541
+
542
+ startHLSBroadcasting = async (request: {
543
+ type: string;
544
+ id: string;
545
+ }): Promise<StreamResponse<StartHLSBroadcastingResponse>> => {
546
+ const pathParams = {
547
+ type: request?.type,
548
+ id: request?.id,
549
+ };
550
+
551
+ const response = await this.sendRequest<
552
+ StreamResponse<StartHLSBroadcastingResponse>
553
+ >(
554
+ 'POST',
555
+ '/api/v2/video/call/{type}/{id}/start_broadcasting',
556
+ pathParams,
557
+ undefined,
558
+ );
559
+
560
+ decoders.StartHLSBroadcastingResponse?.(response.body);
561
+
562
+ return { ...response.body, metadata: response.metadata };
563
+ };
564
+
565
+ startRecording = async (
566
+ request: StartRecordingRequest & { type: string; id: string },
567
+ ): Promise<StreamResponse<StartRecordingResponse>> => {
568
+ const pathParams = {
569
+ type: request?.type,
570
+ id: request?.id,
571
+ };
572
+ const body = {
573
+ recording_external_storage: request?.recording_external_storage,
574
+ };
575
+
576
+ const response = await this.sendRequest<
577
+ StreamResponse<StartRecordingResponse>
578
+ >(
579
+ 'POST',
580
+ '/api/v2/video/call/{type}/{id}/start_recording',
581
+ pathParams,
582
+ undefined,
583
+ body,
584
+ );
585
+
586
+ decoders.StartRecordingResponse?.(response.body);
587
+
588
+ return { ...response.body, metadata: response.metadata };
589
+ };
590
+
591
+ startTranscription = async (
592
+ request: StartTranscriptionRequest & { type: string; id: string },
593
+ ): Promise<StreamResponse<StartTranscriptionResponse>> => {
594
+ const pathParams = {
595
+ type: request?.type,
596
+ id: request?.id,
597
+ };
598
+ const body = {
599
+ transcription_external_storage: request?.transcription_external_storage,
600
+ };
601
+
602
+ const response = await this.sendRequest<
603
+ StreamResponse<StartTranscriptionResponse>
604
+ >(
605
+ 'POST',
606
+ '/api/v2/video/call/{type}/{id}/start_transcription',
607
+ pathParams,
608
+ undefined,
609
+ body,
610
+ );
611
+
612
+ decoders.StartTranscriptionResponse?.(response.body);
613
+
614
+ return { ...response.body, metadata: response.metadata };
615
+ };
616
+
617
+ getCallStats = async (request: {
618
+ type: string;
619
+ id: string;
620
+ session: string;
621
+ }): Promise<StreamResponse<GetCallStatsResponse>> => {
622
+ const pathParams = {
623
+ type: request?.type,
624
+ id: request?.id,
625
+ session: request?.session,
626
+ };
627
+
628
+ const response = await this.sendRequest<
629
+ StreamResponse<GetCallStatsResponse>
630
+ >(
631
+ 'GET',
632
+ '/api/v2/video/call/{type}/{id}/stats/{session}',
633
+ pathParams,
634
+ undefined,
635
+ );
636
+
637
+ decoders.GetCallStatsResponse?.(response.body);
638
+
639
+ return { ...response.body, metadata: response.metadata };
640
+ };
641
+
642
+ stopHLSBroadcasting = async (request: {
643
+ type: string;
644
+ id: string;
645
+ }): Promise<StreamResponse<StopHLSBroadcastingResponse>> => {
646
+ const pathParams = {
647
+ type: request?.type,
648
+ id: request?.id,
649
+ };
650
+
651
+ const response = await this.sendRequest<
652
+ StreamResponse<StopHLSBroadcastingResponse>
653
+ >(
654
+ 'POST',
655
+ '/api/v2/video/call/{type}/{id}/stop_broadcasting',
656
+ pathParams,
657
+ undefined,
658
+ );
659
+
660
+ decoders.StopHLSBroadcastingResponse?.(response.body);
661
+
662
+ return { ...response.body, metadata: response.metadata };
663
+ };
664
+
665
+ stopLive = async (request: {
666
+ type: string;
667
+ id: string;
668
+ }): Promise<StreamResponse<StopLiveResponse>> => {
669
+ const pathParams = {
670
+ type: request?.type,
671
+ id: request?.id,
672
+ };
673
+
674
+ const response = await this.sendRequest<StreamResponse<StopLiveResponse>>(
675
+ 'POST',
676
+ '/api/v2/video/call/{type}/{id}/stop_live',
677
+ pathParams,
678
+ undefined,
679
+ );
680
+
681
+ decoders.StopLiveResponse?.(response.body);
682
+
683
+ return { ...response.body, metadata: response.metadata };
684
+ };
685
+
686
+ stopRecording = async (request: {
687
+ type: string;
688
+ id: string;
689
+ }): Promise<StreamResponse<StopRecordingResponse>> => {
690
+ const pathParams = {
691
+ type: request?.type,
692
+ id: request?.id,
693
+ };
694
+
695
+ const response = await this.sendRequest<
696
+ StreamResponse<StopRecordingResponse>
697
+ >(
698
+ 'POST',
699
+ '/api/v2/video/call/{type}/{id}/stop_recording',
700
+ pathParams,
701
+ undefined,
702
+ );
703
+
704
+ decoders.StopRecordingResponse?.(response.body);
705
+
706
+ return { ...response.body, metadata: response.metadata };
707
+ };
708
+
709
+ stopTranscription = async (request: {
710
+ type: string;
711
+ id: string;
712
+ }): Promise<StreamResponse<StopTranscriptionResponse>> => {
713
+ const pathParams = {
714
+ type: request?.type,
715
+ id: request?.id,
716
+ };
717
+
718
+ const response = await this.sendRequest<
719
+ StreamResponse<StopTranscriptionResponse>
720
+ >(
721
+ 'POST',
722
+ '/api/v2/video/call/{type}/{id}/stop_transcription',
723
+ pathParams,
724
+ undefined,
725
+ );
726
+
727
+ decoders.StopTranscriptionResponse?.(response.body);
728
+
729
+ return { ...response.body, metadata: response.metadata };
730
+ };
731
+
732
+ listTranscriptions = async (request: {
733
+ type: string;
734
+ id: string;
735
+ }): Promise<StreamResponse<ListTranscriptionsResponse>> => {
736
+ const pathParams = {
737
+ type: request?.type,
738
+ id: request?.id,
739
+ };
740
+
741
+ const response = await this.sendRequest<
742
+ StreamResponse<ListTranscriptionsResponse>
743
+ >(
744
+ 'GET',
745
+ '/api/v2/video/call/{type}/{id}/transcriptions',
746
+ pathParams,
747
+ undefined,
748
+ );
749
+
750
+ decoders.ListTranscriptionsResponse?.(response.body);
751
+
752
+ return { ...response.body, metadata: response.metadata };
753
+ };
754
+
755
+ unblockUser = async (
756
+ request: UnblockUserRequest & { type: string; id: string },
757
+ ): Promise<StreamResponse<UnblockUserResponse>> => {
758
+ const pathParams = {
759
+ type: request?.type,
760
+ id: request?.id,
761
+ };
762
+ const body = {
763
+ user_id: request?.user_id,
764
+ };
765
+
766
+ const response = await this.sendRequest<
767
+ StreamResponse<UnblockUserResponse>
768
+ >(
769
+ 'POST',
770
+ '/api/v2/video/call/{type}/{id}/unblock',
771
+ pathParams,
772
+ undefined,
773
+ body,
774
+ );
775
+
776
+ decoders.UnblockUserResponse?.(response.body);
777
+
778
+ return { ...response.body, metadata: response.metadata };
779
+ };
780
+
781
+ videoUnpin = async (
782
+ request: UnpinRequest & { type: string; id: string },
783
+ ): Promise<StreamResponse<UnpinResponse>> => {
784
+ const pathParams = {
785
+ type: request?.type,
786
+ id: request?.id,
787
+ };
788
+ const body = {
789
+ session_id: request?.session_id,
790
+ user_id: request?.user_id,
791
+ };
792
+
793
+ const response = await this.sendRequest<StreamResponse<UnpinResponse>>(
794
+ 'POST',
795
+ '/api/v2/video/call/{type}/{id}/unpin',
796
+ pathParams,
797
+ undefined,
798
+ body,
799
+ );
800
+
801
+ decoders.UnpinResponse?.(response.body);
802
+
803
+ return { ...response.body, metadata: response.metadata };
804
+ };
805
+
806
+ updateUserPermissions = async (
807
+ request: UpdateUserPermissionsRequest & { type: string; id: string },
808
+ ): Promise<StreamResponse<UpdateUserPermissionsResponse>> => {
809
+ const pathParams = {
810
+ type: request?.type,
811
+ id: request?.id,
812
+ };
813
+ const body = {
814
+ user_id: request?.user_id,
815
+ grant_permissions: request?.grant_permissions,
816
+ revoke_permissions: request?.revoke_permissions,
817
+ };
818
+
819
+ const response = await this.sendRequest<
820
+ StreamResponse<UpdateUserPermissionsResponse>
821
+ >(
822
+ 'POST',
823
+ '/api/v2/video/call/{type}/{id}/user_permissions',
824
+ pathParams,
825
+ undefined,
826
+ body,
827
+ );
828
+
829
+ decoders.UpdateUserPermissionsResponse?.(response.body);
830
+
831
+ return { ...response.body, metadata: response.metadata };
832
+ };
833
+
834
+ deleteRecording = async (request: {
835
+ type: string;
836
+ id: string;
837
+ session: string;
838
+ filename: string;
839
+ }): Promise<StreamResponse<DeleteRecordingResponse>> => {
840
+ const pathParams = {
841
+ type: request?.type,
842
+ id: request?.id,
843
+ session: request?.session,
844
+ filename: request?.filename,
845
+ };
846
+
847
+ const response = await this.sendRequest<
848
+ StreamResponse<DeleteRecordingResponse>
849
+ >(
850
+ 'DELETE',
851
+ '/api/v2/video/call/{type}/{id}/{session}/recordings/{filename}',
852
+ pathParams,
853
+ undefined,
854
+ );
855
+
856
+ decoders.DeleteRecordingResponse?.(response.body);
857
+
858
+ return { ...response.body, metadata: response.metadata };
859
+ };
860
+
861
+ deleteTranscription = async (request: {
862
+ type: string;
863
+ id: string;
864
+ session: string;
865
+ filename: string;
866
+ }): Promise<StreamResponse<DeleteTranscriptionResponse>> => {
867
+ const pathParams = {
868
+ type: request?.type,
869
+ id: request?.id,
870
+ session: request?.session,
871
+ filename: request?.filename,
872
+ };
873
+
874
+ const response = await this.sendRequest<
875
+ StreamResponse<DeleteTranscriptionResponse>
876
+ >(
877
+ 'DELETE',
878
+ '/api/v2/video/call/{type}/{id}/{session}/transcriptions/{filename}',
879
+ pathParams,
880
+ undefined,
881
+ );
882
+
883
+ decoders.DeleteTranscriptionResponse?.(response.body);
884
+
885
+ return { ...response.body, metadata: response.metadata };
886
+ };
887
+
888
+ queryCalls = async (
889
+ request?: QueryCallsRequest,
890
+ ): Promise<StreamResponse<QueryCallsResponse>> => {
891
+ const body = {
892
+ limit: request?.limit,
893
+ next: request?.next,
894
+ prev: request?.prev,
895
+ sort: request?.sort,
896
+ filter_conditions: request?.filter_conditions,
897
+ };
898
+
899
+ const response = await this.sendRequest<StreamResponse<QueryCallsResponse>>(
900
+ 'POST',
901
+ '/api/v2/video/calls',
902
+ undefined,
903
+ undefined,
904
+ body,
905
+ );
906
+
907
+ decoders.QueryCallsResponse?.(response.body);
908
+
909
+ return { ...response.body, metadata: response.metadata };
910
+ };
911
+
912
+ listCallTypes = async (): Promise<StreamResponse<ListCallTypeResponse>> => {
913
+ const response = await this.sendRequest<
914
+ StreamResponse<ListCallTypeResponse>
915
+ >('GET', '/api/v2/video/calltypes', undefined, undefined);
916
+
917
+ decoders.ListCallTypeResponse?.(response.body);
918
+
919
+ return { ...response.body, metadata: response.metadata };
920
+ };
921
+
922
+ createCallType = async (
923
+ request: CreateCallTypeRequest,
924
+ ): Promise<StreamResponse<CreateCallTypeResponse>> => {
925
+ const body = {
926
+ name: request?.name,
927
+ external_storage: request?.external_storage,
928
+ grants: request?.grants,
929
+ notification_settings: request?.notification_settings,
930
+ settings: request?.settings,
931
+ };
932
+
933
+ const response = await this.sendRequest<
934
+ StreamResponse<CreateCallTypeResponse>
935
+ >('POST', '/api/v2/video/calltypes', undefined, undefined, body);
936
+
937
+ decoders.CreateCallTypeResponse?.(response.body);
938
+
939
+ return { ...response.body, metadata: response.metadata };
940
+ };
941
+
942
+ deleteCallType = async (request: {
943
+ name: string;
944
+ }): Promise<StreamResponse<Response>> => {
945
+ const pathParams = {
946
+ name: request?.name,
947
+ };
948
+
949
+ const response = await this.sendRequest<StreamResponse<Response>>(
950
+ 'DELETE',
951
+ '/api/v2/video/calltypes/{name}',
952
+ pathParams,
953
+ undefined,
954
+ );
955
+
956
+ decoders.Response?.(response.body);
957
+
958
+ return { ...response.body, metadata: response.metadata };
959
+ };
960
+
961
+ getCallType = async (request: {
962
+ name: string;
963
+ }): Promise<StreamResponse<GetCallTypeResponse>> => {
964
+ const pathParams = {
965
+ name: request?.name,
966
+ };
967
+
968
+ const response = await this.sendRequest<
969
+ StreamResponse<GetCallTypeResponse>
970
+ >('GET', '/api/v2/video/calltypes/{name}', pathParams, undefined);
971
+
972
+ decoders.GetCallTypeResponse?.(response.body);
973
+
974
+ return { ...response.body, metadata: response.metadata };
975
+ };
976
+
977
+ updateCallType = async (
978
+ request: UpdateCallTypeRequest & { name: string },
979
+ ): Promise<StreamResponse<UpdateCallTypeResponse>> => {
980
+ const pathParams = {
981
+ name: request?.name,
982
+ };
983
+ const body = {
984
+ external_storage: request?.external_storage,
985
+ grants: request?.grants,
986
+ notification_settings: request?.notification_settings,
987
+ settings: request?.settings,
988
+ };
989
+
990
+ const response = await this.sendRequest<
991
+ StreamResponse<UpdateCallTypeResponse>
992
+ >('PUT', '/api/v2/video/calltypes/{name}', pathParams, undefined, body);
993
+
994
+ decoders.UpdateCallTypeResponse?.(response.body);
995
+
996
+ return { ...response.body, metadata: response.metadata };
997
+ };
998
+
999
+ getEdges = async (): Promise<StreamResponse<GetEdgesResponse>> => {
1000
+ const response = await this.sendRequest<StreamResponse<GetEdgesResponse>>(
1001
+ 'GET',
1002
+ '/api/v2/video/edges',
1003
+ undefined,
1004
+ undefined,
1005
+ );
1006
+
1007
+ decoders.GetEdgesResponse?.(response.body);
1008
+
1009
+ return { ...response.body, metadata: response.metadata };
1010
+ };
1011
+ }