Skip to content

Commit

Permalink
feat(rest-client): add AWS Rekognition Moderation addon
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Didenko authored and nd0ut committed Nov 15, 2023
1 parent 80c4ad4 commit 67a01dc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/rest-client/src/types/AddonName.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum AddonName {
UC_CLAMAV_VIRUS_SCAN = 'uc_clamav_virus_scan',
AWS_REKOGNITION_DETECT_LABELS = 'aws_rekognition_detect_labels',
AWS_REKOGNITION_DETECT_MODERATION_LABELS = 'aws_rekognition_detect_moderation_labels',
REMOVE_BG = 'remove_bg'
}
3 changes: 3 additions & 0 deletions packages/rest-client/src/types/AddonParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export type AddonUcClamavVirusScanParams = {

export type AddonAwsRekognitionDetectLabelsParams = undefined

export type AddonAwsRekognitionModerationLabelsParams = undefined

export type AddonRemoveBgParams = {
crop?: boolean
crop_margin?: string
Expand All @@ -22,5 +24,6 @@ export type AddonRemoveBgParams = {
export type AddonParams = {
[AddonName.UC_CLAMAV_VIRUS_SCAN]: AddonUcClamavVirusScanParams
[AddonName.AWS_REKOGNITION_DETECT_LABELS]: AddonAwsRekognitionDetectLabelsParams
[AddonName.AWS_REKOGNITION_DETECT_MODERATION_LABELS]: AddonAwsRekognitionModerationLabelsParams
[AddonName.REMOVE_BG]: AddonRemoveBgParams
}
34 changes: 22 additions & 12 deletions packages/rest-client/src/types/AppData.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { AddonName } from './AddonName'

export type TechFieldsAppData = {
version: string
datetime_created: string
datetime_updated: string
}

export type ClamavVirusScan = {
data: {
infected: boolean
infected_with: string
}
version: string
datetime_created: string
datetime_updated: string
}
} & TechFieldsAppData

export type AwsRekognitionDetectLabelParent = {
Name: string
Expand Down Expand Up @@ -36,22 +39,29 @@ export type AwsRekognitionDetectLabels = {
LabelModelVersion: string
Labels: AwsRekognitionDetectLabel[]
}
version: string
datetime_created: string
datetime_updated: string
}
} & TechFieldsAppData

export type AwsRekognitionDetectModerationLabel = Pick<
AwsRekognitionDetectLabel,
'Confidence' | 'Name'
> & { ParentName: string }

export type AwsRekognitionDetectModerationLabels = {
data: {
ModerationModelVersion: string
ModerationLabels: AwsRekognitionDetectModerationLabel[]
}
} & TechFieldsAppData

export type RemoveBg = {
data: {
foreground_type: string
}
version: string
datetime_created: string
datetime_updated: string
}
} & TechFieldsAppData

export type AppData = {
[AddonName.UC_CLAMAV_VIRUS_SCAN]?: ClamavVirusScan
[AddonName.AWS_REKOGNITION_DETECT_LABELS]?: AwsRekognitionDetectLabels
[AddonName.AWS_REKOGNITION_DETECT_MODERATION_LABELS]: AwsRekognitionDetectModerationLabels
[AddonName.REMOVE_BG]?: RemoveBg
}

0 comments on commit 67a01dc

Please sign in to comment.