Skip to content

Commit c803cb3

Browse files
Merge pull request #13 from Frontify/feat/update-to-custom-metadata
feat: replace metadata with customMetadata
2 parents 88e9ac9 + 6271cb5 commit c803cb3

File tree

1 file changed

+51
-31
lines changed

1 file changed

+51
-31
lines changed

src/Api.ts

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { version } from '../package.json';
12
import { FinderError } from './Exception';
23
import { logMessage } from './Logger';
34
import { httpCall } from './Utils';
4-
import { version } from '../package.json';
55

66
type Options = {
77
domain: string;
@@ -44,47 +44,59 @@ export type Asset = {
4444
export type FrontifyAsset = {
4545
id: string;
4646
title: string;
47-
description: string;
47+
description: string | null;
4848
creator: {
4949
name: string;
5050
};
5151
createdAt: string;
5252
type: string;
5353
author: string;
54-
expiresAt?: string;
55-
licenses?: {
56-
title: string;
57-
text: string;
58-
};
59-
copyright?: {
54+
expiresAt: string | null;
55+
licenses:
56+
| {
57+
title: string;
58+
text: string;
59+
}[]
60+
| null;
61+
copyright: {
6062
status: string;
6163
notice: string;
62-
};
63-
tags?: {
64-
value: string;
65-
source: string;
66-
};
67-
metadataValues?: {
68-
value: string | number;
69-
metadataField: {
64+
} | null;
65+
tags:
66+
| {
67+
value: string;
68+
source: string;
69+
}[]
70+
| null;
71+
customMetadata: {
72+
property: {
7073
id: string;
71-
label: string;
74+
name: string;
75+
type: {
76+
name: string;
77+
};
7278
};
73-
};
74-
filename: string;
75-
extension: string;
76-
size: number;
77-
downloadUrl?: string;
79+
value?: {
80+
value: string | { optionId: string; text: string };
81+
};
82+
values?: {
83+
value: { optionId: string; text: string };
84+
}[];
85+
}[];
86+
filename?: string | null;
87+
extension?: string;
88+
size?: number | null;
89+
downloadUrl?: string | null;
7890
previewUrl?: string;
79-
dynamicPreviewUrl?: string;
80-
thumbnailUrl?: string;
81-
icon?: string;
82-
focalPoint?: number[];
91+
dynamicPreviewUrl?: string | null;
92+
thumbnailUrl?: string | null;
93+
icon?: string | null;
94+
focalPoint?: number[] | null;
8395
width?: number;
8496
height?: number;
8597
duration?: number;
8698
bitrate?: number;
87-
pageCount?: number;
99+
pageCount?: number | null;
88100
};
89101

90102
const ASSET_BY_IDS_QUERY = `
@@ -113,11 +125,19 @@ fragment withMetadata on Asset {
113125
value
114126
source
115127
}
116-
metadataValues {
117-
value
118-
metadataField {
128+
customMetadata {
129+
property {
119130
id
120-
label
131+
name
132+
type {
133+
name
134+
}
135+
}
136+
... on CustomMetadataValue {
137+
value
138+
}
139+
... on CustomMetadataValues {
140+
values
121141
}
122142
}
123143
copyright {

0 commit comments

Comments
 (0)