@stream-io/feeds-client 0.3.35 → 0.3.36

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.
@@ -1,13 +1,18 @@
1
1
  import type { ApiClient, StreamResponse } from '../../gen-imports';
2
2
  import type {
3
+ AppealRequest,
4
+ AppealResponse,
3
5
  BanRequest,
4
6
  BanResponse,
5
7
  DeleteModerationConfigResponse,
6
8
  FlagRequest,
7
9
  FlagResponse,
10
+ GetAppealResponse,
8
11
  GetConfigResponse,
9
12
  MuteRequest,
10
13
  MuteResponse,
14
+ QueryAppealsRequest,
15
+ QueryAppealsResponse,
11
16
  QueryModerationConfigsRequest,
12
17
  QueryModerationConfigsResponse,
13
18
  QueryReviewQueueRequest,
@@ -22,6 +27,75 @@ import { decoders } from '../model-decoders/decoders';
22
27
  export class ModerationApi {
23
28
  constructor(public readonly apiClient: ApiClient) {}
24
29
 
30
+ async appeal(
31
+ request: AppealRequest,
32
+ ): Promise<StreamResponse<AppealResponse>> {
33
+ const body = {
34
+ appeal_reason: request?.appeal_reason,
35
+ entity_id: request?.entity_id,
36
+ entity_type: request?.entity_type,
37
+ attachments: request?.attachments,
38
+ };
39
+
40
+ const response = await this.apiClient.sendRequest<
41
+ StreamResponse<AppealResponse>
42
+ >(
43
+ 'POST',
44
+ '/api/v2/moderation/appeal',
45
+ undefined,
46
+ undefined,
47
+ body,
48
+ 'application/json',
49
+ );
50
+
51
+ decoders.AppealResponse?.(response.body);
52
+
53
+ return { ...response.body, metadata: response.metadata };
54
+ }
55
+
56
+ async getAppeal(request: {
57
+ id: string;
58
+ }): Promise<StreamResponse<GetAppealResponse>> {
59
+ const pathParams = {
60
+ id: request?.id,
61
+ };
62
+
63
+ const response = await this.apiClient.sendRequest<
64
+ StreamResponse<GetAppealResponse>
65
+ >('GET', '/api/v2/moderation/appeal/{id}', pathParams, undefined);
66
+
67
+ decoders.GetAppealResponse?.(response.body);
68
+
69
+ return { ...response.body, metadata: response.metadata };
70
+ }
71
+
72
+ async queryAppeals(
73
+ request?: QueryAppealsRequest,
74
+ ): Promise<StreamResponse<QueryAppealsResponse>> {
75
+ const body = {
76
+ limit: request?.limit,
77
+ next: request?.next,
78
+ prev: request?.prev,
79
+ sort: request?.sort,
80
+ filter: request?.filter,
81
+ };
82
+
83
+ const response = await this.apiClient.sendRequest<
84
+ StreamResponse<QueryAppealsResponse>
85
+ >(
86
+ 'POST',
87
+ '/api/v2/moderation/appeals',
88
+ undefined,
89
+ undefined,
90
+ body,
91
+ 'application/json',
92
+ );
93
+
94
+ decoders.QueryAppealsResponse?.(response.body);
95
+
96
+ return { ...response.body, metadata: response.metadata };
97
+ }
98
+
25
99
  async ban(request: BanRequest): Promise<StreamResponse<BanResponse>> {
26
100
  const body = {
27
101
  target_user_id: request?.target_user_id,
@@ -242,6 +316,7 @@ export class ModerationApi {
242
316
  ): Promise<StreamResponse<SubmitActionResponse>> {
243
317
  const body = {
244
318
  action_type: request?.action_type,
319
+ appeal_id: request?.appeal_id,
245
320
  item_id: request?.item_id,
246
321
  ban: request?.ban,
247
322
  block: request?.block,
@@ -252,8 +327,11 @@ export class ModerationApi {
252
327
  delete_reaction: request?.delete_reaction,
253
328
  delete_user: request?.delete_user,
254
329
  mark_reviewed: request?.mark_reviewed,
330
+ reject_appeal: request?.reject_appeal,
331
+ restore: request?.restore,
255
332
  shadow_block: request?.shadow_block,
256
333
  unban: request?.unban,
334
+ unblock: request?.unblock,
257
335
  };
258
336
 
259
337
  const response = await this.apiClient.sendRequest<