Skip to content

Commit 67a01dc

Browse files
Egor Didenkond0ut
authored andcommitted
feat(rest-client): add AWS Rekognition Moderation addon
1 parent 80c4ad4 commit 67a01dc

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export enum AddonName {
22
UC_CLAMAV_VIRUS_SCAN = 'uc_clamav_virus_scan',
33
AWS_REKOGNITION_DETECT_LABELS = 'aws_rekognition_detect_labels',
4+
AWS_REKOGNITION_DETECT_MODERATION_LABELS = 'aws_rekognition_detect_moderation_labels',
45
REMOVE_BG = 'remove_bg'
56
}

packages/rest-client/src/types/AddonParams.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export type AddonUcClamavVirusScanParams = {
66

77
export type AddonAwsRekognitionDetectLabelsParams = undefined
88

9+
export type AddonAwsRekognitionModerationLabelsParams = undefined
10+
911
export type AddonRemoveBgParams = {
1012
crop?: boolean
1113
crop_margin?: string
@@ -22,5 +24,6 @@ export type AddonRemoveBgParams = {
2224
export type AddonParams = {
2325
[AddonName.UC_CLAMAV_VIRUS_SCAN]: AddonUcClamavVirusScanParams
2426
[AddonName.AWS_REKOGNITION_DETECT_LABELS]: AddonAwsRekognitionDetectLabelsParams
27+
[AddonName.AWS_REKOGNITION_DETECT_MODERATION_LABELS]: AddonAwsRekognitionModerationLabelsParams
2528
[AddonName.REMOVE_BG]: AddonRemoveBgParams
2629
}

packages/rest-client/src/types/AppData.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import { AddonName } from './AddonName'
22

3+
export type TechFieldsAppData = {
4+
version: string
5+
datetime_created: string
6+
datetime_updated: string
7+
}
8+
39
export type ClamavVirusScan = {
410
data: {
511
infected: boolean
612
infected_with: string
713
}
8-
version: string
9-
datetime_created: string
10-
datetime_updated: string
11-
}
14+
} & TechFieldsAppData
1215

1316
export type AwsRekognitionDetectLabelParent = {
1417
Name: string
@@ -36,22 +39,29 @@ export type AwsRekognitionDetectLabels = {
3639
LabelModelVersion: string
3740
Labels: AwsRekognitionDetectLabel[]
3841
}
39-
version: string
40-
datetime_created: string
41-
datetime_updated: string
42-
}
42+
} & TechFieldsAppData
43+
44+
export type AwsRekognitionDetectModerationLabel = Pick<
45+
AwsRekognitionDetectLabel,
46+
'Confidence' | 'Name'
47+
> & { ParentName: string }
48+
49+
export type AwsRekognitionDetectModerationLabels = {
50+
data: {
51+
ModerationModelVersion: string
52+
ModerationLabels: AwsRekognitionDetectModerationLabel[]
53+
}
54+
} & TechFieldsAppData
4355

4456
export type RemoveBg = {
4557
data: {
4658
foreground_type: string
4759
}
48-
version: string
49-
datetime_created: string
50-
datetime_updated: string
51-
}
60+
} & TechFieldsAppData
5261

5362
export type AppData = {
5463
[AddonName.UC_CLAMAV_VIRUS_SCAN]?: ClamavVirusScan
5564
[AddonName.AWS_REKOGNITION_DETECT_LABELS]?: AwsRekognitionDetectLabels
65+
[AddonName.AWS_REKOGNITION_DETECT_MODERATION_LABELS]: AwsRekognitionDetectModerationLabels
5666
[AddonName.REMOVE_BG]?: RemoveBg
5767
}

0 commit comments

Comments
 (0)