@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,476 @@
|
|
|
1
|
+
import { BaseApi } from '../../BaseApi';
|
|
2
|
+
import { StreamResponse } from '../../types';
|
|
3
|
+
import {
|
|
4
|
+
BanRequest,
|
|
5
|
+
BanResponse,
|
|
6
|
+
CheckRequest,
|
|
7
|
+
CheckResponse,
|
|
8
|
+
CustomCheckRequest,
|
|
9
|
+
CustomCheckResponse,
|
|
10
|
+
DeleteModerationTemplateResponse,
|
|
11
|
+
FlagRequest,
|
|
12
|
+
FlagResponse,
|
|
13
|
+
GetConfigResponse,
|
|
14
|
+
GetReviewQueueItemResponse,
|
|
15
|
+
GetUserModerationReportResponse,
|
|
16
|
+
ModeratorStatsResponse,
|
|
17
|
+
MuteRequest,
|
|
18
|
+
MuteResponse,
|
|
19
|
+
QueryFeedModerationTemplatesResponse,
|
|
20
|
+
QueryModerationLogsRequest,
|
|
21
|
+
QueryModerationLogsResponse,
|
|
22
|
+
QueryReviewQueueRequest,
|
|
23
|
+
QueryReviewQueueResponse,
|
|
24
|
+
QueryUsageStatsRequest,
|
|
25
|
+
QueryUsageStatsResponse,
|
|
26
|
+
QueueStatsResponse,
|
|
27
|
+
SubmitActionRequest,
|
|
28
|
+
SubmitActionResponse,
|
|
29
|
+
UnbanRequest,
|
|
30
|
+
UnbanResponse,
|
|
31
|
+
UnmuteRequest,
|
|
32
|
+
UnmuteResponse,
|
|
33
|
+
UpsertConfigRequest,
|
|
34
|
+
UpsertConfigResponse,
|
|
35
|
+
UpsertModerationTemplateRequest,
|
|
36
|
+
UpsertModerationTemplateResponse,
|
|
37
|
+
} from '../models';
|
|
38
|
+
import { decoders } from '../model-decoders';
|
|
39
|
+
|
|
40
|
+
export class ModerationApi extends BaseApi {
|
|
41
|
+
ban = async (request: BanRequest): Promise<StreamResponse<BanResponse>> => {
|
|
42
|
+
const body = {
|
|
43
|
+
target_user_id: request?.target_user_id,
|
|
44
|
+
banned_by_id: request?.banned_by_id,
|
|
45
|
+
channel_cid: request?.channel_cid,
|
|
46
|
+
ip_ban: request?.ip_ban,
|
|
47
|
+
reason: request?.reason,
|
|
48
|
+
shadow: request?.shadow,
|
|
49
|
+
timeout: request?.timeout,
|
|
50
|
+
banned_by: request?.banned_by,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const response = await this.sendRequest<StreamResponse<BanResponse>>(
|
|
54
|
+
'POST',
|
|
55
|
+
'/api/v2/moderation/ban',
|
|
56
|
+
undefined,
|
|
57
|
+
undefined,
|
|
58
|
+
body,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
decoders.BanResponse?.(response.body);
|
|
62
|
+
|
|
63
|
+
return { ...response.body, metadata: response.metadata };
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
check = async (
|
|
67
|
+
request: CheckRequest,
|
|
68
|
+
): Promise<StreamResponse<CheckResponse>> => {
|
|
69
|
+
const body = {
|
|
70
|
+
config_key: request?.config_key,
|
|
71
|
+
entity_creator_id: request?.entity_creator_id,
|
|
72
|
+
entity_id: request?.entity_id,
|
|
73
|
+
entity_type: request?.entity_type,
|
|
74
|
+
user_id: request?.user_id,
|
|
75
|
+
moderation_payload: request?.moderation_payload,
|
|
76
|
+
options: request?.options,
|
|
77
|
+
user: request?.user,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const response = await this.sendRequest<StreamResponse<CheckResponse>>(
|
|
81
|
+
'POST',
|
|
82
|
+
'/api/v2/moderation/check',
|
|
83
|
+
undefined,
|
|
84
|
+
undefined,
|
|
85
|
+
body,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
decoders.CheckResponse?.(response.body);
|
|
89
|
+
|
|
90
|
+
return { ...response.body, metadata: response.metadata };
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
upsertConfig = async (
|
|
94
|
+
request: UpsertConfigRequest,
|
|
95
|
+
): Promise<StreamResponse<UpsertConfigResponse>> => {
|
|
96
|
+
const body = {
|
|
97
|
+
key: request?.key,
|
|
98
|
+
async: request?.async,
|
|
99
|
+
automod_platform_circumvention_config:
|
|
100
|
+
request?.automod_platform_circumvention_config,
|
|
101
|
+
automod_semantic_filters_config: request?.automod_semantic_filters_config,
|
|
102
|
+
automod_toxicity_config: request?.automod_toxicity_config,
|
|
103
|
+
aws_rek_og_nition_config: request?.aws_rek_og_nition_config,
|
|
104
|
+
block_list_config: request?.block_list_config,
|
|
105
|
+
bodyguard_config: request?.bodyguard_config,
|
|
106
|
+
go_og_le_vision_config: request?.go_og_le_vision_config,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const response = await this.sendRequest<
|
|
110
|
+
StreamResponse<UpsertConfigResponse>
|
|
111
|
+
>('POST', '/api/v2/moderation/config', undefined, undefined, body);
|
|
112
|
+
|
|
113
|
+
decoders.UpsertConfigResponse?.(response.body);
|
|
114
|
+
|
|
115
|
+
return { ...response.body, metadata: response.metadata };
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
getConfig = async (request: {
|
|
119
|
+
key: string;
|
|
120
|
+
}): Promise<StreamResponse<GetConfigResponse>> => {
|
|
121
|
+
const pathParams = {
|
|
122
|
+
key: request?.key,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const response = await this.sendRequest<StreamResponse<GetConfigResponse>>(
|
|
126
|
+
'GET',
|
|
127
|
+
'/api/v2/moderation/config/{key}',
|
|
128
|
+
pathParams,
|
|
129
|
+
undefined,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
decoders.GetConfigResponse?.(response.body);
|
|
133
|
+
|
|
134
|
+
return { ...response.body, metadata: response.metadata };
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
customCheck = async (
|
|
138
|
+
request: CustomCheckRequest,
|
|
139
|
+
): Promise<StreamResponse<CustomCheckResponse>> => {
|
|
140
|
+
const body = {
|
|
141
|
+
entity_creator_id: request?.entity_creator_id,
|
|
142
|
+
entity_id: request?.entity_id,
|
|
143
|
+
entity_type: request?.entity_type,
|
|
144
|
+
name: request?.name,
|
|
145
|
+
reason: request?.reason,
|
|
146
|
+
recommended_action: request?.recommended_action,
|
|
147
|
+
user_id: request?.user_id,
|
|
148
|
+
moderation_payload: request?.moderation_payload,
|
|
149
|
+
user: request?.user,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const response = await this.sendRequest<
|
|
153
|
+
StreamResponse<CustomCheckResponse>
|
|
154
|
+
>('POST', '/api/v2/moderation/custom_check', undefined, undefined, body);
|
|
155
|
+
|
|
156
|
+
decoders.CustomCheckResponse?.(response.body);
|
|
157
|
+
|
|
158
|
+
return { ...response.body, metadata: response.metadata };
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
v2DeleteTemplate = async (): Promise<
|
|
162
|
+
StreamResponse<DeleteModerationTemplateResponse>
|
|
163
|
+
> => {
|
|
164
|
+
const response = await this.sendRequest<
|
|
165
|
+
StreamResponse<DeleteModerationTemplateResponse>
|
|
166
|
+
>(
|
|
167
|
+
'DELETE',
|
|
168
|
+
'/api/v2/moderation/feeds_moderation_template',
|
|
169
|
+
undefined,
|
|
170
|
+
undefined,
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
decoders.DeleteModerationTemplateResponse?.(response.body);
|
|
174
|
+
|
|
175
|
+
return { ...response.body, metadata: response.metadata };
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
v2QueryTemplates = async (): Promise<
|
|
179
|
+
StreamResponse<QueryFeedModerationTemplatesResponse>
|
|
180
|
+
> => {
|
|
181
|
+
const response = await this.sendRequest<
|
|
182
|
+
StreamResponse<QueryFeedModerationTemplatesResponse>
|
|
183
|
+
>(
|
|
184
|
+
'GET',
|
|
185
|
+
'/api/v2/moderation/feeds_moderation_template',
|
|
186
|
+
undefined,
|
|
187
|
+
undefined,
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
decoders.QueryFeedModerationTemplatesResponse?.(response.body);
|
|
191
|
+
|
|
192
|
+
return { ...response.body, metadata: response.metadata };
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
v2UpsertTemplate = async (
|
|
196
|
+
request: UpsertModerationTemplateRequest,
|
|
197
|
+
): Promise<StreamResponse<UpsertModerationTemplateResponse>> => {
|
|
198
|
+
const body = {
|
|
199
|
+
name: request?.name,
|
|
200
|
+
config: request?.config,
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const response = await this.sendRequest<
|
|
204
|
+
StreamResponse<UpsertModerationTemplateResponse>
|
|
205
|
+
>(
|
|
206
|
+
'POST',
|
|
207
|
+
'/api/v2/moderation/feeds_moderation_template',
|
|
208
|
+
undefined,
|
|
209
|
+
undefined,
|
|
210
|
+
body,
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
decoders.UpsertModerationTemplateResponse?.(response.body);
|
|
214
|
+
|
|
215
|
+
return { ...response.body, metadata: response.metadata };
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
flag = async (
|
|
219
|
+
request: FlagRequest,
|
|
220
|
+
): Promise<StreamResponse<FlagResponse>> => {
|
|
221
|
+
const body = {
|
|
222
|
+
entity_id: request?.entity_id,
|
|
223
|
+
entity_type: request?.entity_type,
|
|
224
|
+
reason: request?.reason,
|
|
225
|
+
entity_creator_id: request?.entity_creator_id,
|
|
226
|
+
user_id: request?.user_id,
|
|
227
|
+
custom: request?.custom,
|
|
228
|
+
moderation_payload: request?.moderation_payload,
|
|
229
|
+
user: request?.user,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const response = await this.sendRequest<StreamResponse<FlagResponse>>(
|
|
233
|
+
'POST',
|
|
234
|
+
'/api/v2/moderation/flag',
|
|
235
|
+
undefined,
|
|
236
|
+
undefined,
|
|
237
|
+
body,
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
decoders.FlagResponse?.(response.body);
|
|
241
|
+
|
|
242
|
+
return { ...response.body, metadata: response.metadata };
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
queryModerationLogs = async (
|
|
246
|
+
request?: QueryModerationLogsRequest,
|
|
247
|
+
): Promise<StreamResponse<QueryModerationLogsResponse>> => {
|
|
248
|
+
const body = {
|
|
249
|
+
limit: request?.limit,
|
|
250
|
+
next: request?.next,
|
|
251
|
+
prev: request?.prev,
|
|
252
|
+
user_id: request?.user_id,
|
|
253
|
+
sort: request?.sort,
|
|
254
|
+
filter: request?.filter,
|
|
255
|
+
user: request?.user,
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const response = await this.sendRequest<
|
|
259
|
+
StreamResponse<QueryModerationLogsResponse>
|
|
260
|
+
>('POST', '/api/v2/moderation/logs', undefined, undefined, body);
|
|
261
|
+
|
|
262
|
+
decoders.QueryModerationLogsResponse?.(response.body);
|
|
263
|
+
|
|
264
|
+
return { ...response.body, metadata: response.metadata };
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
getModeratorStats = async (): Promise<
|
|
268
|
+
StreamResponse<ModeratorStatsResponse>
|
|
269
|
+
> => {
|
|
270
|
+
const response = await this.sendRequest<
|
|
271
|
+
StreamResponse<ModeratorStatsResponse>
|
|
272
|
+
>('GET', '/api/v2/moderation/moderator_stats', undefined, undefined);
|
|
273
|
+
|
|
274
|
+
decoders.ModeratorStatsResponse?.(response.body);
|
|
275
|
+
|
|
276
|
+
return { ...response.body, metadata: response.metadata };
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
mute = async (
|
|
280
|
+
request: MuteRequest,
|
|
281
|
+
): Promise<StreamResponse<MuteResponse>> => {
|
|
282
|
+
const body = {
|
|
283
|
+
target_ids: request?.target_ids,
|
|
284
|
+
timeout: request?.timeout,
|
|
285
|
+
user_id: request?.user_id,
|
|
286
|
+
user: request?.user,
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const response = await this.sendRequest<StreamResponse<MuteResponse>>(
|
|
290
|
+
'POST',
|
|
291
|
+
'/api/v2/moderation/mute',
|
|
292
|
+
undefined,
|
|
293
|
+
undefined,
|
|
294
|
+
body,
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
decoders.MuteResponse?.(response.body);
|
|
298
|
+
|
|
299
|
+
return { ...response.body, metadata: response.metadata };
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
getQueueStats = async (): Promise<StreamResponse<QueueStatsResponse>> => {
|
|
303
|
+
const response = await this.sendRequest<StreamResponse<QueueStatsResponse>>(
|
|
304
|
+
'GET',
|
|
305
|
+
'/api/v2/moderation/queue_stats',
|
|
306
|
+
undefined,
|
|
307
|
+
undefined,
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
decoders.QueueStatsResponse?.(response.body);
|
|
311
|
+
|
|
312
|
+
return { ...response.body, metadata: response.metadata };
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
queryReviewQueue = async (
|
|
316
|
+
request?: QueryReviewQueueRequest,
|
|
317
|
+
): Promise<StreamResponse<QueryReviewQueueResponse>> => {
|
|
318
|
+
const body = {
|
|
319
|
+
limit: request?.limit,
|
|
320
|
+
lock_moderator_duration: request?.lock_moderator_duration,
|
|
321
|
+
lock_moderator_id: request?.lock_moderator_id,
|
|
322
|
+
next: request?.next,
|
|
323
|
+
prev: request?.prev,
|
|
324
|
+
stats_only: request?.stats_only,
|
|
325
|
+
user_id: request?.user_id,
|
|
326
|
+
sort: request?.sort,
|
|
327
|
+
filter: request?.filter,
|
|
328
|
+
user: request?.user,
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const response = await this.sendRequest<
|
|
332
|
+
StreamResponse<QueryReviewQueueResponse>
|
|
333
|
+
>('POST', '/api/v2/moderation/review_queue', undefined, undefined, body);
|
|
334
|
+
|
|
335
|
+
decoders.QueryReviewQueueResponse?.(response.body);
|
|
336
|
+
|
|
337
|
+
return { ...response.body, metadata: response.metadata };
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
getReviewQueueItem = async (request: {
|
|
341
|
+
id: string;
|
|
342
|
+
}): Promise<StreamResponse<GetReviewQueueItemResponse>> => {
|
|
343
|
+
const pathParams = {
|
|
344
|
+
id: request?.id,
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const response = await this.sendRequest<
|
|
348
|
+
StreamResponse<GetReviewQueueItemResponse>
|
|
349
|
+
>('GET', '/api/v2/moderation/review_queue/{id}', pathParams, undefined);
|
|
350
|
+
|
|
351
|
+
decoders.GetReviewQueueItemResponse?.(response.body);
|
|
352
|
+
|
|
353
|
+
return { ...response.body, metadata: response.metadata };
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
submitAction = async (
|
|
357
|
+
request: SubmitActionRequest,
|
|
358
|
+
): Promise<StreamResponse<SubmitActionResponse>> => {
|
|
359
|
+
const body = {
|
|
360
|
+
action_type: request?.action_type,
|
|
361
|
+
item_id: request?.item_id,
|
|
362
|
+
user_id: request?.user_id,
|
|
363
|
+
ban: request?.ban,
|
|
364
|
+
custom: request?.custom,
|
|
365
|
+
delete_message: request?.delete_message,
|
|
366
|
+
delete_reaction: request?.delete_reaction,
|
|
367
|
+
delete_user: request?.delete_user,
|
|
368
|
+
unban: request?.unban,
|
|
369
|
+
user: request?.user,
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const response = await this.sendRequest<
|
|
373
|
+
StreamResponse<SubmitActionResponse>
|
|
374
|
+
>('POST', '/api/v2/moderation/submit_action', undefined, undefined, body);
|
|
375
|
+
|
|
376
|
+
decoders.SubmitActionResponse?.(response.body);
|
|
377
|
+
|
|
378
|
+
return { ...response.body, metadata: response.metadata };
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
unban = async (
|
|
382
|
+
request: UnbanRequest & {
|
|
383
|
+
target_user_id: string;
|
|
384
|
+
channel_cid?: string;
|
|
385
|
+
created_by?: string;
|
|
386
|
+
},
|
|
387
|
+
): Promise<StreamResponse<UnbanResponse>> => {
|
|
388
|
+
const queryParams = {
|
|
389
|
+
target_user_id: request?.target_user_id,
|
|
390
|
+
channel_cid: request?.channel_cid,
|
|
391
|
+
created_by: request?.created_by,
|
|
392
|
+
};
|
|
393
|
+
const body = {
|
|
394
|
+
unbanned_by_id: request?.unbanned_by_id,
|
|
395
|
+
unbanned_by: request?.unbanned_by,
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const response = await this.sendRequest<StreamResponse<UnbanResponse>>(
|
|
399
|
+
'POST',
|
|
400
|
+
'/api/v2/moderation/unban',
|
|
401
|
+
undefined,
|
|
402
|
+
queryParams,
|
|
403
|
+
body,
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
decoders.UnbanResponse?.(response.body);
|
|
407
|
+
|
|
408
|
+
return { ...response.body, metadata: response.metadata };
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
unmute = async (
|
|
412
|
+
request: UnmuteRequest,
|
|
413
|
+
): Promise<StreamResponse<UnmuteResponse>> => {
|
|
414
|
+
const body = {
|
|
415
|
+
target_ids: request?.target_ids,
|
|
416
|
+
user_id: request?.user_id,
|
|
417
|
+
user: request?.user,
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const response = await this.sendRequest<StreamResponse<UnmuteResponse>>(
|
|
421
|
+
'POST',
|
|
422
|
+
'/api/v2/moderation/unmute',
|
|
423
|
+
undefined,
|
|
424
|
+
undefined,
|
|
425
|
+
body,
|
|
426
|
+
);
|
|
427
|
+
|
|
428
|
+
decoders.UnmuteResponse?.(response.body);
|
|
429
|
+
|
|
430
|
+
return { ...response.body, metadata: response.metadata };
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
queryUsageStats = async (
|
|
434
|
+
request?: QueryUsageStatsRequest,
|
|
435
|
+
): Promise<StreamResponse<QueryUsageStatsResponse>> => {
|
|
436
|
+
const body = {
|
|
437
|
+
limit: request?.limit,
|
|
438
|
+
next: request?.next,
|
|
439
|
+
prev: request?.prev,
|
|
440
|
+
user_id: request?.user_id,
|
|
441
|
+
sort: request?.sort,
|
|
442
|
+
filter: request?.filter,
|
|
443
|
+
user: request?.user,
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const response = await this.sendRequest<
|
|
447
|
+
StreamResponse<QueryUsageStatsResponse>
|
|
448
|
+
>('POST', '/api/v2/moderation/usage_stats', undefined, undefined, body);
|
|
449
|
+
|
|
450
|
+
decoders.QueryUsageStatsResponse?.(response.body);
|
|
451
|
+
|
|
452
|
+
return { ...response.body, metadata: response.metadata };
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
getUserReport = async (request: {
|
|
456
|
+
user_id: string;
|
|
457
|
+
create_user_if_not_exists?: boolean;
|
|
458
|
+
include_user_mutes?: boolean;
|
|
459
|
+
include_user_blocks?: boolean;
|
|
460
|
+
}): Promise<StreamResponse<GetUserModerationReportResponse>> => {
|
|
461
|
+
const queryParams = {
|
|
462
|
+
user_id: request?.user_id,
|
|
463
|
+
create_user_if_not_exists: request?.create_user_if_not_exists,
|
|
464
|
+
include_user_mutes: request?.include_user_mutes,
|
|
465
|
+
include_user_blocks: request?.include_user_blocks,
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
const response = await this.sendRequest<
|
|
469
|
+
StreamResponse<GetUserModerationReportResponse>
|
|
470
|
+
>('GET', '/api/v2/moderation/user_report', undefined, queryParams);
|
|
471
|
+
|
|
472
|
+
decoders.GetUserModerationReportResponse?.(response.body);
|
|
473
|
+
|
|
474
|
+
return { ...response.body, metadata: response.metadata };
|
|
475
|
+
};
|
|
476
|
+
}
|