@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.
- package/dist/index.cjs.js +4136 -9282
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.es.js +4136 -9206
- package/dist/index.es.js.map +1 -1
- package/dist/src/BaseApi.d.ts +10 -0
- package/dist/src/StreamCall.d.ts +5 -37
- package/dist/src/StreamChannel.d.ts +7 -34
- package/dist/src/StreamChatClient.d.ts +2 -25
- package/dist/src/StreamClient.d.ts +51 -59
- package/dist/src/StreamModerationClient.d.ts +3 -0
- package/dist/src/StreamVideoClient.d.ts +2 -18
- package/dist/src/gen/chat/ChannelApi.d.ts +33 -0
- package/dist/src/gen/chat/ChatApi.d.ts +241 -0
- package/dist/src/gen/common/CommonApi.d.ts +99 -0
- package/dist/src/gen/model-decoders/index.d.ts +3 -0
- package/dist/src/gen/models/index.d.ts +3881 -0
- package/dist/src/gen/moderation/ModerationApi.d.ts +38 -0
- package/dist/src/gen/video/CallApi.d.ts +56 -0
- package/dist/src/gen/video/VideoApi.d.ts +151 -0
- package/dist/src/types.d.ts +25 -0
- package/dist/src/utils/create-token.d.ts +2 -0
- package/dist/src/utils/rate-limit.d.ts +2 -0
- package/index.ts +2 -3
- package/package.json +5 -4
- package/src/BaseApi.ts +115 -0
- package/src/StreamCall.ts +9 -199
- package/src/StreamChannel.ts +23 -246
- package/src/StreamChatClient.ts +3 -122
- package/src/StreamClient.ts +101 -345
- package/src/StreamModerationClient.ts +3 -0
- package/src/StreamVideoClient.ts +3 -95
- package/src/gen/chat/ChannelApi.ts +270 -0
- package/src/gen/chat/ChatApi.ts +1857 -0
- package/src/gen/common/CommonApi.ts +1004 -0
- package/src/gen/model-decoders/index.ts +1897 -0
- package/src/gen/models/index.ts +6794 -0
- package/src/gen/moderation/ModerationApi.ts +476 -0
- package/src/gen/video/CallApi.ts +309 -0
- package/src/gen/video/VideoApi.ts +1007 -0
- package/src/types.ts +35 -0
- package/src/utils/create-token.ts +6 -1
- package/src/utils/rate-limit.ts +21 -0
- package/dist/src/gen/chat/apis/ProductchatApi.d.ts +0 -1750
- package/dist/src/gen/chat/apis/index.d.ts +0 -1
- package/dist/src/gen/chat/index.d.ts +0 -3
- package/dist/src/gen/chat/models/index.d.ts +0 -14865
- package/dist/src/gen/chat/runtime.d.ts +0 -180
- package/dist/src/gen/video/apis/ProductvideoApi.d.ts +0 -648
- package/dist/src/gen/video/apis/index.d.ts +0 -1
- package/dist/src/gen/video/index.d.ts +0 -3
- package/dist/src/gen/video/models/index.d.ts +0 -5011
- package/dist/src/gen/video/runtime.d.ts +0 -180
- package/src/gen/chat/.openapi-generator/FILES +0 -6
- package/src/gen/chat/.openapi-generator/VERSION +0 -1
- package/src/gen/chat/.openapi-generator-ignore +0 -23
- package/src/gen/chat/apis/ProductchatApi.ts +0 -7007
- package/src/gen/chat/apis/index.ts +0 -3
- package/src/gen/chat/index.ts +0 -5
- package/src/gen/chat/models/index.ts +0 -14766
- package/src/gen/chat/runtime.ts +0 -415
- package/src/gen/video/.openapi-generator/FILES +0 -6
- package/src/gen/video/.openapi-generator/VERSION +0 -1
- package/src/gen/video/.openapi-generator-ignore +0 -23
- package/src/gen/video/apis/ProductvideoApi.ts +0 -2575
- package/src/gen/video/apis/index.ts +0 -3
- package/src/gen/video/index.ts +0 -5
- package/src/gen/video/models/index.ts +0 -5000
- package/src/gen/video/runtime.ts +0 -415
|
@@ -0,0 +1,1004 @@
|
|
|
1
|
+
import { BaseApi } from '../../BaseApi';
|
|
2
|
+
import { StreamResponse } from '../../types';
|
|
3
|
+
import {
|
|
4
|
+
BlockUsersRequest,
|
|
5
|
+
BlockUsersResponse,
|
|
6
|
+
CheckExternalStorageResponse,
|
|
7
|
+
CheckPushRequest,
|
|
8
|
+
CheckPushResponse,
|
|
9
|
+
CheckSNSRequest,
|
|
10
|
+
CheckSNSResponse,
|
|
11
|
+
CheckSQSRequest,
|
|
12
|
+
CheckSQSResponse,
|
|
13
|
+
CreateBlockListRequest,
|
|
14
|
+
CreateDeviceRequest,
|
|
15
|
+
CreateExternalStorageRequest,
|
|
16
|
+
CreateExternalStorageResponse,
|
|
17
|
+
CreateGuestRequest,
|
|
18
|
+
CreateGuestResponse,
|
|
19
|
+
CreateImportRequest,
|
|
20
|
+
CreateImportResponse,
|
|
21
|
+
CreateImportURLRequest,
|
|
22
|
+
CreateImportURLResponse,
|
|
23
|
+
CreateRoleRequest,
|
|
24
|
+
CreateRoleResponse,
|
|
25
|
+
DeactivateUserRequest,
|
|
26
|
+
DeactivateUserResponse,
|
|
27
|
+
DeactivateUsersRequest,
|
|
28
|
+
DeactivateUsersResponse,
|
|
29
|
+
DeleteExternalStorageResponse,
|
|
30
|
+
DeleteUsersRequest,
|
|
31
|
+
DeleteUsersResponse,
|
|
32
|
+
ExportUserResponse,
|
|
33
|
+
ExportUsersRequest,
|
|
34
|
+
ExportUsersResponse,
|
|
35
|
+
GetApplicationResponse,
|
|
36
|
+
GetBlockListResponse,
|
|
37
|
+
GetBlockedUsersResponse,
|
|
38
|
+
GetCustomPermissionResponse,
|
|
39
|
+
GetImportResponse,
|
|
40
|
+
GetOGResponse,
|
|
41
|
+
GetRateLimitsResponse,
|
|
42
|
+
GetTaskResponse,
|
|
43
|
+
ListBlockListResponse,
|
|
44
|
+
ListDevicesResponse,
|
|
45
|
+
ListExternalStorageResponse,
|
|
46
|
+
ListImportsResponse,
|
|
47
|
+
ListPermissionsResponse,
|
|
48
|
+
ListPushProvidersResponse,
|
|
49
|
+
ListRolesResponse,
|
|
50
|
+
QueryUsersPayload,
|
|
51
|
+
QueryUsersResponse,
|
|
52
|
+
ReactivateUserRequest,
|
|
53
|
+
ReactivateUserResponse,
|
|
54
|
+
ReactivateUsersRequest,
|
|
55
|
+
ReactivateUsersResponse,
|
|
56
|
+
Response,
|
|
57
|
+
RestoreUsersRequest,
|
|
58
|
+
UnblockUsersRequest,
|
|
59
|
+
UnblockUsersResponse,
|
|
60
|
+
UpdateAppRequest,
|
|
61
|
+
UpdateBlockListRequest,
|
|
62
|
+
UpdateExternalStorageRequest,
|
|
63
|
+
UpdateExternalStorageResponse,
|
|
64
|
+
UpdateUsersPartialRequest,
|
|
65
|
+
UpdateUsersRequest,
|
|
66
|
+
UpdateUsersResponse,
|
|
67
|
+
UpsertPushProviderRequest,
|
|
68
|
+
UpsertPushProviderResponse,
|
|
69
|
+
} from '../models';
|
|
70
|
+
import { decoders } from '../model-decoders';
|
|
71
|
+
|
|
72
|
+
export class CommonApi extends BaseApi {
|
|
73
|
+
getApp = async (): Promise<StreamResponse<GetApplicationResponse>> => {
|
|
74
|
+
const response = await this.sendRequest<
|
|
75
|
+
StreamResponse<GetApplicationResponse>
|
|
76
|
+
>('GET', '/api/v2/app', undefined, undefined);
|
|
77
|
+
|
|
78
|
+
decoders.GetApplicationResponse?.(response.body);
|
|
79
|
+
|
|
80
|
+
return { ...response.body, metadata: response.metadata };
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
updateApp = async (
|
|
84
|
+
request?: UpdateAppRequest,
|
|
85
|
+
): Promise<StreamResponse<Response>> => {
|
|
86
|
+
const body = {
|
|
87
|
+
async_url_enrich_enabled: request?.async_url_enrich_enabled,
|
|
88
|
+
auto_translation_enabled: request?.auto_translation_enabled,
|
|
89
|
+
before_message_send_hook_url: request?.before_message_send_hook_url,
|
|
90
|
+
cdn_expiration_seconds: request?.cdn_expiration_seconds,
|
|
91
|
+
channel_hide_members_only: request?.channel_hide_members_only,
|
|
92
|
+
custom_action_handler_url: request?.custom_action_handler_url,
|
|
93
|
+
disable_auth_checks: request?.disable_auth_checks,
|
|
94
|
+
disable_permissions_checks: request?.disable_permissions_checks,
|
|
95
|
+
enforce_unique_usernames: request?.enforce_unique_usernames,
|
|
96
|
+
feeds_moderation_enabled: request?.feeds_moderation_enabled,
|
|
97
|
+
feeds_v2_region: request?.feeds_v2_region,
|
|
98
|
+
image_moderation_enabled: request?.image_moderation_enabled,
|
|
99
|
+
migrate_permissions_to_v2: request?.migrate_permissions_to_v2,
|
|
100
|
+
moderation_enabled: request?.moderation_enabled,
|
|
101
|
+
moderation_webhook_url: request?.moderation_webhook_url,
|
|
102
|
+
multi_tenant_enabled: request?.multi_tenant_enabled,
|
|
103
|
+
permission_version: request?.permission_version,
|
|
104
|
+
reminders_interval: request?.reminders_interval,
|
|
105
|
+
reminders_max_members: request?.reminders_max_members,
|
|
106
|
+
revoke_tokens_issued_before: request?.revoke_tokens_issued_before,
|
|
107
|
+
sns_key: request?.sns_key,
|
|
108
|
+
sns_secret: request?.sns_secret,
|
|
109
|
+
sns_topic_arn: request?.sns_topic_arn,
|
|
110
|
+
sqs_key: request?.sqs_key,
|
|
111
|
+
sqs_secret: request?.sqs_secret,
|
|
112
|
+
sqs_url: request?.sqs_url,
|
|
113
|
+
video_provider: request?.video_provider,
|
|
114
|
+
webhook_url: request?.webhook_url,
|
|
115
|
+
allowed_flag_reasons: request?.allowed_flag_reasons,
|
|
116
|
+
image_moderation_block_labels: request?.image_moderation_block_labels,
|
|
117
|
+
image_moderation_labels: request?.image_moderation_labels,
|
|
118
|
+
user_search_disallowed_roles: request?.user_search_disallowed_roles,
|
|
119
|
+
webhook_events: request?.webhook_events,
|
|
120
|
+
agora_options: request?.agora_options,
|
|
121
|
+
apn_config: request?.apn_config,
|
|
122
|
+
async_moderation_config: request?.async_moderation_config,
|
|
123
|
+
datadog_info: request?.datadog_info,
|
|
124
|
+
file_upload_config: request?.file_upload_config,
|
|
125
|
+
firebase_config: request?.firebase_config,
|
|
126
|
+
grants: request?.grants,
|
|
127
|
+
hms_options: request?.hms_options,
|
|
128
|
+
huawei_config: request?.huawei_config,
|
|
129
|
+
image_upload_config: request?.image_upload_config,
|
|
130
|
+
push_config: request?.push_config,
|
|
131
|
+
xiaomi_config: request?.xiaomi_config,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
135
|
+
'PATCH',
|
|
136
|
+
'/api/v2/app',
|
|
137
|
+
undefined,
|
|
138
|
+
undefined,
|
|
139
|
+
body,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
decoders.Response?.(response.body);
|
|
143
|
+
|
|
144
|
+
return { ...response.body, metadata: response.metadata };
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
listBlockLists = async (): Promise<StreamResponse<ListBlockListResponse>> => {
|
|
148
|
+
const response = await this.sendRequest<
|
|
149
|
+
StreamResponse<ListBlockListResponse>
|
|
150
|
+
>('GET', '/api/v2/blocklists', undefined, undefined);
|
|
151
|
+
|
|
152
|
+
decoders.ListBlockListResponse?.(response.body);
|
|
153
|
+
|
|
154
|
+
return { ...response.body, metadata: response.metadata };
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
createBlockList = async (
|
|
158
|
+
request: CreateBlockListRequest,
|
|
159
|
+
): Promise<StreamResponse<Response>> => {
|
|
160
|
+
const body = {
|
|
161
|
+
name: request?.name,
|
|
162
|
+
words: request?.words,
|
|
163
|
+
type: request?.type,
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
167
|
+
'POST',
|
|
168
|
+
'/api/v2/blocklists',
|
|
169
|
+
undefined,
|
|
170
|
+
undefined,
|
|
171
|
+
body,
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
decoders.Response?.(response.body);
|
|
175
|
+
|
|
176
|
+
return { ...response.body, metadata: response.metadata };
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
deleteBlockList = async (request: {
|
|
180
|
+
name: string;
|
|
181
|
+
}): Promise<StreamResponse<Response>> => {
|
|
182
|
+
const pathParams = {
|
|
183
|
+
name: request?.name,
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
187
|
+
'DELETE',
|
|
188
|
+
'/api/v2/blocklists/{name}',
|
|
189
|
+
pathParams,
|
|
190
|
+
undefined,
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
decoders.Response?.(response.body);
|
|
194
|
+
|
|
195
|
+
return { ...response.body, metadata: response.metadata };
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
getBlockList = async (request: {
|
|
199
|
+
name: string;
|
|
200
|
+
}): Promise<StreamResponse<GetBlockListResponse>> => {
|
|
201
|
+
const pathParams = {
|
|
202
|
+
name: request?.name,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const response = await this.sendRequest<
|
|
206
|
+
StreamResponse<GetBlockListResponse>
|
|
207
|
+
>('GET', '/api/v2/blocklists/{name}', pathParams, undefined);
|
|
208
|
+
|
|
209
|
+
decoders.GetBlockListResponse?.(response.body);
|
|
210
|
+
|
|
211
|
+
return { ...response.body, metadata: response.metadata };
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
updateBlockList = async (
|
|
215
|
+
request: UpdateBlockListRequest & { name: string },
|
|
216
|
+
): Promise<StreamResponse<Response>> => {
|
|
217
|
+
const pathParams = {
|
|
218
|
+
name: request?.name,
|
|
219
|
+
};
|
|
220
|
+
const body = {
|
|
221
|
+
words: request?.words,
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
225
|
+
'PUT',
|
|
226
|
+
'/api/v2/blocklists/{name}',
|
|
227
|
+
pathParams,
|
|
228
|
+
undefined,
|
|
229
|
+
body,
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
decoders.Response?.(response.body);
|
|
233
|
+
|
|
234
|
+
return { ...response.body, metadata: response.metadata };
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
checkPush = async (
|
|
238
|
+
request?: CheckPushRequest,
|
|
239
|
+
): Promise<StreamResponse<CheckPushResponse>> => {
|
|
240
|
+
const body = {
|
|
241
|
+
apn_template: request?.apn_template,
|
|
242
|
+
firebase_data_template: request?.firebase_data_template,
|
|
243
|
+
firebase_template: request?.firebase_template,
|
|
244
|
+
message_id: request?.message_id,
|
|
245
|
+
push_provider_name: request?.push_provider_name,
|
|
246
|
+
push_provider_type: request?.push_provider_type,
|
|
247
|
+
skip_devices: request?.skip_devices,
|
|
248
|
+
user_id: request?.user_id,
|
|
249
|
+
user: request?.user,
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const response = await this.sendRequest<StreamResponse<CheckPushResponse>>(
|
|
253
|
+
'POST',
|
|
254
|
+
'/api/v2/check_push',
|
|
255
|
+
undefined,
|
|
256
|
+
undefined,
|
|
257
|
+
body,
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
decoders.CheckPushResponse?.(response.body);
|
|
261
|
+
|
|
262
|
+
return { ...response.body, metadata: response.metadata };
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
checkSNS = async (
|
|
266
|
+
request?: CheckSNSRequest,
|
|
267
|
+
): Promise<StreamResponse<CheckSNSResponse>> => {
|
|
268
|
+
const body = {
|
|
269
|
+
sns_key: request?.sns_key,
|
|
270
|
+
sns_secret: request?.sns_secret,
|
|
271
|
+
sns_topic_arn: request?.sns_topic_arn,
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const response = await this.sendRequest<StreamResponse<CheckSNSResponse>>(
|
|
275
|
+
'POST',
|
|
276
|
+
'/api/v2/check_sns',
|
|
277
|
+
undefined,
|
|
278
|
+
undefined,
|
|
279
|
+
body,
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
decoders.CheckSNSResponse?.(response.body);
|
|
283
|
+
|
|
284
|
+
return { ...response.body, metadata: response.metadata };
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
checkSQS = async (
|
|
288
|
+
request?: CheckSQSRequest,
|
|
289
|
+
): Promise<StreamResponse<CheckSQSResponse>> => {
|
|
290
|
+
const body = {
|
|
291
|
+
sqs_key: request?.sqs_key,
|
|
292
|
+
sqs_secret: request?.sqs_secret,
|
|
293
|
+
sqs_url: request?.sqs_url,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const response = await this.sendRequest<StreamResponse<CheckSQSResponse>>(
|
|
297
|
+
'POST',
|
|
298
|
+
'/api/v2/check_sqs',
|
|
299
|
+
undefined,
|
|
300
|
+
undefined,
|
|
301
|
+
body,
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
decoders.CheckSQSResponse?.(response.body);
|
|
305
|
+
|
|
306
|
+
return { ...response.body, metadata: response.metadata };
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
deleteDevice = async (request: {
|
|
310
|
+
id: string;
|
|
311
|
+
user_id?: string;
|
|
312
|
+
}): Promise<StreamResponse<Response>> => {
|
|
313
|
+
const queryParams = {
|
|
314
|
+
id: request?.id,
|
|
315
|
+
user_id: request?.user_id,
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
319
|
+
'DELETE',
|
|
320
|
+
'/api/v2/devices',
|
|
321
|
+
undefined,
|
|
322
|
+
queryParams,
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
decoders.Response?.(response.body);
|
|
326
|
+
|
|
327
|
+
return { ...response.body, metadata: response.metadata };
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
listDevices = async (request?: {
|
|
331
|
+
user_id?: string;
|
|
332
|
+
}): Promise<StreamResponse<ListDevicesResponse>> => {
|
|
333
|
+
const queryParams = {
|
|
334
|
+
user_id: request?.user_id,
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
const response = await this.sendRequest<
|
|
338
|
+
StreamResponse<ListDevicesResponse>
|
|
339
|
+
>('GET', '/api/v2/devices', undefined, queryParams);
|
|
340
|
+
|
|
341
|
+
decoders.ListDevicesResponse?.(response.body);
|
|
342
|
+
|
|
343
|
+
return { ...response.body, metadata: response.metadata };
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
createDevice = async (
|
|
347
|
+
request: CreateDeviceRequest,
|
|
348
|
+
): Promise<StreamResponse<Response>> => {
|
|
349
|
+
const body = {
|
|
350
|
+
id: request?.id,
|
|
351
|
+
push_provider: request?.push_provider,
|
|
352
|
+
push_provider_name: request?.push_provider_name,
|
|
353
|
+
user_id: request?.user_id,
|
|
354
|
+
voip_token: request?.voip_token,
|
|
355
|
+
user: request?.user,
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
359
|
+
'POST',
|
|
360
|
+
'/api/v2/devices',
|
|
361
|
+
undefined,
|
|
362
|
+
undefined,
|
|
363
|
+
body,
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
decoders.Response?.(response.body);
|
|
367
|
+
|
|
368
|
+
return { ...response.body, metadata: response.metadata };
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
exportUsers = async (
|
|
372
|
+
request: ExportUsersRequest,
|
|
373
|
+
): Promise<StreamResponse<ExportUsersResponse>> => {
|
|
374
|
+
const body = {
|
|
375
|
+
user_ids: request?.user_ids,
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
const response = await this.sendRequest<
|
|
379
|
+
StreamResponse<ExportUsersResponse>
|
|
380
|
+
>('POST', '/api/v2/export/users', undefined, undefined, body);
|
|
381
|
+
|
|
382
|
+
decoders.ExportUsersResponse?.(response.body);
|
|
383
|
+
|
|
384
|
+
return { ...response.body, metadata: response.metadata };
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
listExternalStorage = async (): Promise<
|
|
388
|
+
StreamResponse<ListExternalStorageResponse>
|
|
389
|
+
> => {
|
|
390
|
+
const response = await this.sendRequest<
|
|
391
|
+
StreamResponse<ListExternalStorageResponse>
|
|
392
|
+
>('GET', '/api/v2/external_storage', undefined, undefined);
|
|
393
|
+
|
|
394
|
+
decoders.ListExternalStorageResponse?.(response.body);
|
|
395
|
+
|
|
396
|
+
return { ...response.body, metadata: response.metadata };
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
createExternalStorage = async (
|
|
400
|
+
request: CreateExternalStorageRequest,
|
|
401
|
+
): Promise<StreamResponse<CreateExternalStorageResponse>> => {
|
|
402
|
+
const body = {
|
|
403
|
+
bucket: request?.bucket,
|
|
404
|
+
name: request?.name,
|
|
405
|
+
storage_type: request?.storage_type,
|
|
406
|
+
gcs_credentials: request?.gcs_credentials,
|
|
407
|
+
path: request?.path,
|
|
408
|
+
aws_s3: request?.aws_s3,
|
|
409
|
+
azure_blob: request?.azure_blob,
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const response = await this.sendRequest<
|
|
413
|
+
StreamResponse<CreateExternalStorageResponse>
|
|
414
|
+
>('POST', '/api/v2/external_storage', undefined, undefined, body);
|
|
415
|
+
|
|
416
|
+
decoders.CreateExternalStorageResponse?.(response.body);
|
|
417
|
+
|
|
418
|
+
return { ...response.body, metadata: response.metadata };
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
deleteExternalStorage = async (request: {
|
|
422
|
+
name: string;
|
|
423
|
+
}): Promise<StreamResponse<DeleteExternalStorageResponse>> => {
|
|
424
|
+
const pathParams = {
|
|
425
|
+
name: request?.name,
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
const response = await this.sendRequest<
|
|
429
|
+
StreamResponse<DeleteExternalStorageResponse>
|
|
430
|
+
>('DELETE', '/api/v2/external_storage/{name}', pathParams, undefined);
|
|
431
|
+
|
|
432
|
+
decoders.DeleteExternalStorageResponse?.(response.body);
|
|
433
|
+
|
|
434
|
+
return { ...response.body, metadata: response.metadata };
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
updateExternalStorage = async (
|
|
438
|
+
request: UpdateExternalStorageRequest & { name: string },
|
|
439
|
+
): Promise<StreamResponse<UpdateExternalStorageResponse>> => {
|
|
440
|
+
const pathParams = {
|
|
441
|
+
name: request?.name,
|
|
442
|
+
};
|
|
443
|
+
const body = {
|
|
444
|
+
bucket: request?.bucket,
|
|
445
|
+
storage_type: request?.storage_type,
|
|
446
|
+
gcs_credentials: request?.gcs_credentials,
|
|
447
|
+
path: request?.path,
|
|
448
|
+
aws_s3: request?.aws_s3,
|
|
449
|
+
azure_blob: request?.azure_blob,
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const response = await this.sendRequest<
|
|
453
|
+
StreamResponse<UpdateExternalStorageResponse>
|
|
454
|
+
>('PUT', '/api/v2/external_storage/{name}', pathParams, undefined, body);
|
|
455
|
+
|
|
456
|
+
decoders.UpdateExternalStorageResponse?.(response.body);
|
|
457
|
+
|
|
458
|
+
return { ...response.body, metadata: response.metadata };
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
checkExternalStorage = async (request: {
|
|
462
|
+
name: string;
|
|
463
|
+
}): Promise<StreamResponse<CheckExternalStorageResponse>> => {
|
|
464
|
+
const pathParams = {
|
|
465
|
+
name: request?.name,
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
const response = await this.sendRequest<
|
|
469
|
+
StreamResponse<CheckExternalStorageResponse>
|
|
470
|
+
>('GET', '/api/v2/external_storage/{name}/check', pathParams, undefined);
|
|
471
|
+
|
|
472
|
+
decoders.CheckExternalStorageResponse?.(response.body);
|
|
473
|
+
|
|
474
|
+
return { ...response.body, metadata: response.metadata };
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
createGuest = async (
|
|
478
|
+
request: CreateGuestRequest,
|
|
479
|
+
): Promise<StreamResponse<CreateGuestResponse>> => {
|
|
480
|
+
const body = {
|
|
481
|
+
user: request?.user,
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
const response = await this.sendRequest<
|
|
485
|
+
StreamResponse<CreateGuestResponse>
|
|
486
|
+
>('POST', '/api/v2/guest', undefined, undefined, body);
|
|
487
|
+
|
|
488
|
+
decoders.CreateGuestResponse?.(response.body);
|
|
489
|
+
|
|
490
|
+
return { ...response.body, metadata: response.metadata };
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
createImportURL = async (
|
|
494
|
+
request?: CreateImportURLRequest,
|
|
495
|
+
): Promise<StreamResponse<CreateImportURLResponse>> => {
|
|
496
|
+
const body = {
|
|
497
|
+
filename: request?.filename,
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
const response = await this.sendRequest<
|
|
501
|
+
StreamResponse<CreateImportURLResponse>
|
|
502
|
+
>('POST', '/api/v2/import_urls', undefined, undefined, body);
|
|
503
|
+
|
|
504
|
+
decoders.CreateImportURLResponse?.(response.body);
|
|
505
|
+
|
|
506
|
+
return { ...response.body, metadata: response.metadata };
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
listImports = async (): Promise<StreamResponse<ListImportsResponse>> => {
|
|
510
|
+
const response = await this.sendRequest<
|
|
511
|
+
StreamResponse<ListImportsResponse>
|
|
512
|
+
>('GET', '/api/v2/imports', undefined, undefined);
|
|
513
|
+
|
|
514
|
+
decoders.ListImportsResponse?.(response.body);
|
|
515
|
+
|
|
516
|
+
return { ...response.body, metadata: response.metadata };
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
createImport = async (
|
|
520
|
+
request: CreateImportRequest,
|
|
521
|
+
): Promise<StreamResponse<CreateImportResponse>> => {
|
|
522
|
+
const body = {
|
|
523
|
+
mode: request?.mode,
|
|
524
|
+
path: request?.path,
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const response = await this.sendRequest<
|
|
528
|
+
StreamResponse<CreateImportResponse>
|
|
529
|
+
>('POST', '/api/v2/imports', undefined, undefined, body);
|
|
530
|
+
|
|
531
|
+
decoders.CreateImportResponse?.(response.body);
|
|
532
|
+
|
|
533
|
+
return { ...response.body, metadata: response.metadata };
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
getImport = async (request: {
|
|
537
|
+
id: string;
|
|
538
|
+
}): Promise<StreamResponse<GetImportResponse>> => {
|
|
539
|
+
const pathParams = {
|
|
540
|
+
id: request?.id,
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
const response = await this.sendRequest<StreamResponse<GetImportResponse>>(
|
|
544
|
+
'GET',
|
|
545
|
+
'/api/v2/imports/{id}',
|
|
546
|
+
pathParams,
|
|
547
|
+
undefined,
|
|
548
|
+
);
|
|
549
|
+
|
|
550
|
+
decoders.GetImportResponse?.(response.body);
|
|
551
|
+
|
|
552
|
+
return { ...response.body, metadata: response.metadata };
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
getOG = async (request: {
|
|
556
|
+
url: string;
|
|
557
|
+
}): Promise<StreamResponse<GetOGResponse>> => {
|
|
558
|
+
const queryParams = {
|
|
559
|
+
url: request?.url,
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
const response = await this.sendRequest<StreamResponse<GetOGResponse>>(
|
|
563
|
+
'GET',
|
|
564
|
+
'/api/v2/og',
|
|
565
|
+
undefined,
|
|
566
|
+
queryParams,
|
|
567
|
+
);
|
|
568
|
+
|
|
569
|
+
decoders.GetOGResponse?.(response.body);
|
|
570
|
+
|
|
571
|
+
return { ...response.body, metadata: response.metadata };
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
listPermissions = async (): Promise<
|
|
575
|
+
StreamResponse<ListPermissionsResponse>
|
|
576
|
+
> => {
|
|
577
|
+
const response = await this.sendRequest<
|
|
578
|
+
StreamResponse<ListPermissionsResponse>
|
|
579
|
+
>('GET', '/api/v2/permissions', undefined, undefined);
|
|
580
|
+
|
|
581
|
+
decoders.ListPermissionsResponse?.(response.body);
|
|
582
|
+
|
|
583
|
+
return { ...response.body, metadata: response.metadata };
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
getPermission = async (request: {
|
|
587
|
+
id: string;
|
|
588
|
+
}): Promise<StreamResponse<GetCustomPermissionResponse>> => {
|
|
589
|
+
const pathParams = {
|
|
590
|
+
id: request?.id,
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
const response = await this.sendRequest<
|
|
594
|
+
StreamResponse<GetCustomPermissionResponse>
|
|
595
|
+
>('GET', '/api/v2/permissions/{id}', pathParams, undefined);
|
|
596
|
+
|
|
597
|
+
decoders.GetCustomPermissionResponse?.(response.body);
|
|
598
|
+
|
|
599
|
+
return { ...response.body, metadata: response.metadata };
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
listPushProviders = async (): Promise<
|
|
603
|
+
StreamResponse<ListPushProvidersResponse>
|
|
604
|
+
> => {
|
|
605
|
+
const response = await this.sendRequest<
|
|
606
|
+
StreamResponse<ListPushProvidersResponse>
|
|
607
|
+
>('GET', '/api/v2/push_providers', undefined, undefined);
|
|
608
|
+
|
|
609
|
+
decoders.ListPushProvidersResponse?.(response.body);
|
|
610
|
+
|
|
611
|
+
return { ...response.body, metadata: response.metadata };
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
upsertPushProvider = async (
|
|
615
|
+
request?: UpsertPushProviderRequest,
|
|
616
|
+
): Promise<StreamResponse<UpsertPushProviderResponse>> => {
|
|
617
|
+
const body = {
|
|
618
|
+
push_provider: request?.push_provider,
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
const response = await this.sendRequest<
|
|
622
|
+
StreamResponse<UpsertPushProviderResponse>
|
|
623
|
+
>('POST', '/api/v2/push_providers', undefined, undefined, body);
|
|
624
|
+
|
|
625
|
+
decoders.UpsertPushProviderResponse?.(response.body);
|
|
626
|
+
|
|
627
|
+
return { ...response.body, metadata: response.metadata };
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
deletePushProvider = async (request: {
|
|
631
|
+
type: string;
|
|
632
|
+
name: string;
|
|
633
|
+
}): Promise<StreamResponse<Response>> => {
|
|
634
|
+
const pathParams = {
|
|
635
|
+
type: request?.type,
|
|
636
|
+
name: request?.name,
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
640
|
+
'DELETE',
|
|
641
|
+
'/api/v2/push_providers/{type}/{name}',
|
|
642
|
+
pathParams,
|
|
643
|
+
undefined,
|
|
644
|
+
);
|
|
645
|
+
|
|
646
|
+
decoders.Response?.(response.body);
|
|
647
|
+
|
|
648
|
+
return { ...response.body, metadata: response.metadata };
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
getRateLimits = async (request?: {
|
|
652
|
+
server_side?: boolean;
|
|
653
|
+
android?: boolean;
|
|
654
|
+
ios?: boolean;
|
|
655
|
+
web?: boolean;
|
|
656
|
+
endpoints?: string;
|
|
657
|
+
}): Promise<StreamResponse<GetRateLimitsResponse>> => {
|
|
658
|
+
const queryParams = {
|
|
659
|
+
server_side: request?.server_side,
|
|
660
|
+
android: request?.android,
|
|
661
|
+
ios: request?.ios,
|
|
662
|
+
web: request?.web,
|
|
663
|
+
endpoints: request?.endpoints,
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
const response = await this.sendRequest<
|
|
667
|
+
StreamResponse<GetRateLimitsResponse>
|
|
668
|
+
>('GET', '/api/v2/rate_limits', undefined, queryParams);
|
|
669
|
+
|
|
670
|
+
decoders.GetRateLimitsResponse?.(response.body);
|
|
671
|
+
|
|
672
|
+
return { ...response.body, metadata: response.metadata };
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
listRoles = async (): Promise<StreamResponse<ListRolesResponse>> => {
|
|
676
|
+
const response = await this.sendRequest<StreamResponse<ListRolesResponse>>(
|
|
677
|
+
'GET',
|
|
678
|
+
'/api/v2/roles',
|
|
679
|
+
undefined,
|
|
680
|
+
undefined,
|
|
681
|
+
);
|
|
682
|
+
|
|
683
|
+
decoders.ListRolesResponse?.(response.body);
|
|
684
|
+
|
|
685
|
+
return { ...response.body, metadata: response.metadata };
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
createRole = async (
|
|
689
|
+
request: CreateRoleRequest,
|
|
690
|
+
): Promise<StreamResponse<CreateRoleResponse>> => {
|
|
691
|
+
const body = {
|
|
692
|
+
name: request?.name,
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
const response = await this.sendRequest<StreamResponse<CreateRoleResponse>>(
|
|
696
|
+
'POST',
|
|
697
|
+
'/api/v2/roles',
|
|
698
|
+
undefined,
|
|
699
|
+
undefined,
|
|
700
|
+
body,
|
|
701
|
+
);
|
|
702
|
+
|
|
703
|
+
decoders.CreateRoleResponse?.(response.body);
|
|
704
|
+
|
|
705
|
+
return { ...response.body, metadata: response.metadata };
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
deleteRole = async (request: {
|
|
709
|
+
name: string;
|
|
710
|
+
}): Promise<StreamResponse<Response>> => {
|
|
711
|
+
const pathParams = {
|
|
712
|
+
name: request?.name,
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
716
|
+
'DELETE',
|
|
717
|
+
'/api/v2/roles/{name}',
|
|
718
|
+
pathParams,
|
|
719
|
+
undefined,
|
|
720
|
+
);
|
|
721
|
+
|
|
722
|
+
decoders.Response?.(response.body);
|
|
723
|
+
|
|
724
|
+
return { ...response.body, metadata: response.metadata };
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
getTask = async (request: {
|
|
728
|
+
id: string;
|
|
729
|
+
}): Promise<StreamResponse<GetTaskResponse>> => {
|
|
730
|
+
const pathParams = {
|
|
731
|
+
id: request?.id,
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
const response = await this.sendRequest<StreamResponse<GetTaskResponse>>(
|
|
735
|
+
'GET',
|
|
736
|
+
'/api/v2/tasks/{id}',
|
|
737
|
+
pathParams,
|
|
738
|
+
undefined,
|
|
739
|
+
);
|
|
740
|
+
|
|
741
|
+
decoders.GetTaskResponse?.(response.body);
|
|
742
|
+
|
|
743
|
+
return { ...response.body, metadata: response.metadata };
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
queryUsers = async (request?: {
|
|
747
|
+
payload?: QueryUsersPayload;
|
|
748
|
+
}): Promise<StreamResponse<QueryUsersResponse>> => {
|
|
749
|
+
const queryParams = {
|
|
750
|
+
payload: request?.payload,
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
const response = await this.sendRequest<StreamResponse<QueryUsersResponse>>(
|
|
754
|
+
'GET',
|
|
755
|
+
'/api/v2/users',
|
|
756
|
+
undefined,
|
|
757
|
+
queryParams,
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
decoders.QueryUsersResponse?.(response.body);
|
|
761
|
+
|
|
762
|
+
return { ...response.body, metadata: response.metadata };
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
updateUsersPartial = async (
|
|
766
|
+
request: UpdateUsersPartialRequest,
|
|
767
|
+
): Promise<StreamResponse<UpdateUsersResponse>> => {
|
|
768
|
+
const body = {
|
|
769
|
+
users: request?.users,
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
const response = await this.sendRequest<
|
|
773
|
+
StreamResponse<UpdateUsersResponse>
|
|
774
|
+
>('PATCH', '/api/v2/users', undefined, undefined, body);
|
|
775
|
+
|
|
776
|
+
decoders.UpdateUsersResponse?.(response.body);
|
|
777
|
+
|
|
778
|
+
return { ...response.body, metadata: response.metadata };
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
updateUsers = async (
|
|
782
|
+
request: UpdateUsersRequest,
|
|
783
|
+
): Promise<StreamResponse<UpdateUsersResponse>> => {
|
|
784
|
+
const body = {
|
|
785
|
+
users: request?.users,
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
const response = await this.sendRequest<
|
|
789
|
+
StreamResponse<UpdateUsersResponse>
|
|
790
|
+
>('POST', '/api/v2/users', undefined, undefined, body);
|
|
791
|
+
|
|
792
|
+
decoders.UpdateUsersResponse?.(response.body);
|
|
793
|
+
|
|
794
|
+
return { ...response.body, metadata: response.metadata };
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
getBlockedUsers = async (request?: {
|
|
798
|
+
user_id?: string;
|
|
799
|
+
}): Promise<StreamResponse<GetBlockedUsersResponse>> => {
|
|
800
|
+
const queryParams = {
|
|
801
|
+
user_id: request?.user_id,
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
const response = await this.sendRequest<
|
|
805
|
+
StreamResponse<GetBlockedUsersResponse>
|
|
806
|
+
>('GET', '/api/v2/users/block', undefined, queryParams);
|
|
807
|
+
|
|
808
|
+
decoders.GetBlockedUsersResponse?.(response.body);
|
|
809
|
+
|
|
810
|
+
return { ...response.body, metadata: response.metadata };
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
blockUsers = async (
|
|
814
|
+
request: BlockUsersRequest,
|
|
815
|
+
): Promise<StreamResponse<BlockUsersResponse>> => {
|
|
816
|
+
const body = {
|
|
817
|
+
blocked_user_id: request?.blocked_user_id,
|
|
818
|
+
user_id: request?.user_id,
|
|
819
|
+
user: request?.user,
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
const response = await this.sendRequest<StreamResponse<BlockUsersResponse>>(
|
|
823
|
+
'POST',
|
|
824
|
+
'/api/v2/users/block',
|
|
825
|
+
undefined,
|
|
826
|
+
undefined,
|
|
827
|
+
body,
|
|
828
|
+
);
|
|
829
|
+
|
|
830
|
+
decoders.BlockUsersResponse?.(response.body);
|
|
831
|
+
|
|
832
|
+
return { ...response.body, metadata: response.metadata };
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
deactivateUsers = async (
|
|
836
|
+
request: DeactivateUsersRequest,
|
|
837
|
+
): Promise<StreamResponse<DeactivateUsersResponse>> => {
|
|
838
|
+
const body = {
|
|
839
|
+
user_ids: request?.user_ids,
|
|
840
|
+
created_by_id: request?.created_by_id,
|
|
841
|
+
mark_channels_deleted: request?.mark_channels_deleted,
|
|
842
|
+
mark_messages_deleted: request?.mark_messages_deleted,
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
const response = await this.sendRequest<
|
|
846
|
+
StreamResponse<DeactivateUsersResponse>
|
|
847
|
+
>('POST', '/api/v2/users/deactivate', undefined, undefined, body);
|
|
848
|
+
|
|
849
|
+
decoders.DeactivateUsersResponse?.(response.body);
|
|
850
|
+
|
|
851
|
+
return { ...response.body, metadata: response.metadata };
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
deleteUsers = async (
|
|
855
|
+
request: DeleteUsersRequest,
|
|
856
|
+
): Promise<StreamResponse<DeleteUsersResponse>> => {
|
|
857
|
+
const body = {
|
|
858
|
+
user_ids: request?.user_ids,
|
|
859
|
+
calls: request?.calls,
|
|
860
|
+
conversations: request?.conversations,
|
|
861
|
+
messages: request?.messages,
|
|
862
|
+
new_call_owner_id: request?.new_call_owner_id,
|
|
863
|
+
new_channel_owner_id: request?.new_channel_owner_id,
|
|
864
|
+
user: request?.user,
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
const response = await this.sendRequest<
|
|
868
|
+
StreamResponse<DeleteUsersResponse>
|
|
869
|
+
>('POST', '/api/v2/users/delete', undefined, undefined, body);
|
|
870
|
+
|
|
871
|
+
decoders.DeleteUsersResponse?.(response.body);
|
|
872
|
+
|
|
873
|
+
return { ...response.body, metadata: response.metadata };
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
reactivateUsers = async (
|
|
877
|
+
request: ReactivateUsersRequest,
|
|
878
|
+
): Promise<StreamResponse<ReactivateUsersResponse>> => {
|
|
879
|
+
const body = {
|
|
880
|
+
user_ids: request?.user_ids,
|
|
881
|
+
created_by_id: request?.created_by_id,
|
|
882
|
+
restore_channels: request?.restore_channels,
|
|
883
|
+
restore_messages: request?.restore_messages,
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
const response = await this.sendRequest<
|
|
887
|
+
StreamResponse<ReactivateUsersResponse>
|
|
888
|
+
>('POST', '/api/v2/users/reactivate', undefined, undefined, body);
|
|
889
|
+
|
|
890
|
+
decoders.ReactivateUsersResponse?.(response.body);
|
|
891
|
+
|
|
892
|
+
return { ...response.body, metadata: response.metadata };
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
restoreUsers = async (
|
|
896
|
+
request: RestoreUsersRequest,
|
|
897
|
+
): Promise<StreamResponse<Response>> => {
|
|
898
|
+
const body = {
|
|
899
|
+
user_ids: request?.user_ids,
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
903
|
+
'POST',
|
|
904
|
+
'/api/v2/users/restore',
|
|
905
|
+
undefined,
|
|
906
|
+
undefined,
|
|
907
|
+
body,
|
|
908
|
+
);
|
|
909
|
+
|
|
910
|
+
decoders.Response?.(response.body);
|
|
911
|
+
|
|
912
|
+
return { ...response.body, metadata: response.metadata };
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
unblockUsers = async (
|
|
916
|
+
request: UnblockUsersRequest,
|
|
917
|
+
): Promise<StreamResponse<UnblockUsersResponse>> => {
|
|
918
|
+
const body = {
|
|
919
|
+
blocked_user_id: request?.blocked_user_id,
|
|
920
|
+
user_id: request?.user_id,
|
|
921
|
+
user: request?.user,
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
const response = await this.sendRequest<
|
|
925
|
+
StreamResponse<UnblockUsersResponse>
|
|
926
|
+
>('POST', '/api/v2/users/unblock', undefined, undefined, body);
|
|
927
|
+
|
|
928
|
+
decoders.UnblockUsersResponse?.(response.body);
|
|
929
|
+
|
|
930
|
+
return { ...response.body, metadata: response.metadata };
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
deactivateUser = async (
|
|
934
|
+
request: DeactivateUserRequest & { user_id: string },
|
|
935
|
+
): Promise<StreamResponse<DeactivateUserResponse>> => {
|
|
936
|
+
const pathParams = {
|
|
937
|
+
user_id: request?.user_id,
|
|
938
|
+
};
|
|
939
|
+
const body = {
|
|
940
|
+
created_by_id: request?.created_by_id,
|
|
941
|
+
mark_messages_deleted: request?.mark_messages_deleted,
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
const response = await this.sendRequest<
|
|
945
|
+
StreamResponse<DeactivateUserResponse>
|
|
946
|
+
>(
|
|
947
|
+
'POST',
|
|
948
|
+
'/api/v2/users/{user_id}/deactivate',
|
|
949
|
+
pathParams,
|
|
950
|
+
undefined,
|
|
951
|
+
body,
|
|
952
|
+
);
|
|
953
|
+
|
|
954
|
+
decoders.DeactivateUserResponse?.(response.body);
|
|
955
|
+
|
|
956
|
+
return { ...response.body, metadata: response.metadata };
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
exportUser = async (request: {
|
|
960
|
+
user_id: string;
|
|
961
|
+
}): Promise<StreamResponse<ExportUserResponse>> => {
|
|
962
|
+
const pathParams = {
|
|
963
|
+
user_id: request?.user_id,
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
const response = await this.sendRequest<StreamResponse<ExportUserResponse>>(
|
|
967
|
+
'GET',
|
|
968
|
+
'/api/v2/users/{user_id}/export',
|
|
969
|
+
pathParams,
|
|
970
|
+
undefined,
|
|
971
|
+
);
|
|
972
|
+
|
|
973
|
+
decoders.ExportUserResponse?.(response.body);
|
|
974
|
+
|
|
975
|
+
return { ...response.body, metadata: response.metadata };
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
reactivateUser = async (
|
|
979
|
+
request: ReactivateUserRequest & { user_id: string },
|
|
980
|
+
): Promise<StreamResponse<ReactivateUserResponse>> => {
|
|
981
|
+
const pathParams = {
|
|
982
|
+
user_id: request?.user_id,
|
|
983
|
+
};
|
|
984
|
+
const body = {
|
|
985
|
+
created_by_id: request?.created_by_id,
|
|
986
|
+
name: request?.name,
|
|
987
|
+
restore_messages: request?.restore_messages,
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
const response = await this.sendRequest<
|
|
991
|
+
StreamResponse<ReactivateUserResponse>
|
|
992
|
+
>(
|
|
993
|
+
'POST',
|
|
994
|
+
'/api/v2/users/{user_id}/reactivate',
|
|
995
|
+
pathParams,
|
|
996
|
+
undefined,
|
|
997
|
+
body,
|
|
998
|
+
);
|
|
999
|
+
|
|
1000
|
+
decoders.ReactivateUserResponse?.(response.body);
|
|
1001
|
+
|
|
1002
|
+
return { ...response.body, metadata: response.metadata };
|
|
1003
|
+
};
|
|
1004
|
+
}
|