@air/api-rest 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,400 @@
1
+ import { CursorPageParams, AirBase, PagePromise, AirBaseOptions } from '@air/api-core';
2
+ export { APIError, AirBase, AirBaseOptions, AuthenticationError, BadRequestError, ConnectionError, CursorPage, CursorPageParams, CursorPageResponse, InternalServerError, NotFoundError, PagePromise, PermissionError, RateLimitError, RequestOptions, TimeoutError, VERSION } from '@air/api-core';
3
+
4
+ interface Tag {
5
+ id: string;
6
+ name: string;
7
+ }
8
+ interface TagListParams extends CursorPageParams {
9
+ name?: string;
10
+ }
11
+ interface TagCreateParams {
12
+ name: string;
13
+ }
14
+ interface TagUpdateParams {
15
+ name?: string;
16
+ }
17
+
18
+ interface SmartTag {
19
+ name: string;
20
+ }
21
+ interface AssetCustomFieldValue {
22
+ id: string;
23
+ name: string;
24
+ type: string;
25
+ value: string | null;
26
+ values: {
27
+ id: string;
28
+ name: string;
29
+ }[] | null;
30
+ }
31
+ interface AssetVersionUrls {
32
+ thumbnail: string | null;
33
+ preview: string | null;
34
+ }
35
+ interface AssetVersion {
36
+ id: string;
37
+ fileName: string;
38
+ ext: string;
39
+ title: string;
40
+ description: string | null;
41
+ summary: string | null;
42
+ type: string;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ fileCreatedAt: string | null;
46
+ width: number | null;
47
+ height: number | null;
48
+ duration: number | undefined;
49
+ size: number;
50
+ smartTags: SmartTag[];
51
+ tags: Tag[] | undefined;
52
+ urls: AssetVersionUrls;
53
+ }
54
+ interface Asset {
55
+ id: string;
56
+ customFields: AssetCustomFieldValue[] | undefined;
57
+ coverVersion: AssetVersion;
58
+ }
59
+ interface AssetListParams extends CursorPageParams {
60
+ parentBoardId?: string;
61
+ includeNestedAssets?: boolean;
62
+ tag?: string | string[];
63
+ customField?: string | string[];
64
+ search?: string;
65
+ "createdAt[gte]"?: string;
66
+ "createdAt[lte]"?: string;
67
+ }
68
+ interface AssetVersionUpdateParams {
69
+ title?: string;
70
+ description?: string;
71
+ }
72
+ interface SetCustomFieldParams {
73
+ value?: string | null;
74
+ values?: {
75
+ id: string;
76
+ }[] | null;
77
+ }
78
+ interface AddVersionTagParams {
79
+ id: string;
80
+ }
81
+ interface AssetVersionDownloadUrl {
82
+ url: string;
83
+ }
84
+ interface AssetBoardListParams extends CursorPageParams {
85
+ includeCustomFields?: boolean;
86
+ }
87
+ interface AssetVersionListResponse {
88
+ data: AssetVersion[];
89
+ total: number;
90
+ }
91
+
92
+ interface Board {
93
+ id: string;
94
+ parentBoardId: string | null;
95
+ title: string;
96
+ description: string | null;
97
+ createdAt: string;
98
+ updatedAt: string;
99
+ customFields: AssetCustomFieldValue[] | undefined;
100
+ }
101
+ interface BoardListParams extends CursorPageParams {
102
+ name?: string;
103
+ parentBoardId?: string;
104
+ customField?: string | string[];
105
+ }
106
+ interface BoardCreateParams {
107
+ title: string;
108
+ description?: string;
109
+ parentBoardId?: string;
110
+ }
111
+ interface BoardUpdateParams {
112
+ title?: string;
113
+ description?: string;
114
+ parentBoardId?: string | null;
115
+ }
116
+ interface AddBoardAssetsParams {
117
+ assetIds: string[];
118
+ }
119
+ interface SetBoardCustomFieldParams {
120
+ value?: string | null;
121
+ values?: {
122
+ id: string;
123
+ }[] | null;
124
+ }
125
+ interface Guest {
126
+ id: string;
127
+ email: string;
128
+ roleId: string;
129
+ boardId: string;
130
+ }
131
+ interface AddGuestParams {
132
+ email: string;
133
+ roleId: string;
134
+ }
135
+ interface UpdateGuestParams {
136
+ roleId: string;
137
+ }
138
+ interface GuestListParams {
139
+ email?: string;
140
+ }
141
+ interface GuestListResponse {
142
+ data: Guest[];
143
+ }
144
+
145
+ declare class Assets {
146
+ private client;
147
+ constructor(client: AirBase);
148
+ list(params?: AssetListParams): PagePromise<Asset>;
149
+ get(assetId: string): Promise<Asset>;
150
+ delete(assetId: string): Promise<void>;
151
+ setCustomField(assetId: string, customFieldId: string, params: SetCustomFieldParams): Promise<void>;
152
+ listVersions(assetId: string): Promise<AssetVersionListResponse>;
153
+ getVersion(assetId: string, versionId: string): Promise<AssetVersion>;
154
+ updateVersion(assetId: string, versionId: string, params: AssetVersionUpdateParams): Promise<void>;
155
+ getVersionDownloadUrl(assetId: string, versionId: string): Promise<AssetVersionDownloadUrl>;
156
+ addVersionTag(assetId: string, versionId: string, params: AddVersionTagParams): Promise<AssetVersion>;
157
+ removeVersionTag(assetId: string, versionId: string, tagId: string): Promise<void>;
158
+ listBoards(assetId: string, params?: AssetBoardListParams): PagePromise<Board>;
159
+ }
160
+
161
+ declare class Boards {
162
+ private client;
163
+ constructor(client: AirBase);
164
+ list(params?: BoardListParams): PagePromise<Board>;
165
+ get(boardId: string): Promise<Board>;
166
+ create(params: BoardCreateParams): Promise<Board>;
167
+ update(boardId: string, params: BoardUpdateParams): Promise<void>;
168
+ delete(boardId: string): Promise<void>;
169
+ addAssets(boardId: string, params: AddBoardAssetsParams): Promise<void>;
170
+ removeAsset(boardId: string, assetId: string): Promise<void>;
171
+ setCustomField(boardId: string, customFieldId: string, params: SetBoardCustomFieldParams): Promise<void>;
172
+ addGuest(boardId: string, params: AddGuestParams): Promise<Guest>;
173
+ listGuests(boardId: string, params?: GuestListParams): Promise<Guest[]>;
174
+ updateGuest(boardId: string, guestId: string, params: UpdateGuestParams): Promise<void>;
175
+ removeGuest(boardId: string, guestId: string): Promise<void>;
176
+ }
177
+
178
+ type CustomFieldType = "single-select" | "multi-select" | "plain-text" | "date";
179
+ interface CustomFieldValue {
180
+ id: string;
181
+ name: string;
182
+ }
183
+ interface CustomField {
184
+ id: string;
185
+ name: string;
186
+ description: string | null;
187
+ type: CustomFieldType;
188
+ values: CustomFieldValue[] | null;
189
+ createdAt: string;
190
+ updatedAt: string;
191
+ }
192
+ interface CustomFieldListParams extends CursorPageParams {
193
+ }
194
+ interface CustomFieldCreateParams {
195
+ name: string;
196
+ description?: string;
197
+ type: CustomFieldType;
198
+ values?: {
199
+ name: string;
200
+ }[];
201
+ }
202
+ interface CustomFieldUpdateParams {
203
+ name?: string;
204
+ description?: string;
205
+ }
206
+ interface CustomFieldValueCreateParams {
207
+ name: string;
208
+ }
209
+ interface CustomFieldValueUpdateParams {
210
+ name?: string;
211
+ }
212
+
213
+ declare class CustomFields {
214
+ private client;
215
+ constructor(client: AirBase);
216
+ list(params?: CustomFieldListParams): PagePromise<CustomField>;
217
+ get(customFieldId: string): Promise<CustomField>;
218
+ create(params: CustomFieldCreateParams): Promise<CustomField>;
219
+ update(customFieldId: string, params: CustomFieldUpdateParams): Promise<void>;
220
+ delete(customFieldId: string): Promise<void>;
221
+ createValue(customFieldId: string, params: CustomFieldValueCreateParams): Promise<CustomFieldValue>;
222
+ updateValue(customFieldId: string, valueId: string, params: CustomFieldValueUpdateParams): Promise<void>;
223
+ deleteValue(customFieldId: string, valueId: string): Promise<void>;
224
+ }
225
+
226
+ interface ImportCreateParams {
227
+ sourceUrl: string;
228
+ fileName?: string;
229
+ ext?: string;
230
+ recordedAt?: string;
231
+ parentBoardId?: string;
232
+ assetId?: string;
233
+ description?: string;
234
+ title?: string;
235
+ customFields?: {
236
+ id: string;
237
+ value?: string | null;
238
+ values?: {
239
+ id: string;
240
+ }[] | null;
241
+ }[] | null;
242
+ tags?: {
243
+ id: string;
244
+ }[] | null;
245
+ }
246
+ interface ImportCreateResponse {
247
+ id: string;
248
+ assetId: string;
249
+ versionId: string;
250
+ }
251
+ type ImportStatus = "pending" | "inProgress" | "succeeded" | "failed";
252
+ interface ImportStatusResponse {
253
+ status: ImportStatus;
254
+ error?: {
255
+ type: string;
256
+ message: string;
257
+ };
258
+ }
259
+
260
+ declare class Imports {
261
+ private client;
262
+ constructor(client: AirBase);
263
+ create(params: ImportCreateParams): Promise<ImportCreateResponse>;
264
+ getStatus(importId: string): Promise<ImportStatusResponse>;
265
+ }
266
+
267
+ interface Role {
268
+ id: string;
269
+ name: string;
270
+ description: string;
271
+ billable: boolean;
272
+ type: string;
273
+ }
274
+ interface RoleListParams {
275
+ type: "guest";
276
+ }
277
+ interface RoleListResponse {
278
+ data: Role[];
279
+ }
280
+
281
+ declare class Roles {
282
+ private client;
283
+ constructor(client: AirBase);
284
+ list(params?: RoleListParams): Promise<Role[]>;
285
+ }
286
+
287
+ declare class Tags {
288
+ private client;
289
+ constructor(client: AirBase);
290
+ list(params?: TagListParams): PagePromise<Tag>;
291
+ get(tagId: string): Promise<Tag>;
292
+ create(params: TagCreateParams): Promise<Tag>;
293
+ update(tagId: string, params: TagUpdateParams): Promise<void>;
294
+ delete(tagId: string): Promise<void>;
295
+ }
296
+
297
+ interface UploadCreateParams {
298
+ fileName: string;
299
+ ext: string;
300
+ size: number;
301
+ mime: string;
302
+ recordedAt?: string;
303
+ parentBoardId?: string;
304
+ assetId?: string;
305
+ customFields?: {
306
+ id: string;
307
+ value?: string | null;
308
+ values?: {
309
+ id: string;
310
+ }[] | null;
311
+ }[] | null;
312
+ tags?: {
313
+ id: string;
314
+ }[] | null;
315
+ }
316
+ interface SmallUploadResponse {
317
+ assetId: string;
318
+ versionId: string;
319
+ uploadUrl: string;
320
+ }
321
+ interface LargeUploadResponse {
322
+ assetId: string;
323
+ versionId: string;
324
+ multiPartUploadId: string;
325
+ key: string;
326
+ }
327
+ type UploadCreateResponse = SmallUploadResponse | LargeUploadResponse;
328
+ interface GetPartUploadUrlParams {
329
+ multiPartUploadId: string;
330
+ key: string;
331
+ partNumber: number;
332
+ }
333
+ interface GetPartUploadUrlResponse {
334
+ url: string;
335
+ }
336
+ interface CompleteMultipartParams {
337
+ multiPartUploadId: string;
338
+ key: string;
339
+ parts: {
340
+ etag: string;
341
+ partNumber: number;
342
+ }[];
343
+ }
344
+ interface UploadFileParams {
345
+ filePath?: string;
346
+ buffer?: Buffer | ArrayBuffer;
347
+ file?: File;
348
+ fileName?: string;
349
+ ext?: string;
350
+ mime?: string;
351
+ }
352
+ interface UploadFileOptions {
353
+ parentBoardId?: string;
354
+ assetId?: string;
355
+ customFields?: {
356
+ id: string;
357
+ value?: string | null;
358
+ values?: {
359
+ id: string;
360
+ }[] | null;
361
+ }[] | null;
362
+ tags?: {
363
+ id: string;
364
+ }[] | null;
365
+ onProgress?: (progress: {
366
+ percentage: number;
367
+ uploadedBytes: number;
368
+ totalBytes: number;
369
+ }) => void;
370
+ }
371
+ interface UploadFileResponse {
372
+ assetId: string;
373
+ versionId: string;
374
+ }
375
+
376
+ declare class Uploads {
377
+ private client;
378
+ constructor(client: AirBase);
379
+ create(params: UploadCreateParams): Promise<UploadCreateResponse>;
380
+ getPartUploadUrl(params: GetPartUploadUrlParams): Promise<GetPartUploadUrlResponse>;
381
+ completeMultipart(params: CompleteMultipartParams): Promise<void>;
382
+ uploadFile(params: UploadFileParams, options?: UploadFileOptions): Promise<UploadFileResponse>;
383
+ private _uploadSmallFile;
384
+ private _uploadLargeFile;
385
+ }
386
+
387
+ interface AirApiOptions extends AirBaseOptions {
388
+ }
389
+ declare class AirApi extends AirBase {
390
+ readonly assets: Assets;
391
+ readonly boards: Boards;
392
+ readonly tags: Tags;
393
+ readonly customFields: CustomFields;
394
+ readonly roles: Roles;
395
+ readonly imports: Imports;
396
+ readonly uploads: Uploads;
397
+ constructor(options?: AirApiOptions);
398
+ }
399
+
400
+ export { type AddBoardAssetsParams, type AddGuestParams, type AddVersionTagParams, AirApi, type AirApiOptions, type Asset, type AssetBoardListParams, type AssetCustomFieldValue, type AssetListParams, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardUpdateParams, Boards, type CompleteMultipartParams, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldType, type CustomFieldUpdateParams, type CustomFieldValue, type CustomFieldValueCreateParams, type CustomFieldValueUpdateParams, CustomFields, type GetPartUploadUrlParams, type GetPartUploadUrlResponse, type Guest, type GuestListParams, type GuestListResponse, type ImportCreateParams, type ImportCreateResponse, type ImportStatus, type ImportStatusResponse, Imports, type LargeUploadResponse, type Role, type RoleListParams, type RoleListResponse, Roles, type SetBoardCustomFieldParams, type SetCustomFieldParams, type SmallUploadResponse, type SmartTag, type Tag, type TagCreateParams, type TagListParams, type TagUpdateParams, Tags, type UpdateGuestParams, type UploadCreateParams, type UploadCreateResponse, type UploadFileOptions, type UploadFileParams, type UploadFileResponse, Uploads };