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
Changes from 1 commit
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
Prev Previous commit
types(rest-client/addons): refactor types and their exports
  • Loading branch information
Egor Didenko authored and nd0ut committed Nov 15, 2023
commit 9aaec7ad5744e3c46eb0be2fa0444ced1ebf26ad
13 changes: 11 additions & 2 deletions packages/rest-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -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'
@@ -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'
57 changes: 25 additions & 32 deletions packages/rest-client/src/types/AppData.ts
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@ export type TechFieldsAppData = {
datetime_updated: string
}

export type ClamavVirusScan = {
data: {
infected: boolean
infected_with: string
}
} & TechFieldsAppData
export type AddonData<T> = TechFieldsAppData & { data: T }

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

export type AwsRekognitionDetectLabelParent = {
Name: string
@@ -27,41 +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[]
}
} & TechFieldsAppData
export type AwsRekognitionDetectLabels = AddonData<{
LabelModelVersion: string
Labels: AwsRekognitionDetectLabel[]
}>

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

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

export type RemoveBg = {
data: {
foreground_type: string
}
} & TechFieldsAppData
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.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
@@ -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
Loading