Skip to content

Commit d2d695e

Browse files
committed
Update from latest API spec
1 parent f25b700 commit d2d695e

File tree

3 files changed

+86
-82
lines changed

3 files changed

+86
-82
lines changed

src/gen/model-decoders/index.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,13 @@ decoders.CreateRoleResponse = (input?: Record<string, any>) => {
558558
return decode(typeMappings, input);
559559
};
560560

561+
decoders.CustomCheckResponse = (input?: Record<string, any>) => {
562+
const typeMappings: TypeMapping = {
563+
item: { type: 'ReviewQueueItemResponse', isSingle: true },
564+
};
565+
return decode(typeMappings, input);
566+
};
567+
561568
decoders.DeactivateUserResponse = (input?: Record<string, any>) => {
562569
const typeMappings: TypeMapping = {
563570
user: { type: 'UserResponse', isSingle: true },
@@ -681,7 +688,7 @@ decoders.ExportUserResponse = (input?: Record<string, any>) => {
681688
return decode(typeMappings, input);
682689
};
683690

684-
decoders.Flag2 = (input?: Record<string, any>) => {
691+
decoders.Flag = (input?: Record<string, any>) => {
685692
const typeMappings: TypeMapping = {
686693
created_at: { type: 'DatetimeType', isSingle: true },
687694

@@ -692,17 +699,6 @@ decoders.Flag2 = (input?: Record<string, any>) => {
692699
return decode(typeMappings, input);
693700
};
694701

695-
decoders.Flag2Response = (input?: Record<string, any>) => {
696-
const typeMappings: TypeMapping = {
697-
created_at: { type: 'DatetimeType', isSingle: true },
698-
699-
updated_at: { type: 'DatetimeType', isSingle: true },
700-
701-
user: { type: 'UserResponse', isSingle: true },
702-
};
703-
return decode(typeMappings, input);
704-
};
705-
706702
decoders.FlagDetails = (input?: Record<string, any>) => {
707703
const typeMappings: TypeMapping = {
708704
automod: { type: 'AutomodDetails', isSingle: true },
@@ -729,6 +725,8 @@ decoders.FullUserResponse = (input?: Record<string, any>) => {
729725

730726
mutes: { type: 'UserMuteResponse', isSingle: false },
731727

728+
ban_expires: { type: 'DatetimeType', isSingle: true },
729+
732730
deactivated_at: { type: 'DatetimeType', isSingle: true },
733731

734732
deleted_at: { type: 'DatetimeType', isSingle: true },
@@ -1576,7 +1574,7 @@ decoders.ReviewQueueItem = (input?: Record<string, any>) => {
15761574

15771575
bans: { type: 'Ban', isSingle: false },
15781576

1579-
flags: { type: 'Flag2', isSingle: false },
1577+
flags: { type: 'Flag', isSingle: false },
15801578

15811579
assigned_to: { type: 'User', isSingle: true },
15821580

@@ -1599,8 +1597,6 @@ decoders.ReviewQueueItemResponse = (input?: Record<string, any>) => {
15991597

16001598
bans: { type: 'Ban', isSingle: false },
16011599

1602-
flags: { type: 'Flag2Response', isSingle: false },
1603-
16041600
completed_at: { type: 'DatetimeType', isSingle: true },
16051601

16061602
reviewed_at: { type: 'DatetimeType', isSingle: true },

src/gen/models/index.ts

Lines changed: 50 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,6 +2880,42 @@ export interface CustomActionRequest {
28802880
options?: Record<string, any>;
28812881
}
28822882

2883+
export interface CustomCheckFlag {
2884+
type: string;
2885+
2886+
reason?: string;
2887+
2888+
labels?: string[];
2889+
2890+
custom?: Record<string, any>;
2891+
}
2892+
2893+
export interface CustomCheckRequest {
2894+
entity_id: string;
2895+
2896+
entity_type: string;
2897+
2898+
flags: CustomCheckFlag[];
2899+
2900+
entity_creator_id?: string;
2901+
2902+
user_id?: string;
2903+
2904+
moderation_payload?: ModerationPayload;
2905+
2906+
user?: UserRequest;
2907+
}
2908+
2909+
export interface CustomCheckResponse {
2910+
duration: string;
2911+
2912+
id: string;
2913+
2914+
status: string;
2915+
2916+
item?: ReviewQueueItemResponse;
2917+
}
2918+
28832919
export interface CustomVideoEvent {
28842920
call_cid: string;
28852921

@@ -3429,8 +3465,6 @@ export interface ExternalStorageResponse {
34293465
export interface FPSStats {
34303466
average_fps: number;
34313467

3432-
harmonic_fps: number;
3433-
34343468
tracked: number;
34353469
}
34363470

@@ -3505,36 +3539,6 @@ export interface FirebaseConfigFields {
35053539
export interface Flag {
35063540
created_at: Date;
35073541

3508-
created_by_automod: boolean;
3509-
3510-
updated_at: Date;
3511-
3512-
approved_at?: Date;
3513-
3514-
reason?: string;
3515-
3516-
rejected_at?: Date;
3517-
3518-
reviewed_at?: Date;
3519-
3520-
reviewed_by?: string;
3521-
3522-
target_message_id?: string;
3523-
3524-
custom?: Record<string, any>;
3525-
3526-
details?: FlagDetails;
3527-
3528-
target_message?: Message;
3529-
3530-
target_user?: User;
3531-
3532-
user?: User;
3533-
}
3534-
3535-
export interface Flag2 {
3536-
created_at: Date;
3537-
35383542
entity_id: string;
35393543

35403544
entity_type: string;
@@ -3562,36 +3566,6 @@ export interface Flag2 {
35623566
user?: User;
35633567
}
35643568

3565-
export interface Flag2Response {
3566-
created_at: Date;
3567-
3568-
entity_id: string;
3569-
3570-
entity_type: string;
3571-
3572-
updated_at: Date;
3573-
3574-
user_id: string;
3575-
3576-
result: Array<Record<string, any>>;
3577-
3578-
entity_creator_id?: string;
3579-
3580-
reason?: string;
3581-
3582-
review_queue_item_id?: string;
3583-
3584-
type?: string;
3585-
3586-
labels?: string[];
3587-
3588-
custom?: Record<string, any>;
3589-
3590-
moderation_payload?: ModerationPayload;
3591-
3592-
user?: UserResponse;
3593-
}
3594-
35953569
export interface FlagDetails {
35963570
original_text: string;
35973571

@@ -3725,6 +3699,8 @@ export interface FullUserResponse {
37253699

37263700
custom: Record<string, any>;
37273701

3702+
ban_expires?: Date;
3703+
37283704
deactivated_at?: Date;
37293705

37303706
deleted_at?: Date;
@@ -5384,6 +5360,10 @@ export interface NotificationSettings {
53845360

53855361
export interface NullTime {}
53865362

5363+
export interface OCRConfig {
5364+
rules?: BodyguardRule[];
5365+
}
5366+
53875367
export interface OnlyUserID {
53885368
id: string;
53895369
}
@@ -6889,7 +6869,7 @@ export interface ReviewQueueItem {
68896869

68906870
bans: Ban[];
68916871

6892-
flags: Flag2[];
6872+
flags: Flag[];
68936873

68946874
languages: string[];
68956875

@@ -6919,7 +6899,7 @@ export interface ReviewQueueItemNewEvent {
69196899

69206900
received_at?: Date;
69216901

6922-
flags?: Flag2Response[];
6902+
flags?: FlagResponse[];
69236903

69246904
action?: ActionLogResponse;
69256905

@@ -6951,7 +6931,7 @@ export interface ReviewQueueItemResponse {
69516931

69526932
bans: Ban[];
69536933

6954-
flags: Flag2Response[];
6934+
flags: FlagResponse[];
69556935

69566936
languages: string[];
69576937

@@ -6985,7 +6965,7 @@ export interface ReviewQueueItemUpdatedEvent {
69856965

69866966
received_at?: Date;
69876967

6988-
flags?: Flag2Response[];
6968+
flags?: FlagResponse[];
69896969

69906970
action?: ActionLogResponse;
69916971

@@ -7875,7 +7855,8 @@ export interface TranslateMessageRequest {
78757855
| 'uk'
78767856
| 'ur'
78777857
| 'vi'
7878-
| 'lt';
7858+
| 'lt'
7859+
| 'ht';
78797860
}
78807861

78817862
export interface TruncateChannelRequest {
@@ -8609,6 +8590,8 @@ export interface UpsertConfigRequest {
86098590

86108591
google_vision_config?: GoogleVisionConfig;
86118592

8593+
ocr_config?: OCRConfig;
8594+
86128595
user?: UserRequest;
86138596

86148597
velocity_filter_config?: VelocityFilterConfig;

src/gen/moderation/ModerationApi.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
BanResponse,
66
CheckRequest,
77
CheckResponse,
8+
CustomCheckRequest,
9+
CustomCheckResponse,
810
DeleteModerationConfigResponse,
911
DeleteModerationTemplateResponse,
1012
FlagRequest,
@@ -126,6 +128,7 @@ export class ModerationApi extends BaseApi {
126128
block_list_config: request?.block_list_config,
127129
bodyguard_config: request?.bodyguard_config,
128130
google_vision_config: request?.google_vision_config,
131+
ocr_config: request?.ocr_config,
129132
user: request?.user,
130133
velocity_filter_config: request?.velocity_filter_config,
131134
};
@@ -204,6 +207,28 @@ export class ModerationApi extends BaseApi {
204207
return { ...response.body, metadata: response.metadata };
205208
};
206209

210+
customCheck = async (
211+
request: CustomCheckRequest,
212+
): Promise<StreamResponse<CustomCheckResponse>> => {
213+
const body = {
214+
entity_id: request?.entity_id,
215+
entity_type: request?.entity_type,
216+
flags: request?.flags,
217+
entity_creator_id: request?.entity_creator_id,
218+
user_id: request?.user_id,
219+
moderation_payload: request?.moderation_payload,
220+
user: request?.user,
221+
};
222+
223+
const response = await this.sendRequest<
224+
StreamResponse<CustomCheckResponse>
225+
>('POST', '/api/v2/moderation/custom_check', undefined, undefined, body);
226+
227+
decoders.CustomCheckResponse?.(response.body);
228+
229+
return { ...response.body, metadata: response.metadata };
230+
};
231+
207232
v2DeleteTemplate = async (): Promise<
208233
StreamResponse<DeleteModerationTemplateResponse>
209234
> => {

0 commit comments

Comments
 (0)