Skip to content

Commit fc20052

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
added types
1 parent 6dec552 commit fc20052

File tree

3 files changed

+54
-11
lines changed

3 files changed

+54
-11
lines changed

libs/interfaces/FileDetails.ts

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,46 @@
11
import { FileType } from "./FileType";
22
import { Item } from "./Item";
33

4+
export interface EmbeddedMetadataValues {
5+
[key: string]:
6+
| string
7+
| number
8+
| boolean
9+
| Date
10+
| Array<string | number | boolean | Date>
11+
}
12+
13+
export interface AITagItem {
14+
name: string
15+
confidence: number
16+
source: 'google-auto-tagging' | 'aws-auto-tagging'
17+
}
18+
19+
export interface CmValues {
20+
[key: string]: | string
21+
| number
22+
| boolean
23+
| Array<string | number | boolean>
24+
}
25+
26+
interface BgRemoval {
27+
name: string
28+
options: {
29+
bg_color?: string
30+
bg_image_url?: string
31+
add_shadow: boolean
32+
semitransparency: boolean
33+
}
34+
}
35+
36+
interface AutoTag {
37+
name: string
38+
maxTags: number
39+
minConfidence: number
40+
}
41+
42+
export type Extension = (BgRemoval | AutoTag)[];
43+
444
/**
545
* Options when updating file details such as tags and customCoordinates attribute using update file detail API.
646
*
@@ -19,7 +59,7 @@ export interface FileDetailsOptions {
1959
/*
2060
* Object with array of extensions to be processed on the image.
2161
*/
22-
extensions?: object[];
62+
extensions?: Extension;
2363
/*
2464
* Final status of pending extensions will be sent to this URL.
2565
*/
@@ -31,7 +71,7 @@ export interface FileDetailsOptions {
3171
/*
3272
* A key-value data to be associated with the asset. To unset a key, send null value for that key. Before setting any custom metadata on an asset you have to create the field using custom metadata fields API.
3373
*/
34-
customMetadata?: object;
74+
customMetadata?: CmValues;
3575
}
3676

3777
/**
@@ -86,19 +126,19 @@ export interface FileObject {
86126
/*
87127
* AITags field is populated only because the google-auto-tagging extension was executed synchronously and it received a successresponse.
88128
*/
89-
AITags?: object[];
129+
AITags?: AITagItem[];
90130
/*
91131
* Field object which will contain the status of each extension at the time of completion of the update/upload request.
92132
*/
93133
extensionStatus?: { [key: string]: string }
94134
/*
95135
* Consolidated embedded metadata associated with the file. It includes exif, iptc, and xmp data.
96136
*/
97-
embeddedMetadata?: object | null;
137+
embeddedMetadata?: EmbeddedMetadataValues | null;
98138
/*
99139
* A key-value data associated with the asset. Before setting any custom metadata on an asset, you have to create the field using custom metadata fields API.
100140
*/
101-
customMetadata?: object;
141+
customMetadata?: CmValues;
102142
/*
103143
* Size of the file in bytes
104144
*/
@@ -130,7 +170,7 @@ export interface FileObject {
130170
/**
131171
* An object containing the file or file version's id (versionId) and name.
132172
*/
133-
versionInfo?: object;
173+
versionInfo?: { name: string; id: string };
134174
}
135175

136176

libs/interfaces/UploadOptions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ReadStream } from "fs";
2+
import { Extension } from "./FileDetails";
23

34
interface TransformationObject {
45
type: "transformation";
@@ -94,7 +95,7 @@ export interface UploadOptions {
9495
/*
9596
* Object with array of extensions to be processed on the image.
9697
*/
97-
extensions?: object[];
98+
extensions?: Extension;
9899
/*
99100
* Final status of pending extensions will be sent to this URL.
100101
*/

libs/interfaces/UploadResponse.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { AITagItem, CmValues, EmbeddedMetadataValues } from "./FileDetails";
2+
import { FileMetadataResponse } from "./FileMetadata";
13
import { FileType } from "./FileType";
24

35
/**
@@ -57,21 +59,21 @@ export interface UploadResponse {
5759
/**
5860
* The metadata of the upload file. Use responseFields property in request to get the metadata returned in response of upload API.
5961
*/
60-
metadata?: object;
62+
metadata?: FileMetadataResponse;
6163
/*
6264
* AITags field is populated only because the google-auto-tagging extension was executed synchronously and it received a successresponse.
6365
*/
64-
AITags?: object[];
66+
AITags?: AITagItem[];
6567
/*
6668
* Field object which will contain the status of each extension at the time of completion of the update/upload request.
6769
*/
6870
extensionStatus?: { [key: string]: string }
6971
/*
7072
* Consolidated embedded metadata associated with the file. It includes exif, iptc, and xmp data.
7173
*/
72-
embeddedMetadata?: object | null;
74+
embeddedMetadata?: EmbeddedMetadataValues | null;
7375
/*
7476
* A key-value data associated with the asset. Before setting any custom metadata on an asset, you have to create the field using custom metadata fields API.
7577
*/
76-
customMetadata?: object;
78+
customMetadata?: CmValues;
7779
}

0 commit comments

Comments
 (0)