@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
@@ -1,129 +1,143 @@
1
- import { StreamChatClient } from './StreamChatClient';
2
- import { StreamVideoClient } from './StreamVideoClient';
3
- import {
4
- APIError,
5
- BanRequest,
6
- BlockUsersRequest,
7
- CheckPushRequest,
8
- CreateDeviceRequest,
9
- CreateGuestRequest,
10
- CreateRoleRequest,
11
- DeactivateUserRequest,
12
- DeactivateUsersRequest,
13
- DeleteDeviceRequest,
14
- DeletePushProviderRequest,
15
- DeleteRoleRequest,
16
- DeleteUsersRequest,
17
- ExportUserRequest,
18
- ExportUsersRequest,
19
- FlagRequest,
20
- GetBlockedUsersRequest,
21
- GetPermissionRequest,
22
- GetTaskRequest,
23
- ListDevicesRequest,
24
- MuteUserRequest,
25
- ProductchatApi,
26
- PushProvider,
27
- QueryBannedUsersRequest,
28
- QueryUsersPayload,
29
- ReactivateUserRequest,
30
- ReactivateUsersRequest,
31
- RestoreUsersRequest,
32
- UnbanRequest,
33
- UnblockUsersRequest,
34
- UnmuteUserRequest,
35
- UpdateAppRequest,
36
- UpdateUserPartialRequest,
37
- UpdateUsersRequest,
38
- UserCustomEventRequest,
39
- } from './gen/chat';
40
- import {
41
- Configuration,
42
- ErrorContext,
43
- FetchError,
44
- HTTPQuery,
45
- JSONApiResponse,
46
- RequestContext,
47
- ResponseContext,
48
- } from './gen/video';
49
- import { v4 as uuidv4 } from 'uuid';
50
1
  import { JWTServerToken, JWTUserToken } from './utils/create-token';
2
+ import { CommonApi } from './gen/common/CommonApi';
3
+ import { StreamVideoClient } from './StreamVideoClient';
51
4
  import crypto from 'crypto';
5
+ import { StreamChatClient } from './StreamChatClient';
52
6
  import { CallTokenPayload, UserTokenPayload } from './types';
7
+ import { QueryBannedUsersRequest, UserRequest } from './gen/models';
8
+ import { StreamModerationClient } from './StreamModerationClient';
53
9
 
54
10
  export interface StreamClientOptions {
55
11
  timeout?: number;
56
12
  basePath?: string;
57
13
  }
58
14
 
