Skip to content

Commit 5e02b9b

Browse files
authored
fix: custom event signature (#32)
1 parent 7673fa3 commit 5e02b9b

File tree

5 files changed

+115
-18
lines changed

5 files changed

+115
-18
lines changed

__tests__/call.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ describe('call API', () => {
4949
expect(response.call.custom.color).toBe('blue');
5050
});
5151

52+
it('send custom event', async () => {
53+
const response = await call.sendCustomEvent({
54+
custom: {
55+
'render-animation': 'balloons',
56+
},
57+
user_id: 'john',
58+
});
59+
60+
expect(response.duration).toBeDefined();
61+
});
62+
5263
it('update', async () => {
5364
const response = await call.update({
5465
settings_override: {

src/StreamCall.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
VideoMuteUsersRequest,
1111
VideoPinRequest,
1212
VideoQueryCallMembersRequest,
13+
VideoSendCallEventRequest,
1314
VideoStartRecordingRequest,
1415
VideoStartTranscriptionRequest,
1516
VideoUnblockUserRequest,
@@ -96,9 +97,9 @@ export class StreamCall {
9697
});
9798
};
9899

99-
sendCustomEvent = (event: Record<string, any>) => {
100+
sendCustomEvent = (videoSendCallEventRequest: VideoSendCallEventRequest) => {
100101
return this.apiClient.sendCallEvent({
101-
videoSendEventRequest: { custom: event },
102+
videoSendCallEventRequest,
102103
...this.baseRequest,
103104
});
104105
};

src/gen/video/apis/ProductvideoApi.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Stream API
55
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
66
*
7-
* The version of the OpenAPI document: v113.0.0
7+
* The version of the OpenAPI document: v113.1.0
88
*
99
*
1010
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -56,8 +56,8 @@ import type {
5656
VideoQueryCallsRequest,
5757
VideoQueryCallsResponse,
5858
VideoResponse,
59-
VideoSendEventRequest,
60-
VideoSendEventResponse,
59+
VideoSendCallEventRequest,
60+
VideoSendCallEventResponse,
6161
VideoStartHLSBroadcastingResponse,
6262
VideoStartRecordingRequest,
6363
VideoStartRecordingResponse,
@@ -213,7 +213,7 @@ export interface QueryCallsRequest {
213213
export interface SendCallEventRequest {
214214
type: string;
215215
id: string;
216-
videoSendEventRequest: VideoSendEventRequest | null;
216+
videoSendCallEventRequest: VideoSendCallEventRequest | null;
217217
}
218218

219219
export interface StartHLSBroadcastingRequest {
@@ -1676,7 +1676,7 @@ export class ProductvideoApi extends runtime.BaseAPI {
16761676
* Sends custom event to the call Sends events: - custom Required permissions: - SendEvent
16771677
* Send custom event
16781678
*/
1679-
async sendCallEventRaw(requestParameters: SendCallEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VideoSendEventResponse>> {
1679+
async sendCallEventRaw(requestParameters: SendCallEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VideoSendCallEventResponse>> {
16801680
if (requestParameters.type === null || requestParameters.type === undefined) {
16811681
throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling sendCallEvent.');
16821682
}
@@ -1685,8 +1685,8 @@ export class ProductvideoApi extends runtime.BaseAPI {
16851685
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling sendCallEvent.');
16861686
}
16871687

1688-
if (requestParameters.videoSendEventRequest === null || requestParameters.videoSendEventRequest === undefined) {
1689-
throw new runtime.RequiredError('videoSendEventRequest','Required parameter requestParameters.videoSendEventRequest was null or undefined when calling sendCallEvent.');
1688+
if (requestParameters.videoSendCallEventRequest === null || requestParameters.videoSendCallEventRequest === undefined) {
1689+
throw new runtime.RequiredError('videoSendCallEventRequest','Required parameter requestParameters.videoSendCallEventRequest was null or undefined when calling sendCallEvent.');
16901690
}
16911691

16921692
const queryParameters: any = {};
@@ -1712,7 +1712,7 @@ export class ProductvideoApi extends runtime.BaseAPI {
17121712
method: 'POST',
17131713
headers: headerParameters,
17141714
query: queryParameters,
1715-
body: requestParameters.videoSendEventRequest,
1715+
body: requestParameters.videoSendCallEventRequest,
17161716
}, initOverrides);
17171717

17181718
return new runtime.JSONApiResponse(response);
@@ -1722,7 +1722,7 @@ export class ProductvideoApi extends runtime.BaseAPI {
17221722
* Sends custom event to the call Sends events: - custom Required permissions: - SendEvent
17231723
* Send custom event
17241724
*/
1725-
async sendCallEvent(requestParameters: SendCallEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VideoSendEventResponse> {
1725+
async sendCallEvent(requestParameters: SendCallEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VideoSendCallEventResponse> {
17261726
const response = await this.sendCallEventRaw(requestParameters, initOverrides);
17271727
return await response.value();
17281728
}

src/gen/video/models/index.ts

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,12 @@ export interface VideoGetCallStatsResponse {
17311731
* @memberof VideoGetCallStatsResponse
17321732
*/
17331733
call_duration_seconds: number;
1734+
/**
1735+
*
1736+
* @type {string}
1737+
* @memberof VideoGetCallStatsResponse
1738+
*/
1739+
call_status: string;
17341740
/**
17351741
*
17361742
* @type {VideoCallTimeline}
@@ -2663,6 +2669,31 @@ export interface VideoPrivacySettings {
26632669
*/
26642670
typing_indicators?: VideoTypingIndicators;
26652671
}
2672+
/**
2673+
*
2674+
* @export
2675+
* @interface VideoPublishedTrackInfo
2676+
*/
2677+
export interface VideoPublishedTrackInfo {
2678+
/**
2679+
*
2680+
* @type {string}
2681+
* @memberof VideoPublishedTrackInfo
2682+
*/
2683+
codec_mime_type?: string;
2684+
/**
2685+
*
2686+
* @type {number}
2687+
* @memberof VideoPublishedTrackInfo
2688+
*/
2689+
duration_seconds?: number;
2690+
/**
2691+
*
2692+
* @type {string}
2693+
* @memberof VideoPublishedTrackInfo
2694+
*/
2695+
track_type?: string;
2696+
}
26662697
/**
26672698
*
26682699
* @export
@@ -3189,26 +3220,38 @@ export interface VideoScreensharingSettingsResponse {
31893220
/**
31903221
*
31913222
* @export
3192-
* @interface VideoSendEventRequest
3223+
* @interface VideoSendCallEventRequest
31933224
*/
3194-
export interface VideoSendEventRequest {
3225+
export interface VideoSendCallEventRequest {
31953226
/**
31963227
*
31973228
* @type {{ [key: string]: any; }}
3198-
* @memberof VideoSendEventRequest
3229+
* @memberof VideoSendCallEventRequest
31993230
*/
32003231
custom?: { [key: string]: any; };
3232+
/**
3233+
*
3234+
* @type {VideoUserRequest}
3235+
* @memberof VideoSendCallEventRequest
3236+
*/
3237+
user?: VideoUserRequest;
3238+
/**
3239+
*
3240+
* @type {string}
3241+
* @memberof VideoSendCallEventRequest
3242+
*/
3243+
user_id?: string;
32013244
}
32023245
/**
32033246
*
32043247
* @export
3205-
* @interface VideoSendEventResponse
3248+
* @interface VideoSendCallEventResponse
32063249
*/
3207-
export interface VideoSendEventResponse {
3250+
export interface VideoSendCallEventResponse {
32083251
/**
32093252
*
32103253
* @type {string}
3211-
* @memberof VideoSendEventResponse
3254+
* @memberof VideoSendCallEventResponse
32123255
*/
32133256
duration: string;
32143257
}
@@ -4280,6 +4323,12 @@ export interface VideoUserSessionStats {
42804323
* @memberof VideoUserSessionStats
42814324
*/
42824325
pub_sub_hints?: VideoMediaPubSubHint;
4326+
/**
4327+
*
4328+
* @type {Array<VideoPublishedTrackInfo>}
4329+
* @memberof VideoUserSessionStats
4330+
*/
4331+
published_tracks?: Array<VideoPublishedTrackInfo>;
42834332
/**
42844333
*
42854334
* @type {VideoMOSStats}
@@ -4298,12 +4347,24 @@ export interface VideoUserSessionStats {
42984347
* @memberof VideoUserSessionStats
42994348
*/
43004349
publisher_latency?: VideoStats;
4350+
/**
4351+
*
4352+
* @type {number}
4353+
* @memberof VideoUserSessionStats
4354+
*/
4355+
publisher_noise_cancellation_seconds?: number;
43014356
/**
43024357
*
43034358
* @type {number}
43044359
* @memberof VideoUserSessionStats
43054360
*/
43064361
publisher_packet_loss_fraction: number;
4362+
/**
4363+
*
4364+
* @type {number}
4365+
* @memberof VideoUserSessionStats
4366+
*/
4367+
publisher_quality_limitation_fraction?: number;
43074368
/**
43084369
*
43094370
* @type {{ [key: string]: number; }}
@@ -4322,6 +4383,12 @@ export interface VideoUserSessionStats {
43224383
* @memberof VideoUserSessionStats
43234384
*/
43244385
publishing_duration_seconds: number;
4386+
/**
4387+
*
4388+
* @type {string}
4389+
* @memberof VideoUserSessionStats
4390+
*/
4391+
publishing_video_codec?: string;
43254392
/**
43264393
*
43274394
* @type {number}
@@ -4340,6 +4407,12 @@ export interface VideoUserSessionStats {
43404407
* @memberof VideoUserSessionStats
43414408
*/
43424409
receiving_duration_seconds: number;
4410+
/**
4411+
*
4412+
* @type {string}
4413+
* @memberof VideoUserSessionStats
4414+
*/
4415+
receiving_video_codec?: string;
43434416
/**
43444417
*
43454418
* @type {string}
@@ -4376,6 +4449,12 @@ export interface VideoUserSessionStats {
43764449
* @memberof VideoUserSessionStats
43774450
*/
43784451
subscriber_latency?: VideoStats;
4452+
/**
4453+
*
4454+
* @type {number}
4455+
* @memberof VideoUserSessionStats
4456+
*/
4457+
subscriber_video_quality_throttled_duration_seconds?: number;
43794458
/**
43804459
*
43814460
* @type {Array<VideoSubsession>}
@@ -4419,6 +4498,12 @@ export interface VideoUserStats {
44194498
* @memberof VideoUserStats
44204499
*/
44214500
info: VideoUserInfoResponse;
4501+
/**
4502+
*
4503+
* @type {number}
4504+
* @memberof VideoUserStats
4505+
*/
4506+
rating?: number;
44224507
/**
44234508
*
44244509
* @type {Array<VideoUserSessionStats>}

src/gen/video/runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Stream API
55
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
66
*
7-
* The version of the OpenAPI document: v113.0.0
7+
* The version of the OpenAPI document: v113.1.0
88
*
99
*
1010
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

0 commit comments

Comments
 (0)