Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AWS Rekognition Moderation addon #502

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions packages/rest-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ export {
AddonParams,
AddonUcClamavVirusScanParams,
AddonAwsRekognitionDetectLabelsParams,
AddonAwsRekognitionModerationLabelsParams,
AddonRemoveBgParams
} from './types/AddonParams'
export {
AddonData,
AwsLabel,
AppData,
ClamavVirusScan,
AwsRekognitionDetectLabelParent,
AwsRekognitionDetectLabelInstance,
AwsRekognitionDetectLabel,
AwsRekognitionDetectLabels,
RemoveBg
AwsRekognitionDetectModerationLabels,
AwsRekognitionDetectModerationLabel,
RemoveBg,
TechFieldsAppData
} from './types/AppData'
export { BatchResponse, BatchResponseStatus } from './types/BatchResponse'
export { ConversionStatus } from './types/ConversionStatus'
Expand All @@ -30,7 +36,10 @@ export { WebhookEvent } from './types/WebhookEvent'
export { StoreValue } from '@uploadcare/api-client-utils'
export { Paginatable } from './types/Paginatable'
export { Md5Function } from './lib/md5/Md5Function'
export { ConversionOptions } from './types/ConversionOptions'
export {
ConversionOptions,
BaseConversionOption
} from './types/ConversionOptions'
export { ConversionResponse } from './types/ConversionResponse'
export { ConversionStatusOptions } from './types/ConversionStatusOptions'
export { ConversionStatusResponse } from './types/ConversionStatusResponse'
Expand Down
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
}
55 changes: 29 additions & 26 deletions packages/rest-client/src/types/AppData.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { AddonName } from './AddonName'

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

export type AddonData<T> = TechFieldsAppData & { data: T }

export type ClamavVirusScan = AddonData<{
infected: boolean
infected_with: string
}>

export type AwsRekognitionDetectLabelParent = {
Name: string
}
Expand All @@ -24,34 +27,34 @@ export type AwsRekognitionDetectLabelInstance = {
}
}

export type AwsRekognitionDetectLabel = {
Confidence: number
Name: string
export type AwsLabel<T> = T & { Confidence: number; Name: string }

export type AwsRekognitionDetectLabel = AwsLabel<{
Parents: AwsRekognitionDetectLabelParent[]
Instances: AwsRekognitionDetectLabelInstance[]
}
}>

export type AwsRekognitionDetectLabels = {
data: {
LabelModelVersion: string
Labels: AwsRekognitionDetectLabel[]
}
version: string
datetime_created: string
datetime_updated: string
}
export type AwsRekognitionDetectLabels = AddonData<{
LabelModelVersion: string
Labels: AwsRekognitionDetectLabel[]
}>

export type RemoveBg = {
data: {
foreground_type: string
}
version: string
datetime_created: string
datetime_updated: string
}
export type AwsRekognitionDetectModerationLabel = AwsLabel<{
ParentName: string
}>

export type AwsRekognitionDetectModerationLabels = AddonData<{
ModerationModelVersion: string
ModerationLabels: AwsRekognitionDetectModerationLabel[]
}>

export type RemoveBg = AddonData<{
foreground_type: string
}>

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
}
2 changes: 1 addition & 1 deletion packages/rest-client/src/types/ConversionOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConversionType } from './ConversionType'
import { StoreValue } from '@uploadcare/api-client-utils'
import { ValueOf } from './ValueOf'

type BaseConversionOption<T> = {
export type BaseConversionOption<T> = {
type: T
paths: string[]
store?: StoreValue
Expand Down
Loading