59
- export class StreamClient {
15
+ export class StreamClient extends CommonApi {
60
16
  public readonly video: StreamVideoClient;
61
17
  public readonly chat: StreamChatClient;
18
+ public readonly moderation: StreamModerationClient;
62
19
  public readonly options: StreamClientOptions = {};
63
- private readonly chatApi: ProductchatApi;
64
- private readonly token: string;
20
+
65
21
  private static readonly DEFAULT_TIMEOUT = 3000;
66
22
 
67
23
  /**
68
24
  *
69
25
  * @param apiKey
70
26
  * @param secret
71
- * @param config can be a string, which will be interpreted as base path (deprecated), or a config object
27
+ * @param config config object
72
28
  */
73
29
  constructor(
74
- private readonly apiKey: string,
30
+ readonly apiKey: string,
75
31
  private readonly secret: string,
76
- readonly config?: string | StreamClientOptions,
32
+ readonly config?: StreamClientOptions,
77
33
  ) {
78
- this.token = JWTServerToken(this.secret);
34
+ const token = JWTServerToken(secret);
35
+ const timeout = config?.timeout ?? StreamClient.DEFAULT_TIMEOUT;
36
+ const chatBaseUrl = config?.basePath ?? 'https://chat.stream-io-api.com';
37
+ const videoBaseUrl = config?.basePath ?? 'https://video.stream-io-api.com';
38
+ super({ apiKey, token, timeout, baseUrl: chatBaseUrl });
39
+
40
+ this.video = new StreamVideoClient({
41
+ apiKey,
42
+ token,
43
+ timeout,
44
+ baseUrl: videoBaseUrl,
45
+ });
46
+ this.chat = new StreamChatClient({
47
+ apiKey,
48
+ token,
49
+ timeout,
50
+ baseUrl: chatBaseUrl,
51
+ });
52
+ this.moderation = new StreamModerationClient({
53
+ apiKey,
54
+ token,
55
+ timeout,
56
+ baseUrl: chatBaseUrl,
57
+ });
58
+ }
79
59
 
80
- if (typeof config === 'string') {
81
- this.options.basePath = config;
82
- this.options.timeout = StreamClient.DEFAULT_TIMEOUT;
83
- } else {
84
- if (config) {
85
- this.options = config;
86
- }
87
- this.options.timeout = config?.timeout ?? StreamClient.DEFAULT_TIMEOUT;
88
- }
60
+ upsertUsers = (users: UserRequest[]) => {
61
+ const payload: Record<string, UserRequest> = {};
89
62
 
90
- this.video = new StreamVideoClient(this);
91
- this.chat = new StreamChatClient(this);
63
+ users.forEach((u) => {
64
+ payload[u.id] = u;
65
+ });
92
66
 
93
- const chatConfiguration = this.getConfiguration();
94
- /** @ts-expect-error */
95
- this.chatApi = new ProductchatApi(chatConfiguration);
96
- }
67
+ return this.updateUsers({ users: payload });
68
+ };
69
+
70
+ queryBannedUsers = (request?: { payload?: QueryBannedUsersRequest }) => {
71
+ return this.chat.queryBannedUsers(request);
72
+ };
73
+
74
+ /**
75
+ *
76
+ * @param payload
77
+ * - user_id - the id of the user the token is for
78
+ * - validity_in_seconds - how many seconds is the token valid for (starting from issued at), by default it's 1 hour, dicarded if exp is provided
79
+ * - exp - when the token expires, unix timestamp in seconds
80
+ * - iat - issued at date of the token, unix timestamp in seconds, by default it's now
81
+ */
82
+ generateUserToken = (
83
+ payload: {
84
+ user_id: string;
85
+ validity_in_seconds?: number;
86
+ exp?: number;
87
+ iat?: number;
88
+ } & Record<string, unknown>,
89
+ ) => {
90
+ const defaultIat = Math.floor((Date.now() - 1000) / 1000);
91
+ payload.iat = payload.iat ?? defaultIat;
92
+ const validityInSeconds = payload.validity_in_seconds ?? 60 * 60;
93
+ payload.exp = payload.exp ?? payload.iat + validityInSeconds;
94
+
95
+ return JWTUserToken(this.secret, payload as UserTokenPayload);
96
+ };
97
+
98
+ /**
99
+ *
100
+ * @param payload
101
+ * - user_id - the id of the user the token is for
102
+ * - validity_in_seconds - how many seconds is the token valid for (starting from issued at), by default it's 1 hour, dicarded if exp is provided
103
+ * - exp - when the token expires, unix timestamp in seconds
104
+ * - iat - issued at date of the token, unix timestamp in seconds, by default it's now
105
+ */
106
+ generateCallToken = (
107
+ payload: {
108
+ user_id: string;
109
+ role?: string;
110
+ call_cids: string[];
111
+ validity_in_seconds?: number;
112
+ exp?: number;
113
+ iat?: number;
114
+ } & Record<string, unknown>,
115
+ ) => {
116
+ return this.generateUserToken(payload);
117
+ };
97
118
 
98
119
  /**
99
120
  *
100
121
  * @param userID
101
122
  * @param exp
102
123
  * @param iat deprecated, the default date will be set internally
103
- * @param call_cids this parameter is deprecated use `createCallToken` for call tokens
104
124
  * @returns
125
+ *
126
+ * @deprecated use generateUserToken instead
105
127
  */
106
- createToken(
128
+ createToken = (
107
129
  userID: string,
108
130
  exp = Math.round(Date.now() / 1000) + 60 * 60,
109
131
  iat = Math.floor((Date.now() - 1000) / 1000),
110
- call_cids?: string[],
111
- ) {
132
+ ) => {
112
133
  const payload: UserTokenPayload = {
113
134
  user_id: userID,
114
135
  exp,
115
136
  iat,
116
137
  };
117
138
 
118
- if (call_cids) {
119
- console.warn(
120
- `Use createCallToken method for creating call tokens, the "call_cids" param will be removed from the createToken method with version 0.2.0`,
121
- );
122
- payload.call_cids = call_cids;
123
- }
124
-
125
139
  return JWTUserToken(this.secret, payload);
126
- }
140
+ };
127
141
 
128
142
  /**
129
143
  *
@@ -132,13 +146,15 @@ export class StreamClient {
132
146
  * @param exp
133
147
  * @param iat this is deprecated, the current date will be set internally
134
148
  * @returns
149
+ *
150
+ * @deprecated use generateCallToken instead
135
151
  */
136
- createCallToken(
152
+ createCallToken = (
137
153
  userIdOrObject: string | { user_id: string; role?: string },
138
154
  call_cids: string[],
139
155
  exp = Math.round(Date.now() / 1000) + 60 * 60,
140
156
  iat = Math.floor((Date.now() - 1000) / 1000),
141
- ) {
157
+ ) => {
142
158
  const payload: CallTokenPayload = {
143
159
  exp,
144
160
  iat,
@@ -154,163 +170,6 @@ export class StreamClient {
154
170
  }
155
171
 
156
172
  return JWTUserToken(this.secret, payload);
157
- }
158
-
159
- createDevice = (createDeviceRequest: CreateDeviceRequest) => {
160
- return this.chatApi.createDevice({ createDeviceRequest });
161
- };
162
-
163
- deleteDevice = (requestParameters: DeleteDeviceRequest) => {
164
- return this.chatApi.deleteDevice(requestParameters);
165
- };
166
-
167
- listDevices = (requestParameters: ListDevicesRequest) => {
168
- return this.chatApi.listDevices(requestParameters);
169
- };
170
-
171
- listPushProviders = () => {
172
- return this.chatApi.listPushProviders();
173
- };
174
-
175
- deletePushProvider = (request: DeletePushProviderRequest) => {
176
- return this.chatApi.deletePushProvider(request);
177
- };
178
-
179
- upsertPushProvider = (request: PushProvider) => {
180
- return this.chatApi.upsertPushProvider({
181
- upsertPushProviderRequest: { push_provider: request },
182
- });
183
- };
184
-
185
- checkPush = (checkPushRequest: CheckPushRequest) => {
186
- return this.chatApi.checkPush({ checkPushRequest });
187
- };
188
-
189
- createGuest = (createGuestRequest: CreateGuestRequest) => {
190
- return this.chatApi.createGuest({ createGuestRequest });
191
- };
192
-
193
- banUser = (banRequest: BanRequest) => {
194
- return this.chatApi.ban({ banRequest });
195
- };
196
-
197
- deactivateUser = (
198
- deactivateUserRequest: DeactivateUserRequest & { user_id: string },
199
- ) => {
200
- return this.chatApi.deactivateUser({
201
- deactivateUserRequest,
202
- userId: deactivateUserRequest.user_id,
203
- });
204
- };
205
-
206
- deactivateUsers = (deactivateUsersRequest: DeactivateUsersRequest) => {
207
- return this.chatApi.deactivateUsers({ deactivateUsersRequest });
208
- };
209
-
210
- deleteUsers = (deleteUsersRequest: DeleteUsersRequest) => {
211
- return this.chatApi.deleteUsers({ deleteUsersRequest });
212
- };
213
-
214
- exportUser = (request: ExportUserRequest) => {
215
- return this.chatApi.exportUser(request);
216
- };
217
-
218
- exportUsers = (exportUsersRequest: ExportUsersRequest) => {
219
- return this.chatApi.exportUsers({ exportUsersRequest });
220
- };
221
-
222
- flag = (flagRequest: FlagRequest) => {
223
- return this.chatApi.flag({ flagRequest });
224
- };
225
-
226
- queryBannedUsers = (payload: QueryBannedUsersRequest) => {
227
- return this.chatApi.queryBannedUsers({ payload });
228
- };
229
-
230
- queryUsers = (payload: QueryUsersPayload) => {
231
- return this.chatApi.queryUsers({ payload });
232
- };
233
-
234
- reactivateUser = (
235
- reactivateUserRequest: ReactivateUserRequest & { user_id: string },
236
- ) => {
237
- return this.chatApi.reactivateUser({
238
- reactivateUserRequest,
239
- userId: reactivateUserRequest.user_id,
240
- });
241
- };
242
-
243
- reactivateUsers = (reactivateUsersRequest: ReactivateUsersRequest) => {
244
- return this.chatApi.reactivateUsers({ reactivateUsersRequest });
245
- };
246
-
247
- restoreUsers = (restoreUsersRequest: RestoreUsersRequest) => {
248
- return this.chatApi.restoreUsers({ restoreUsersRequest });
249
- };
250
-
251
- unbanUser = (request: UnbanRequest) => {
252
- return this.chatApi.unban(request);
253
- };
254
-
255
- upsertUsers = (updateUsersRequest: UpdateUsersRequest) => {
256
- return this.chatApi.updateUsers({ updateUsersRequest });
257
- };
258
-
259
- updateUsersPartial = (request: { users: UpdateUserPartialRequest[] }) => {
260
- return this.chatApi.updateUsersPartial({
261
- updateUsersPartialRequest: request,
262
- });
263
- };
264
-
265
- muteUser = (muteUserRequest: MuteUserRequest) => {
266
- return this.chatApi.muteUser({ muteUserRequest });
267
- };
268
-
269
- unmuteUser = (unmuteUserRequest: UnmuteUserRequest) => {
270
- return this.chatApi.unmuteUser({ unmuteUserRequest });
271
- };
272
-
273
- sendCustomEventToUser = (userId: string, event: UserCustomEventRequest) => {
274
- return this.chatApi.sendUserCustomEvent({
275
- userId,
276
- sendUserCustomEventRequest: { event },
277
- });
278
- };
279
-
280
- createRole = (createRoleRequest: CreateRoleRequest) => {
281
- return this.chatApi.createRole({ createRoleRequest });
282
- };
283
-
284
- deleteRole = (request: DeleteRoleRequest) => {
285
- return this.chatApi.deleteRole(request);
286
- };
287
-
288
- getPermission = (request: GetPermissionRequest) => {
289
- return this.chatApi.getPermission(request);
290
- };
291
-
292
- listPermissions = () => {
293
- return this.chatApi.listPermissions();
294
- };
295
-
296
- listRoles = () => {
297
- return this.chatApi.listRoles();
298
- };
299
-
300
- getAppSettings = () => {
301
- return this.chatApi.getApp();
302
- };
303
-
304
- updateAppSettings = (updateAppRequest: UpdateAppRequest) => {
305
- return this.chatApi.updateApp({ updateAppRequest });
306
- };
307
-
308
- getRateLimits = () => {
309
- return this.chatApi.getRateLimits();
310
- };
311
-
312
- getTaskStatus = (request: GetTaskRequest) => {
313
- return this.chatApi.getTask(request);
314
173
  };
315
174
 
316
175
  verifyWebhook = (requestBody: string | Buffer, xSignature: string) => {
@@ -326,107 +185,4 @@ export class StreamClient {
326
185
  return false;
327
186
  }
328
187
  };
329
-
330
- blockUsers = (blockUsersRequest: BlockUsersRequest) => {
331
- return this.chatApi.blockUsers({ blockUsersRequest });
332
- };
333
-
334
- unblockUsers = (unblockUsersRequest: UnblockUsersRequest) => {
335
- return this.chatApi.unblockUsers({ unblockUsersRequest });
336
- };
337
-
338
- getBlockedUsers = (request: GetBlockedUsersRequest) => {
339
- return this.chatApi.getBlockedUsers(request);
340
- };
341
-
342
- getConfiguration = (product: 'chat' | 'video' = 'chat') => {
343
- return new Configuration({
344
- apiKey: (name: string) => {
345
- const mapping: Record<string, string> = {
346
- 'Stream-Auth-Type': 'jwt',
347
- api_key: this.apiKey,
348
- Authorization: this.token,
349
- };
350
-
351
- return mapping[name];
352
- },
353
- basePath:
354
- this.options.basePath ??
355
- (product === 'chat'
356
- ? 'https://chat.stream-io-api.com'
357
- : 'https://video.stream-io-api.com'),
358
- headers: {
359
- 'X-Stream-Client': 'stream-node-' + process.env.PKG_VERSION,
360
- },
361
- middleware: [
362
- {
363
- pre: (context: RequestContext) => {
364
- context.init.headers = {
365
- ...context.init.headers,
366
- 'x-client-request-id': uuidv4(),
367
- 'Accept-Encoding': 'gzip',
368
- };
369
-
370
- return Promise.resolve(context);
371
- },
372
- },
373
- {
374
- // This should be the last post middleware because that will throw an error
375
- // The Fetch API won't throw an error for HTTP error responses, which means the "onError" middleware won't be called so we need to throw error from "post" middleware
376
- post: async (context: ResponseContext) => {
377
- if (
378
- (context.response && context.response.status < 200) ||
379
- context.response.status >= 300
380
- ) {
381
- const response = new JSONApiResponse(context.response);
382
- const value = (await response.value()) as APIError;
383
- throw new Error(
384
- `Stream error code ${value.code}: ${value.message}`,
385
- );
386
- }
387
- },
388
- },
389
- {
390
- pre: (context: RequestContext) => {
391
- context.init.signal = AbortSignal.timeout(this.options.timeout!);
392
-
393
- return Promise.resolve(context);
394
- },
395
- onError: (context: ErrorContext) => {
396
- const error = context.error as DOMException;
397
- if (error.name === 'AbortError' || error.name === 'TimeoutError') {
398
- throw new FetchError(
399
- error,
400
- `The request was aborted due to to the ${this.options.timeout}ms timeout, you can set the timeout in the StreamClient constructor`,
401
- );
402
- }
403
-
404
- return Promise.resolve(context.response);
405
- },
406
- },
407
- ],
408
- // https://github.com/OpenAPITools/openapi-generator/issues/13222
409
- queryParamsStringify: (params: HTTPQuery) => {
410
- const newParams = [];
411
- for (const k in params) {
412
- const param = params[k];
413
- if (Array.isArray(param)) {
414
- newParams.push(`${k}=${encodeURIComponent(param.join(','))}`);
415
- } else if (typeof param === 'object') {
416
- newParams.push(`${k}=${encodeURIComponent(JSON.stringify(param))}`);
417
- } else {
418
- if (
419
- typeof param === 'string' ||
420
- typeof param === 'number' ||
421
- typeof param === 'boolean'
422
- ) {
423
- newParams.push(`${k}=${encodeURIComponent(param)}`);
424
- }
425
- }
426
- }
427
-
428
- return newParams.join('&');
429
- },
430
- });
431
- };
432
188
  }
@@ -0,0 +1,3 @@
1
+ import { ModerationApi } from './gen/moderation/ModerationApi';
2
+
3
+ export class StreamModerationClient extends ModerationApi {}
@@ -1,100 +1,8 @@
1
+ import { VideoApi } from './gen/video/VideoApi';
1
2
  import { StreamCall } from './StreamCall';
2
- import { StreamClient } from './StreamClient';
3
- import {
4
- CheckExternalStorageRequest,
5
- DeleteCallTypeRequest,
6
- DeleteExternalStorageRequest,
7
- GetCallTypeRequest,
8
- ProductvideoApi,
9
- VideoCreateCallTypeRequest,
10
- VideoCreateExternalStorageRequest,
11
- VideoQueryCallStatsRequest,
12
- VideoQueryCallsRequest,
13
- VideoUpdateCallTypeRequest,
14
- VideoUpdateExternalStorageRequest,
15
- } from './gen/video';
16
-
17
- export class StreamVideoClient {
18
- private readonly apiClient: ProductvideoApi;
19
-
20
- constructor(private readonly streamClient: StreamClient) {
21
- const configuration = this.streamClient.getConfiguration('video');
22
- this.apiClient = new ProductvideoApi(configuration);
23
- }
24
3
 
4
+ export class StreamVideoClient extends VideoApi {
25
5
  call = (type: string, id: string) => {
26
- return new StreamCall(this.streamClient, type, id);
27
- };
28
-
29
- queryCalls = (request?: VideoQueryCallsRequest) => {
30
- return this.apiClient.queryCalls({
31
- videoQueryCallsRequest: request ?? {},
32
- });
33
- };
34
-
35
- queryCallStatistics = (
36
- videoQueryCallStatsRequest?: VideoQueryCallStatsRequest,
37
- ) => {
38
- return this.apiClient.queryCallStats({
39
- videoQueryCallStatsRequest: videoQueryCallStatsRequest ?? {},
40
- });
41
- };
42
-
43
- createCallType = (videoCreateCallTypeRequest: VideoCreateCallTypeRequest) => {
44
- return this.apiClient.createCallType({
45
- videoCreateCallTypeRequest,
46
- });
47
- };
48
-
49
- deleteCallType = (request: DeleteCallTypeRequest) => {
50
- return this.apiClient.deleteCallType(request);
51
- };
52
-
53
- getCallType = (request: GetCallTypeRequest) => {
54
- return this.apiClient.getCallType(request);
55
- };
56
-
57
- listCallTypes = () => {
58
- return this.apiClient.listCallTypes();
59
- };
60
-
61
- updateCallType = (
62
- name: string,
63
- videoUpdateCallTypeRequest: VideoUpdateCallTypeRequest,
64
- ) => {
65
- return this.apiClient.updateCallType({
66
- name,
67
- videoUpdateCallTypeRequest,
68
- });
69
- };
70
-
71
- listExternalStorages = () => {
72
- return this.apiClient.listExternalStorage();
73
- };
74
-
75
- createExternalStorage = (
76
- videoCreateExternalStorageRequest: VideoCreateExternalStorageRequest,
77
- ) => {
78
- return this.apiClient.createExternalStorage({
79
- videoCreateExternalStorageRequest,
80
- });
81
- };
82
-
83
- deleteExternalStorage = (request: DeleteExternalStorageRequest) => {
84
- return this.apiClient.deleteExternalStorage(request);
85
- };
86
-
87
- updateExternalStorage = (
88
- name: string,
89
- videoUpdateExternalStorageRequest: VideoUpdateExternalStorageRequest,
90
- ) => {
91
- return this.apiClient.updateExternalStorage({
92
- name,
93
- videoUpdateExternalStorageRequest,
94
- });
95
- };
96
-
97
- checkExternalStorage = (request: CheckExternalStorageRequest) => {
98
- return this.apiClient.checkExternalStorage(request);
6
+ return new StreamCall(this, type, id);
99
7
  };
100
8
  }