Skip to content

Commit cc0d00d

Browse files
authored
feat!: upgrade to API v113.0.0 (#28)
1 parent cf29cfe commit cc0d00d

File tree

12 files changed

+2335
-1100
lines changed

12 files changed

+2335
-1100
lines changed

__tests__/call-types.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { v4 as uuidv4 } from 'uuid';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55
import {
6+
VideoLayoutSettingsRequestNameEnum,
67
VideoOwnCapability,
78
VideoRecordSettingsRequestModeEnum,
89
VideoRecordSettingsRequestQualityEnum,
9-
VideoLayoutSettingsNameEnum,
1010
} from '../src/gen/video';
1111

1212
describe('call types CRUD API', () => {
@@ -64,14 +64,14 @@ describe('call types CRUD API', () => {
6464
);
6565
expect(createResponse.settings.screensharing.enabled).toBe(true);
6666
expect(createResponse.notification_settings.enabled).toBe(true);
67-
expect(createResponse.notification_settings.session_started.enabled).toBe(
67+
expect(createResponse.notification_settings.session_started?.enabled).toBe(
6868
false,
6969
);
70-
expect(createResponse.notification_settings.call_notification.enabled).toBe(
71-
true,
72-
);
7370
expect(
74-
createResponse.notification_settings.call_notification.apns.title,
71+
createResponse.notification_settings.call_notification?.enabled,
72+
).toBe(true);
73+
expect(
74+
createResponse.notification_settings.call_notification?.apns?.title,
7575
).toBe('{{ user.display_name }} invites you to a call');
7676
});
7777

@@ -151,15 +151,15 @@ describe('call types CRUD API', () => {
151151
audio_only: false,
152152
quality: VideoRecordSettingsRequestQualityEnum._1080P,
153153
layout: {
154-
name: VideoLayoutSettingsNameEnum.SPOTLIGHT,
154+
name: VideoLayoutSettingsRequestNameEnum.SPOTLIGHT,
155155
options: layoutOptions,
156156
},
157157
},
158158
},
159159
});
160160

161161
expect(response.settings.recording.layout.name).toBe(
162-
VideoLayoutSettingsNameEnum.SPOTLIGHT,
162+
VideoLayoutSettingsRequestNameEnum.SPOTLIGHT,
163163
);
164164
Object.keys(layoutOptions).forEach((key) => {
165165
expect(response.settings.recording.layout.options![key]).toEqual(

__tests__/teams.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('teams', () => {
3232
[user.id]: { ...user },
3333
},
3434
});
35+
await client.updateAppSettings({ multi_tenant_enabled: true });
3536
call = client.video.call('default', callId);
3637
});
3738

__tests__/users.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ describe('user API', () => {
7878
});
7979

8080
it('create guest', async () => {
81+
await client.updateAppSettings({ multi_tenant_enabled: false });
82+
8183
const guest: UserObjectRequest = {
8284
id: uuidv4(),
8385
custom: {
@@ -89,6 +91,8 @@ describe('user API', () => {
8991

9092
expect(response.user?.role).toBe('guest');
9193
expect(response.user?.custom.color).toBe('red');
94+
95+
await client.updateAppSettings({ multi_tenant_enabled: true });
9296
});
9397

9498
it('ban and unban', async () => {

src/StreamCall.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { StreamClient } from './StreamClient';
22
import {
3-
DefaultApi,
43
GetCallRequest,
4+
ProductvideoApi,
55
VideoBlockUserRequest,
66
VideoGetOrCreateCallRequest,
77
VideoGoLiveRequest,
88
VideoMuteUsersRequest,
99
VideoPinRequest,
10-
VideoQueryMembersRequest,
10+
VideoQueryCallMembersRequest,
1111
VideoStartRecordingRequest,
1212
VideoStartTranscriptionRequest,
1313
VideoUnblockUserRequest,
@@ -20,7 +20,7 @@ import { OmitTypeId } from './types';
2020

2121
export class StreamCall {
2222
private readonly baseRequest: { type: string; id: string };
23-
private readonly apiClient: DefaultApi;
23+
private readonly apiClient: ProductvideoApi;
2424

2525
constructor(
2626
private readonly streamClient: StreamClient,
@@ -29,7 +29,7 @@ export class StreamCall {
2929
) {
3030
this.baseRequest = { id: this.id, type: this.type };
3131
const configuration = this.streamClient.getConfiguration('video');
32-
this.apiClient = new DefaultApi(configuration);
32+
this.apiClient = new ProductvideoApi(configuration);
3333
}
3434

3535
blockUser = (videoBlockUserRequest: VideoBlockUserRequest) => {
@@ -84,14 +84,14 @@ export class StreamCall {
8484
});
8585
};
8686

87-
queryMembers = (request?: OmitTypeId<VideoQueryMembersRequest>) => {
88-
return this.apiClient.queryMembers({
89-
videoQueryMembersRequest: { ...(request ?? {}), ...this.baseRequest },
87+
queryMembers = (request?: OmitTypeId<VideoQueryCallMembersRequest>) => {
88+
return this.apiClient.queryCallMembers({
89+
videoQueryCallMembersRequest: { ...(request ?? {}), ...this.baseRequest },
9090
});
9191
};
9292

9393
sendCustomEvent = (event: Record<string, any>) => {
94-
return this.apiClient.sendEvent({
94+
return this.apiClient.sendCallEvent({
9595
videoSendEventRequest: { custom: event },
9696
...this.baseRequest,
9797
});

src/StreamVideoClient.ts

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { StreamCall } from './StreamCall';
22
import { StreamClient } from './StreamClient';
33
import {
44
CheckExternalStorageRequest,
5-
DefaultApi,
65
DeleteCallTypeRequest,
76
DeleteExternalStorageRequest,
87
GetCallTypeRequest,
9-
ServerSideApi,
10-
SettingsApi,
8+
ProductvideoApi,
119
VideoCreateCallTypeRequest,
1210
VideoCreateExternalStorageRequest,
1311
VideoQueryCallsRequest,
@@ -16,15 +14,11 @@ import {
1614
} from './gen/video';
1715

1816
export class StreamVideoClient {
19-
private readonly apiClient: DefaultApi;
20-
private readonly videoServerSideApiClient: ServerSideApi;
21-
private readonly settingsApi: SettingsApi;
17+
private readonly apiClient: ProductvideoApi;
2218

2319
constructor(private readonly streamClient: StreamClient) {
2420
const configuration = this.streamClient.getConfiguration('video');
25-
this.apiClient = new DefaultApi(configuration);
26-
this.settingsApi = new SettingsApi(configuration);
27-
this.videoServerSideApiClient = new ServerSideApi(configuration);
21+
this.apiClient = new ProductvideoApi(configuration);
2822
}
2923

3024
call = (type: string, id: string) => {
@@ -38,60 +32,60 @@ export class StreamVideoClient {
3832
};
3933

4034
createCallType = (videoCreateCallTypeRequest: VideoCreateCallTypeRequest) => {
41-
return this.videoServerSideApiClient.createCallType({
35+
return this.apiClient.createCallType({
4236
videoCreateCallTypeRequest,
4337
});
4438
};
4539

4640
deleteCallType = (request: DeleteCallTypeRequest) => {
47-
return this.videoServerSideApiClient.deleteCallType(request);
41+
return this.apiClient.deleteCallType(request);
4842
};
4943

5044
getCallType = (request: GetCallTypeRequest) => {
51-
return this.videoServerSideApiClient.getCallType(request);
45+
return this.apiClient.getCallType(request);
5246
};
5347

5448
listCallTypes = () => {
55-
return this.videoServerSideApiClient.listCallTypes();
49+
return this.apiClient.listCallTypes();
5650
};
5751

5852
updateCallType = (
5953
name: string,
6054
videoUpdateCallTypeRequest: VideoUpdateCallTypeRequest,
6155
) => {
62-
return this.videoServerSideApiClient.updateCallType({
56+
return this.apiClient.updateCallType({
6357
name,
6458
videoUpdateCallTypeRequest,
6559
});
6660
};
6761

6862
listExternalStorages = () => {
69-
return this.settingsApi.listExternalStorage();
63+
return this.apiClient.listExternalStorage();
7064
};
7165

7266
createExternalStorage = (
7367
videoCreateExternalStorageRequest: VideoCreateExternalStorageRequest,
7468
) => {
75-
return this.settingsApi.createExternalStorage({
69+
return this.apiClient.createExternalStorage({
7670
videoCreateExternalStorageRequest,
7771
});
7872
};
7973

8074
deleteExternalStorage = (request: DeleteExternalStorageRequest) => {
81-
return this.settingsApi.deleteExternalStorage(request);
75+
return this.apiClient.deleteExternalStorage(request);
8276
};
8377

8478
updateExternalStorage = (
8579
name: string,
8680
videoUpdateExternalStorageRequest: VideoUpdateExternalStorageRequest,
8781
) => {
88-
return this.videoServerSideApiClient.updateExternalStorage({
82+
return this.apiClient.updateExternalStorage({
8983
name,
9084
videoUpdateExternalStorageRequest,
9185
});
9286
};
9387

9488
checkExternalStorage = (request: CheckExternalStorageRequest) => {
95-
return this.videoServerSideApiClient.checkExternalStorage(request);
89+
return this.apiClient.checkExternalStorage(request);
9690
};
9791
}

src/gen/video/.openapi-generator/FILES

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.openapi-generator-ignore
2-
apis/DefaultApi.ts
3-
apis/ServerSideApi.ts
4-
apis/SettingsApi.ts
2+
apis/ProductvideoApi.ts
53
apis/index.ts
64
index.ts
75
models/index.ts

0 commit comments

Comments
 (0)