-
Notifications
You must be signed in to change notification settings - Fork 1
/
video.go
550 lines (508 loc) · 20.1 KB
/
video.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT.
package getstream
import (
"context"
)
type VideoClient struct {
client *Client
}
func NewVideoClient(client *Client) *VideoClient {
return &VideoClient{
client: client,
}
}
// Query call members with filter query
//
// Required permissions:
// - ReadCall
func (c *VideoClient) QueryCallMembers(ctx context.Context, request *QueryCallMembersRequest) (*StreamResponse[QueryCallMembersResponse], error) {
var result QueryCallMembersResponse
res, err := MakeRequest[QueryCallMembersRequest, QueryCallMembersResponse](c.client, ctx, "POST", "/api/v2/video/call/members", nil, request, &result, nil)
return res, err
}
// Required permissions:
// - ReadCallStats
func (c *VideoClient) QueryCallStats(ctx context.Context, request *QueryCallStatsRequest) (*StreamResponse[QueryCallStatsResponse], error) {
var result QueryCallStatsResponse
res, err := MakeRequest[QueryCallStatsRequest, QueryCallStatsResponse](c.client, ctx, "POST", "/api/v2/video/call/stats", nil, request, &result, nil)
return res, err
}
// Required permissions:
// - ReadCall
func (c *VideoClient) GetCall(ctx context.Context, _type string, id string, request *GetCallRequest) (*StreamResponse[GetCallResponse], error) {
var result GetCallResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
params := extractQueryParams(request)
res, err := MakeRequest[any, GetCallResponse](c.client, ctx, "GET", "/api/v2/video/call/{type}/{id}", params, nil, &result, pathParams)
return res, err
}
// Sends events:
// - call.updated
//
// Required permissions:
// - UpdateCall
func (c *VideoClient) UpdateCall(ctx context.Context, _type string, id string, request *UpdateCallRequest) (*StreamResponse[UpdateCallResponse], error) {
var result UpdateCallResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[UpdateCallRequest, UpdateCallResponse](c.client, ctx, "PATCH", "/api/v2/video/call/{type}/{id}", nil, request, &result, pathParams)
return res, err
}
// Gets or creates a new call
//
// Sends events:
// - call.created
// - call.notification
// - call.ring
//
// Required permissions:
// - CreateCall
// - ReadCall
// - UpdateCallSettings
func (c *VideoClient) GetOrCreateCall(ctx context.Context, _type string, id string, request *GetOrCreateCallRequest) (*StreamResponse[GetOrCreateCallResponse], error) {
var result GetOrCreateCallResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[GetOrCreateCallRequest, GetOrCreateCallResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}", nil, request, &result, pathParams)
return res, err
}
// Block a user, preventing them from joining the call until they are unblocked.
//
// Sends events:
// - call.blocked_user
//
// Required permissions:
// - BlockUser
func (c *VideoClient) BlockUser(ctx context.Context, _type string, id string, request *BlockUserRequest) (*StreamResponse[BlockUserResponse], error) {
var result BlockUserResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[BlockUserRequest, BlockUserResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/block", nil, request, &result, pathParams)
return res, err
}
// Sends events:
// - call.deleted
//
// Required permissions:
// - DeleteCall
func (c *VideoClient) DeleteCall(ctx context.Context, _type string, id string, request *DeleteCallRequest) (*StreamResponse[DeleteCallResponse], error) {
var result DeleteCallResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[DeleteCallRequest, DeleteCallResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/delete", nil, request, &result, pathParams)
return res, err
}
// Sends custom event to the call
//
// Sends events:
// - custom
//
// Required permissions:
// - SendEvent
func (c *VideoClient) SendCallEvent(ctx context.Context, _type string, id string, request *SendCallEventRequest) (*StreamResponse[SendCallEventResponse], error) {
var result SendCallEventResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[SendCallEventRequest, SendCallEventResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/event", nil, request, &result, pathParams)
return res, err
}
// Required permissions:
// - JoinCall
func (c *VideoClient) CollectUserFeedback(ctx context.Context, _type string, id string, session string, request *CollectUserFeedbackRequest) (*StreamResponse[CollectUserFeedbackResponse], error) {
var result CollectUserFeedbackResponse
pathParams := map[string]string{
"type": _type,
"id": id,
"session": session,
}
res, err := MakeRequest[CollectUserFeedbackRequest, CollectUserFeedbackResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/feedback/{session}", nil, request, &result, pathParams)
return res, err
}
// Sends events:
// - call.live_started
//
// Required permissions:
// - UpdateCall
func (c *VideoClient) GoLive(ctx context.Context, _type string, id string, request *GoLiveRequest) (*StreamResponse[GoLiveResponse], error) {
var result GoLiveResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[GoLiveRequest, GoLiveResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/go_live", nil, request, &result, pathParams)
return res, err
}
// Sends events:
// - call.ended
//
// Required permissions:
// - EndCall
func (c *VideoClient) EndCall(ctx context.Context, _type string, id string, request *EndCallRequest) (*StreamResponse[EndCallResponse], error) {
var result EndCallResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, EndCallResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/mark_ended", nil, nil, &result, pathParams)
return res, err
}
// Sends events:
// - call.member_added
// - call.member_removed
// - call.member_updated
//
// Required permissions:
// - RemoveCallMember
// - UpdateCallMember
// - UpdateCallMemberRole
func (c *VideoClient) UpdateCallMembers(ctx context.Context, _type string, id string, request *UpdateCallMembersRequest) (*StreamResponse[UpdateCallMembersResponse], error) {
var result UpdateCallMembersResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[UpdateCallMembersRequest, UpdateCallMembersResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/members", nil, request, &result, pathParams)
return res, err
}
// Mutes users in a call
//
// Required permissions:
// - MuteUsers
func (c *VideoClient) MuteUsers(ctx context.Context, _type string, id string, request *MuteUsersRequest) (*StreamResponse[MuteUsersResponse], error) {
var result MuteUsersResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[MuteUsersRequest, MuteUsersResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/mute_users", nil, request, &result, pathParams)
return res, err
}
// Pins a track for all users in the call.
//
// Required permissions:
// - PinCallTrack
func (c *VideoClient) VideoPin(ctx context.Context, _type string, id string, request *VideoPinRequest) (*StreamResponse[PinResponse], error) {
var result PinResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[VideoPinRequest, PinResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/pin", nil, request, &result, pathParams)
return res, err
}
// Lists recordings
//
// Required permissions:
// - ListRecordings
func (c *VideoClient) ListRecordings(ctx context.Context, _type string, id string, request *ListRecordingsRequest) (*StreamResponse[ListRecordingsResponse], error) {
var result ListRecordingsResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, ListRecordingsResponse](c.client, ctx, "GET", "/api/v2/video/call/{type}/{id}/recordings", nil, nil, &result, pathParams)
return res, err
}
// Starts RTMP broadcasts for the provided RTMP destinations
//
// Required permissions:
// - StartBroadcasting
func (c *VideoClient) StartRTMPBroadcasts(ctx context.Context, _type string, id string, request *StartRTMPBroadcastsRequest) (*StreamResponse[StartRTMPBroadcastsResponse], error) {
var result StartRTMPBroadcastsResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[StartRTMPBroadcastsRequest, StartRTMPBroadcastsResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/rtmp_broadcasts", nil, request, &result, pathParams)
return res, err
}
// Stop all RTMP broadcasts for the provided call
//
// Required permissions:
// - StopBroadcasting
func (c *VideoClient) StopAllRTMPBroadcasts(ctx context.Context, _type string, id string, request *StopAllRTMPBroadcastsRequest) (*StreamResponse[StopAllRTMPBroadcastsResponse], error) {
var result StopAllRTMPBroadcastsResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, StopAllRTMPBroadcastsResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/rtmp_broadcasts/stop", nil, nil, &result, pathParams)
return res, err
}
// Stop RTMP broadcasts for the provided RTMP destinations
//
// Required permissions:
// - StopBroadcasting
func (c *VideoClient) StopRTMPBroadcast(ctx context.Context, _type string, id string, name string, request *StopRTMPBroadcastRequest) (*StreamResponse[StopRTMPBroadcastsResponse], error) {
var result StopRTMPBroadcastsResponse
pathParams := map[string]string{
"type": _type,
"id": id,
"name": name,
}
res, err := MakeRequest[StopRTMPBroadcastRequest, StopRTMPBroadcastsResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/rtmp_broadcasts/{name}/stop", nil, request, &result, pathParams)
return res, err
}
// Starts HLS broadcasting
//
// Required permissions:
// - StartBroadcasting
func (c *VideoClient) StartHLSBroadcasting(ctx context.Context, _type string, id string, request *StartHLSBroadcastingRequest) (*StreamResponse[StartHLSBroadcastingResponse], error) {
var result StartHLSBroadcastingResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, StartHLSBroadcastingResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/start_broadcasting", nil, nil, &result, pathParams)
return res, err
}
// Starts recording
//
// Sends events:
// - call.recording_started
//
// Required permissions:
// - StartRecording
func (c *VideoClient) StartRecording(ctx context.Context, _type string, id string, request *StartRecordingRequest) (*StreamResponse[StartRecordingResponse], error) {
var result StartRecordingResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[StartRecordingRequest, StartRecordingResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/start_recording", nil, request, &result, pathParams)
return res, err
}
// Starts transcription
//
// Required permissions:
// - StartTranscription
func (c *VideoClient) StartTranscription(ctx context.Context, _type string, id string, request *StartTranscriptionRequest) (*StreamResponse[StartTranscriptionResponse], error) {
var result StartTranscriptionResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[StartTranscriptionRequest, StartTranscriptionResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/start_transcription", nil, request, &result, pathParams)
return res, err
}
// Required permissions:
// - ReadCallStats
func (c *VideoClient) GetCallStats(ctx context.Context, _type string, id string, session string, request *GetCallStatsRequest) (*StreamResponse[GetCallStatsResponse], error) {
var result GetCallStatsResponse
pathParams := map[string]string{
"type": _type,
"id": id,
"session": session,
}
res, err := MakeRequest[any, GetCallStatsResponse](c.client, ctx, "GET", "/api/v2/video/call/{type}/{id}/stats/{session}", nil, nil, &result, pathParams)
return res, err
}
// Stops HLS broadcasting
//
// Required permissions:
// - StopBroadcasting
func (c *VideoClient) StopHLSBroadcasting(ctx context.Context, _type string, id string, request *StopHLSBroadcastingRequest) (*StreamResponse[StopHLSBroadcastingResponse], error) {
var result StopHLSBroadcastingResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, StopHLSBroadcastingResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/stop_broadcasting", nil, nil, &result, pathParams)
return res, err
}
// Sends events:
// - call.updated
//
// Required permissions:
// - UpdateCall
func (c *VideoClient) StopLive(ctx context.Context, _type string, id string, request *StopLiveRequest) (*StreamResponse[StopLiveResponse], error) {
var result StopLiveResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, StopLiveResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/stop_live", nil, nil, &result, pathParams)
return res, err
}
// Stops recording
//
// Sends events:
// - call.recording_stopped
//
// Required permissions:
// - StopRecording
func (c *VideoClient) StopRecording(ctx context.Context, _type string, id string, request *StopRecordingRequest) (*StreamResponse[StopRecordingResponse], error) {
var result StopRecordingResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, StopRecordingResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/stop_recording", nil, nil, &result, pathParams)
return res, err
}
// Stops transcription
//
// Sends events:
// - call.transcription_stopped
//
// Required permissions:
// - StopTranscription
func (c *VideoClient) StopTranscription(ctx context.Context, _type string, id string, request *StopTranscriptionRequest) (*StreamResponse[StopTranscriptionResponse], error) {
var result StopTranscriptionResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, StopTranscriptionResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/stop_transcription", nil, nil, &result, pathParams)
return res, err
}
// Lists transcriptions
//
// Required permissions:
// - ListTranscriptions
func (c *VideoClient) ListTranscriptions(ctx context.Context, _type string, id string, request *ListTranscriptionsRequest) (*StreamResponse[ListTranscriptionsResponse], error) {
var result ListTranscriptionsResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[any, ListTranscriptionsResponse](c.client, ctx, "GET", "/api/v2/video/call/{type}/{id}/transcriptions", nil, nil, &result, pathParams)
return res, err
}
// Removes the block for a user on a call. The user will be able to join the call again.
//
// Sends events:
// - call.unblocked_user
//
// Required permissions:
// - BlockUser
func (c *VideoClient) UnblockUser(ctx context.Context, _type string, id string, request *UnblockUserRequest) (*StreamResponse[UnblockUserResponse], error) {
var result UnblockUserResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[UnblockUserRequest, UnblockUserResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/unblock", nil, request, &result, pathParams)
return res, err
}
// Unpins a track for all users in the call.
//
// Required permissions:
// - PinCallTrack
func (c *VideoClient) VideoUnpin(ctx context.Context, _type string, id string, request *VideoUnpinRequest) (*StreamResponse[UnpinResponse], error) {
var result UnpinResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[VideoUnpinRequest, UnpinResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/unpin", nil, request, &result, pathParams)
return res, err
}
// Updates user permissions
//
// Sends events:
// - call.permissions_updated
//
// Required permissions:
// - UpdateCallPermissions
func (c *VideoClient) UpdateUserPermissions(ctx context.Context, _type string, id string, request *UpdateUserPermissionsRequest) (*StreamResponse[UpdateUserPermissionsResponse], error) {
var result UpdateUserPermissionsResponse
pathParams := map[string]string{
"type": _type,
"id": id,
}
res, err := MakeRequest[UpdateUserPermissionsRequest, UpdateUserPermissionsResponse](c.client, ctx, "POST", "/api/v2/video/call/{type}/{id}/user_permissions", nil, request, &result, pathParams)
return res, err
}
// Deletes recording
//
// Required permissions:
// - DeleteRecording
func (c *VideoClient) DeleteRecording(ctx context.Context, _type string, id string, session string, filename string, request *DeleteRecordingRequest) (*StreamResponse[DeleteRecordingResponse], error) {
var result DeleteRecordingResponse
pathParams := map[string]string{
"type": _type,
"id": id,
"session": session,
"filename": filename,
}
res, err := MakeRequest[any, DeleteRecordingResponse](c.client, ctx, "DELETE", "/api/v2/video/call/{type}/{id}/{session}/recordings/{filename}", nil, nil, &result, pathParams)
return res, err
}
// Deletes transcription
//
// Required permissions:
// - DeleteTranscription
func (c *VideoClient) DeleteTranscription(ctx context.Context, _type string, id string, session string, filename string, request *DeleteTranscriptionRequest) (*StreamResponse[DeleteTranscriptionResponse], error) {
var result DeleteTranscriptionResponse
pathParams := map[string]string{
"type": _type,
"id": id,
"session": session,
"filename": filename,
}
res, err := MakeRequest[any, DeleteTranscriptionResponse](c.client, ctx, "DELETE", "/api/v2/video/call/{type}/{id}/{session}/transcriptions/{filename}", nil, nil, &result, pathParams)
return res, err
}
// Query calls with filter query
//
// Required permissions:
// - ReadCall
func (c *VideoClient) QueryCalls(ctx context.Context, request *QueryCallsRequest) (*StreamResponse[QueryCallsResponse], error) {
var result QueryCallsResponse
res, err := MakeRequest[QueryCallsRequest, QueryCallsResponse](c.client, ctx, "POST", "/api/v2/video/calls", nil, request, &result, nil)
return res, err
}
func (c *VideoClient) ListCallTypes(ctx context.Context, request *ListCallTypesRequest) (*StreamResponse[ListCallTypeResponse], error) {
var result ListCallTypeResponse
res, err := MakeRequest[any, ListCallTypeResponse](c.client, ctx, "GET", "/api/v2/video/calltypes", nil, nil, &result, nil)
return res, err
}
func (c *VideoClient) CreateCallType(ctx context.Context, request *CreateCallTypeRequest) (*StreamResponse[CreateCallTypeResponse], error) {
var result CreateCallTypeResponse
res, err := MakeRequest[CreateCallTypeRequest, CreateCallTypeResponse](c.client, ctx, "POST", "/api/v2/video/calltypes", nil, request, &result, nil)
return res, err
}
func (c *VideoClient) DeleteCallType(ctx context.Context, name string, request *DeleteCallTypeRequest) (*StreamResponse[Response], error) {
var result Response
pathParams := map[string]string{
"name": name,
}
res, err := MakeRequest[any, Response](c.client, ctx, "DELETE", "/api/v2/video/calltypes/{name}", nil, nil, &result, pathParams)
return res, err
}
func (c *VideoClient) GetCallType(ctx context.Context, name string, request *GetCallTypeRequest) (*StreamResponse[GetCallTypeResponse], error) {
var result GetCallTypeResponse
pathParams := map[string]string{
"name": name,
}
res, err := MakeRequest[any, GetCallTypeResponse](c.client, ctx, "GET", "/api/v2/video/calltypes/{name}", nil, nil, &result, pathParams)
return res, err
}
func (c *VideoClient) UpdateCallType(ctx context.Context, name string, request *UpdateCallTypeRequest) (*StreamResponse[UpdateCallTypeResponse], error) {
var result UpdateCallTypeResponse
pathParams := map[string]string{
"name": name,
}
res, err := MakeRequest[UpdateCallTypeRequest, UpdateCallTypeResponse](c.client, ctx, "PUT", "/api/v2/video/calltypes/{name}", nil, request, &result, pathParams)
return res, err
}
// Returns the list of all edges available for video calls.
func (c *VideoClient) GetEdges(ctx context.Context, request *GetEdgesRequest) (*StreamResponse[GetEdgesResponse], error) {
var result GetEdgesResponse
res, err := MakeRequest[any, GetEdgesResponse](c.client, ctx, "GET", "/api/v2/video/edges", nil, nil, &result, nil)
return res, err
}