• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-typescript-sdk-gen / 12885736841

21 Jan 2025 11:12AM UTC coverage: 42.412% (-0.007%) from 42.419%
12885736841

Pull #489

github

web-flow
Merge 93beb8af7 into 2a24c7a0d
Pull Request #489: fix: correct param types in file representation (box/box-openapi#503)

3990 of 16001 branches covered (24.94%)

Branch coverage included in aggregate %.

1 of 5 new or added lines in 2 files covered. (20.0%)

4 existing lines in 2 files now uncovered.

14247 of 26999 relevant lines covered (52.77%)

92.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.06
/src/schemas/fileFull.generated.ts
1
import { serializeFileBaseTypeField } from './fileBase.generated.js';
2
import { deserializeFileBaseTypeField } from './fileBase.generated.js';
144✔
3
import { serializeFileBase } from './fileBase.generated.js';
4
import { deserializeFileBase } from './fileBase.generated.js';
5
import { serializeFileVersionMini } from './fileVersionMini.generated.js';
6
import { deserializeFileVersionMini } from './fileVersionMini.generated.js';
144✔
7
import { serializeFileMini } from './fileMini.generated.js';
8
import { deserializeFileMini } from './fileMini.generated.js';
9
import { serializeFilePathCollectionField } from './file.generated.js';
10
import { deserializeFilePathCollectionField } from './file.generated.js';
144✔
11
import { serializeFileSharedLinkField } from './file.generated.js';
12
import { deserializeFileSharedLinkField } from './file.generated.js';
144✔
13
import { serializeFolderMini } from './folderMini.generated.js';
14
import { deserializeFolderMini } from './folderMini.generated.js';
144✔
15
import { serializeFileItemStatusField } from './file.generated.js';
16
import { deserializeFileItemStatusField } from './file.generated.js';
144✔
17
import { serializeFile } from './file.generated.js';
144✔
18
import { deserializeFile } from './file.generated.js';
19
import { serializeUserMini } from './userMini.generated.js';
144✔
20
import { deserializeUserMini } from './userMini.generated.js';
144✔
21
import { serializeFileOrFolderScope } from './fileOrFolderScope.generated.js';
144✔
22
import { deserializeFileOrFolderScope } from './fileOrFolderScope.generated.js';
144✔
23
import { serializeMetadataFull } from './metadataFull.generated.js';
24
import { deserializeMetadataFull } from './metadataFull.generated.js';
144✔
25
import { serializeDateTime } from '../internal/utils.js';
144✔
26
import { deserializeDateTime } from '../internal/utils.js';
144✔
27
import { FileBaseTypeField } from './fileBase.generated.js';
28
import { FileBase } from './fileBase.generated.js';
29
import { FileVersionMini } from './fileVersionMini.generated.js';
30
import { FileMini } from './fileMini.generated.js';
31
import { FilePathCollectionField } from './file.generated.js';
32
import { FileSharedLinkField } from './file.generated.js';
33
import { FolderMini } from './folderMini.generated.js';
34
import { FileItemStatusField } from './file.generated.js';
35
import { File } from './file.generated.js';
144✔
36
import { UserMini } from './userMini.generated.js';
37
import { FileOrFolderScope } from './fileOrFolderScope.generated.js';
38
import { MetadataFull } from './metadataFull.generated.js';
39
import { BoxSdkError } from '../box/errors.js';
144✔
40
import { DateTime } from '../internal/utils.js';
41
import { SerializedData } from '../serialization/json.js';
42
import { sdIsEmpty } from '../serialization/json.js';
43
import { sdIsBoolean } from '../serialization/json.js';
144✔
44
import { sdIsNumber } from '../serialization/json.js';
144✔
45
import { sdIsString } from '../serialization/json.js';
144✔
46
import { sdIsList } from '../serialization/json.js';
144✔
47
import { sdIsMap } from '../serialization/json.js';
144✔
48
export interface FileFullPermissionsField {
49
  /**
50
   * Specifies if the current user can delete this item. */
51
  readonly canDelete: boolean;
52
  /**
53
   * Specifies if the current user can download this item. */
54
  readonly canDownload: boolean;
55
  /**
56
   * Specifies if the current user can invite new
57
   * users to collaborate on this item, and if the user can
58
   * update the role of a user already collaborated on this
59
   * item. */
60
  readonly canInviteCollaborator: boolean;
61
  /**
62
   * Specifies if the user can rename this item. */
63
  readonly canRename: boolean;
64
  /**
65
   * Specifies if the user can change the access level of an
66
   * existing shared link on this item. */
67
  readonly canSetShareAccess: boolean;
68
  /**
69
   * Specifies if the user can create a shared link for this item. */
70
  readonly canShare: boolean;
71
  /**
72
   * Specifies if the user can place annotations on this file. */
73
  readonly canAnnotate: boolean;
74
  /**
75
   * Specifies if the user can place comments on this file. */
76
  readonly canComment: boolean;
77
  /**
78
   * Specifies if the user can preview this file. */
79
  readonly canPreview: boolean;
80
  /**
81
   * Specifies if the user can upload a new version of this file. */
82
  readonly canUpload: boolean;
83
  /**
84
   * Specifies if the user view all annotations placed on this file */
85
  readonly canViewAnnotationsAll: boolean;
86
  /**
87
   * Specifies if the user view annotations placed by themselves
88
   * on this file */
89
  readonly canViewAnnotationsSelf: boolean;
90
  readonly rawData?: SerializedData;
91
}
92
export type FileFullLockTypeField = 'lock';
93
export type FileFullLockAppTypeField =
94
  | 'gsuite'
95
  | 'office_wopi'
96
  | 'office_wopiplus'
97
  | 'other'
98
  | string;
99
export interface FileFullLockField {
100
  /**
101
   * The unique identifier for this lock */
102
  readonly id?: string;
103
  /**
104
   * `lock` */
105
  readonly type?: FileFullLockTypeField;
106
  readonly createdBy?: UserMini;
107
  /**
108
   * The time this lock was created at. */
109
  readonly createdAt?: DateTime;
110
  /**
111
   * The time this lock is to expire at, which might be in the past. */
112
  readonly expiredAt?: DateTime;
113
  /**
114
   * Whether or not the file can be downloaded while locked. */
115
  readonly isDownloadPrevented?: boolean;
116
  /**
117
   * If the lock is managed by an application rather than a user, this
118
   * field identifies the type of the application that holds the lock.
119
   * This is an open enum and may be extended with additional values in
120
   * the future. */
121
  readonly appType?: FileFullLockAppTypeField | null;
122
  readonly rawData?: SerializedData;
123
}
124
export type FileFullExpiringEmbedLinkTokenTypeField = 'bearer' | string;
125
export interface FileFullExpiringEmbedLinkField {
126
  /**
127
   * The requested access token. */
128
  readonly accessToken?: string;
129
  /**
130
   * The time in seconds by which this token will expire. */
131
  readonly expiresIn?: number;
132
  /**
133
   * The type of access token returned. */
134
  readonly tokenType?: FileFullExpiringEmbedLinkTokenTypeField;
135
  /**
136
   * The permissions that this access token permits,
137
   * providing a list of resources (files, folders, etc)
138
   * and the scopes permitted for each of those resources. */
139
  readonly restrictedTo?: readonly FileOrFolderScope[];
140
  /**
141
   * The actual expiring embed URL for this file, constructed
142
   * from the file ID and access tokens specified in this object. */
143
  readonly url?: string;
144
  readonly rawData?: SerializedData;
145
}
146
export interface FileFullWatermarkInfoField {
147
  /**
148
   * Specifies if this item has a watermark applied. */
149
  readonly isWatermarked?: boolean;
150
  readonly rawData?: SerializedData;
151
}
152
export type FileFullAllowedInviteeRolesField =
153
  | 'editor'
154
  | 'viewer'
155
  | 'previewer'
156
  | 'uploader'
157
  | 'previewer uploader'
158
  | 'viewer uploader'
159
  | 'co-owner'
160
  | string;
161
export interface FileFullMetadataField {
162
  readonly extraData?: {
163
    readonly [key: string]: {
164
      readonly [key: string]: MetadataFull;
165
    };
166
  };
167
  readonly rawData?: SerializedData;
168
}
169
export interface FileFullRepresentationsEntriesContentField {
170
  /**
171
   * The download URL that can be used to fetch the representation.
172
   * Make sure to make an authenticated API call to this endpoint.
173
   *
174
   * This URL is a template and will require the `{+asset_path}` to
175
   * be replaced by a path. In general, for unpaged representations
176
   * it can be replaced by an empty string.
177
   *
178
   * For paged representations, replace the `{+asset_path}` with the
179
   * page to request plus the extension for the file, for example
180
   * `1.pdf`.
181
   *
182
   * When requesting the download URL the following additional
183
   * query params can be passed along.
184
   *
185
   * * `set_content_disposition_type` - Sets the
186
   * `Content-Disposition` header in the API response with the
187
   * specified disposition type of either `inline` or `attachment`.
188
   * If not supplied, the `Content-Disposition` header is not
189
   * included in the response.
190
   *
191
   * * `set_content_disposition_filename` - Allows the application to
192
   *   define the representation's file name used in the
193
   *   `Content-Disposition` header.  If not defined, the filename
194
   *   is derived from the source file name in Box combined with the
195
   *   extension of the representation. */
196
  readonly urlTemplate?: string;
197
  readonly rawData?: SerializedData;
198
}
199
export interface FileFullRepresentationsEntriesInfoField {
200
  /**
201
   * The API URL that can be used to get more info on this file
202
   * representation. Make sure to make an authenticated API call
203
   * to this endpoint. */
204
  readonly url?: string;
205
  readonly rawData?: SerializedData;
206
}
207
export interface FileFullRepresentationsEntriesPropertiesField {
208
  /**
209
   * The width by height size of this representation in pixels. */
210
  readonly dimensions?: string;
211
  /**
212
   * Indicates if the representation is build up out of multiple
213
   * pages. */
214
  readonly paged?: string;
215
  /**
216
   * Indicates if the representation can be used as a thumbnail of
217
   * the file. */
218
  readonly thumb?: string;
219
  readonly rawData?: SerializedData;
220
}
221
export type FileFullRepresentationsEntriesStatusStateField =
222
  | 'success'
223
  | 'viewable'
224
  | 'pending'
225
  | 'none'
226
  | string;
227
export interface FileFullRepresentationsEntriesStatusField {
228
  /**
229
   * The status of the representation.
230
   *
231
   * * `success` defines the representation as ready to be viewed.
232
   * * `viewable` defines a video to be ready for viewing.
233
   * * `pending` defines the representation as to be generated. Retry
234
   *   this endpoint to re-check the status.
235
   * * `none` defines that the representation will be created when
236
   *   requested. Request the URL defined in the `info` object to
237
   *   trigger this generation. */
238
  readonly state?: FileFullRepresentationsEntriesStatusStateField;
239
  readonly rawData?: SerializedData;
240
}
241
export interface FileFullRepresentationsEntriesField {
242
  /**
243
   * An object containing the URL that can be used to actually fetch
244
   * the representation. */
245
  readonly content?: FileFullRepresentationsEntriesContentField;
246
  /**
247
   * An object containing the URL that can be used to fetch more info
248
   * on this representation. */
249
  readonly info?: FileFullRepresentationsEntriesInfoField;
250
  /**
251
   * An object containing the size and type of this presentation. */
252
  readonly properties?: FileFullRepresentationsEntriesPropertiesField;
253
  /**
254
   * Indicates the file type of the returned representation. */
255
  readonly representation?: string;
256
  /**
257
   * An object containing the status of this representation. */
258
  readonly status?: FileFullRepresentationsEntriesStatusField;
259
  readonly rawData?: SerializedData;
260
}
261
export interface FileFullRepresentationsField {
262
  /**
263
   * A list of files */
264
  readonly entries?: readonly FileFullRepresentationsEntriesField[];
265
  readonly rawData?: SerializedData;
266
}
267
export interface FileFullClassificationField {
268
  /**
269
   * The name of the classification */
270
  readonly name?: string;
271
  /**
272
   * An explanation of the meaning of this classification. */
273
  readonly definition?: string;
274
  /**
275
   * The color that is used to display the
276
   * classification label in a user-interface. Colors are defined by the admin
277
   * or co-admin who created the classification in the Box web app. */
278
  readonly color?: string;
279
  readonly rawData?: SerializedData;
280
}
281
export type FileFullSharedLinkPermissionOptionsField =
282
  | 'can_preview'
283
  | 'can_download'
284
  | 'can_edit'
285
  | string;
286
export class FileFull extends File {
144✔
287
  readonly versionNumber?: string;
288
  readonly commentCount?: number;
289
  readonly permissions?: FileFullPermissionsField;
290
  readonly tags?: readonly string[];
291
  readonly lock?: FileFullLockField | null;
292
  readonly extension?: string;
293
  readonly isPackage?: boolean;
294
  readonly expiringEmbedLink?: FileFullExpiringEmbedLinkField;
295
  readonly watermarkInfo?: FileFullWatermarkInfoField;
296
  readonly isAccessibleViaSharedLink?: boolean;
297
  readonly allowedInviteeRoles?: readonly FileFullAllowedInviteeRolesField[];
298
  readonly isExternallyOwned?: boolean;
299
  readonly hasCollaborations?: boolean;
300
  readonly metadata?: FileFullMetadataField;
301
  readonly expiresAt?: DateTime | null;
302
  readonly representations?: FileFullRepresentationsField;
303
  readonly classification?: FileFullClassificationField;
304
  readonly uploaderDisplayName?: string;
305
  readonly dispositionAt?: DateTime | null;
306
  readonly sharedLinkPermissionOptions?:
307
    | readonly FileFullSharedLinkPermissionOptionsField[]
308
    | null;
309
  readonly isAssociatedWithAppItem?: boolean;
310
  constructor(fields: FileFull) {
311
    super(fields);
×
312
    if (fields.versionNumber !== undefined) {
×
313
      this.versionNumber = fields.versionNumber;
×
314
    }
315
    if (fields.commentCount !== undefined) {
×
316
      this.commentCount = fields.commentCount;
×
317
    }
318
    if (fields.permissions !== undefined) {
×
319
      this.permissions = fields.permissions;
×
320
    }
321
    if (fields.tags !== undefined) {
×
322
      this.tags = fields.tags;
×
323
    }
324
    if (fields.lock !== undefined) {
×
325
      this.lock = fields.lock;
×
326
    }
327
    if (fields.extension !== undefined) {
×
328
      this.extension = fields.extension;
×
329
    }
330
    if (fields.isPackage !== undefined) {
×
331
      this.isPackage = fields.isPackage;
×
332
    }
333
    if (fields.expiringEmbedLink !== undefined) {
×
334
      this.expiringEmbedLink = fields.expiringEmbedLink;
×
335
    }
336
    if (fields.watermarkInfo !== undefined) {
×
337
      this.watermarkInfo = fields.watermarkInfo;
×
338
    }
339
    if (fields.isAccessibleViaSharedLink !== undefined) {
×
340
      this.isAccessibleViaSharedLink = fields.isAccessibleViaSharedLink;
×
341
    }
342
    if (fields.allowedInviteeRoles !== undefined) {
×
343
      this.allowedInviteeRoles = fields.allowedInviteeRoles;
×
344
    }
345
    if (fields.isExternallyOwned !== undefined) {
×
346
      this.isExternallyOwned = fields.isExternallyOwned;
×
347
    }
348
    if (fields.hasCollaborations !== undefined) {
×
349
      this.hasCollaborations = fields.hasCollaborations;
×
350
    }
351
    if (fields.metadata !== undefined) {
×
352
      this.metadata = fields.metadata;
×
353
    }
354
    if (fields.expiresAt !== undefined) {
×
355
      this.expiresAt = fields.expiresAt;
×
356
    }
357
    if (fields.representations !== undefined) {
×
358
      this.representations = fields.representations;
×
359
    }
360
    if (fields.classification !== undefined) {
×
361
      this.classification = fields.classification;
×
362
    }
363
    if (fields.uploaderDisplayName !== undefined) {
×
364
      this.uploaderDisplayName = fields.uploaderDisplayName;
×
365
    }
366
    if (fields.dispositionAt !== undefined) {
×
367
      this.dispositionAt = fields.dispositionAt;
×
368
    }
369
    if (fields.sharedLinkPermissionOptions !== undefined) {
×
370
      this.sharedLinkPermissionOptions = fields.sharedLinkPermissionOptions;
×
371
    }
372
    if (fields.isAssociatedWithAppItem !== undefined) {
×
373
      this.isAssociatedWithAppItem = fields.isAssociatedWithAppItem;
×
374
    }
375
  }
376
}
377
export function serializeFileFullPermissionsField(
144✔
378
  val: FileFullPermissionsField,
379
): SerializedData {
380
  return {
×
381
    ['can_delete']: val.canDelete,
382
    ['can_download']: val.canDownload,
383
    ['can_invite_collaborator']: val.canInviteCollaborator,
384
    ['can_rename']: val.canRename,
385
    ['can_set_share_access']: val.canSetShareAccess,
386
    ['can_share']: val.canShare,
387
    ['can_annotate']: val.canAnnotate,
388
    ['can_comment']: val.canComment,
389
    ['can_preview']: val.canPreview,
390
    ['can_upload']: val.canUpload,
391
    ['can_view_annotations_all']: val.canViewAnnotationsAll,
392
    ['can_view_annotations_self']: val.canViewAnnotationsSelf,
393
  };
394
}
395
export function deserializeFileFullPermissionsField(
144✔
396
  val: SerializedData,
397
): FileFullPermissionsField {
398
  if (!sdIsMap(val)) {
×
399
    throw new BoxSdkError({
×
400
      message: 'Expecting a map for "FileFullPermissionsField"',
401
    });
402
  }
403
  if (val.can_delete == void 0) {
×
404
    throw new BoxSdkError({
×
405
      message:
406
        'Expecting "can_delete" of type "FileFullPermissionsField" to be defined',
407
    });
408
  }
409
  if (!sdIsBoolean(val.can_delete)) {
×
410
    throw new BoxSdkError({
×
411
      message:
412
        'Expecting boolean for "can_delete" of type "FileFullPermissionsField"',
413
    });
414
  }
415
  const canDelete: boolean = val.can_delete;
×
416
  if (val.can_download == void 0) {
×
417
    throw new BoxSdkError({
×
418
      message:
419
        'Expecting "can_download" of type "FileFullPermissionsField" to be defined',
420
    });
421
  }
422
  if (!sdIsBoolean(val.can_download)) {
×
423
    throw new BoxSdkError({
×
424
      message:
425
        'Expecting boolean for "can_download" of type "FileFullPermissionsField"',
426
    });
427
  }
428
  const canDownload: boolean = val.can_download;
×
429
  if (val.can_invite_collaborator == void 0) {
×
430
    throw new BoxSdkError({
×
431
      message:
432
        'Expecting "can_invite_collaborator" of type "FileFullPermissionsField" to be defined',
433
    });
434
  }
435
  if (!sdIsBoolean(val.can_invite_collaborator)) {
×
436
    throw new BoxSdkError({
×
437
      message:
438
        'Expecting boolean for "can_invite_collaborator" of type "FileFullPermissionsField"',
439
    });
440
  }
441
  const canInviteCollaborator: boolean = val.can_invite_collaborator;
×
442
  if (val.can_rename == void 0) {
×
443
    throw new BoxSdkError({
×
444
      message:
445
        'Expecting "can_rename" of type "FileFullPermissionsField" to be defined',
446
    });
447
  }
448
  if (!sdIsBoolean(val.can_rename)) {
×
449
    throw new BoxSdkError({
×
450
      message:
451
        'Expecting boolean for "can_rename" of type "FileFullPermissionsField"',
452
    });
453
  }
454
  const canRename: boolean = val.can_rename;
×
455
  if (val.can_set_share_access == void 0) {
×
456
    throw new BoxSdkError({
×
457
      message:
458
        'Expecting "can_set_share_access" of type "FileFullPermissionsField" to be defined',
459
    });
460
  }
461
  if (!sdIsBoolean(val.can_set_share_access)) {
×
462
    throw new BoxSdkError({
×
463
      message:
464
        'Expecting boolean for "can_set_share_access" of type "FileFullPermissionsField"',
465
    });
466
  }
467
  const canSetShareAccess: boolean = val.can_set_share_access;
×
468
  if (val.can_share == void 0) {
×
469
    throw new BoxSdkError({
×
470
      message:
471
        'Expecting "can_share" of type "FileFullPermissionsField" to be defined',
472
    });
473
  }
474
  if (!sdIsBoolean(val.can_share)) {
×
475
    throw new BoxSdkError({
×
476
      message:
477
        'Expecting boolean for "can_share" of type "FileFullPermissionsField"',
478
    });
479
  }
480
  const canShare: boolean = val.can_share;
×
481
  if (val.can_annotate == void 0) {
×
482
    throw new BoxSdkError({
×
483
      message:
484
        'Expecting "can_annotate" of type "FileFullPermissionsField" to be defined',
485
    });
486
  }
487
  if (!sdIsBoolean(val.can_annotate)) {
×
488
    throw new BoxSdkError({
×
489
      message:
490
        'Expecting boolean for "can_annotate" of type "FileFullPermissionsField"',
491
    });
492
  }
493
  const canAnnotate: boolean = val.can_annotate;
×
494
  if (val.can_comment == void 0) {
×
495
    throw new BoxSdkError({
×
496
      message:
497
        'Expecting "can_comment" of type "FileFullPermissionsField" to be defined',
498
    });
499
  }
500
  if (!sdIsBoolean(val.can_comment)) {
×
501
    throw new BoxSdkError({
×
502
      message:
503
        'Expecting boolean for "can_comment" of type "FileFullPermissionsField"',
504
    });
505
  }
506
  const canComment: boolean = val.can_comment;
×
507
  if (val.can_preview == void 0) {
×
508
    throw new BoxSdkError({
×
509
      message:
510
        'Expecting "can_preview" of type "FileFullPermissionsField" to be defined',
511
    });
512
  }
513
  if (!sdIsBoolean(val.can_preview)) {
×
514
    throw new BoxSdkError({
×
515
      message:
516
        'Expecting boolean for "can_preview" of type "FileFullPermissionsField"',
517
    });
518
  }
519
  const canPreview: boolean = val.can_preview;
×
520
  if (val.can_upload == void 0) {
×
521
    throw new BoxSdkError({
×
522
      message:
523
        'Expecting "can_upload" of type "FileFullPermissionsField" to be defined',
524
    });
525
  }
526
  if (!sdIsBoolean(val.can_upload)) {
×
527
    throw new BoxSdkError({
×
528
      message:
529
        'Expecting boolean for "can_upload" of type "FileFullPermissionsField"',
530
    });
531
  }
532
  const canUpload: boolean = val.can_upload;
×
533
  if (val.can_view_annotations_all == void 0) {
×
534
    throw new BoxSdkError({
×
535
      message:
536
        'Expecting "can_view_annotations_all" of type "FileFullPermissionsField" to be defined',
537
    });
538
  }
539
  if (!sdIsBoolean(val.can_view_annotations_all)) {
×
540
    throw new BoxSdkError({
×
541
      message:
542
        'Expecting boolean for "can_view_annotations_all" of type "FileFullPermissionsField"',
543
    });
544
  }
545
  const canViewAnnotationsAll: boolean = val.can_view_annotations_all;
×
546
  if (val.can_view_annotations_self == void 0) {
×
547
    throw new BoxSdkError({
×
548
      message:
549
        'Expecting "can_view_annotations_self" of type "FileFullPermissionsField" to be defined',
550
    });
551
  }
552
  if (!sdIsBoolean(val.can_view_annotations_self)) {
×
553
    throw new BoxSdkError({
×
554
      message:
555
        'Expecting boolean for "can_view_annotations_self" of type "FileFullPermissionsField"',
556
    });
557
  }
558
  const canViewAnnotationsSelf: boolean = val.can_view_annotations_self;
×
559
  return {
×
560
    canDelete: canDelete,
561
    canDownload: canDownload,
562
    canInviteCollaborator: canInviteCollaborator,
563
    canRename: canRename,
564
    canSetShareAccess: canSetShareAccess,
565
    canShare: canShare,
566
    canAnnotate: canAnnotate,
567
    canComment: canComment,
568
    canPreview: canPreview,
569
    canUpload: canUpload,
570
    canViewAnnotationsAll: canViewAnnotationsAll,
571
    canViewAnnotationsSelf: canViewAnnotationsSelf,
572
  } satisfies FileFullPermissionsField;
573
}
574
export function serializeFileFullLockTypeField(
144✔
575
  val: FileFullLockTypeField,
576
): SerializedData {
577
  return val;
×
578
}
579
export function deserializeFileFullLockTypeField(
144✔
580
  val: SerializedData,
581
): FileFullLockTypeField {
582
  if (val == 'lock') {
2✔
583
    return val;
2✔
584
  }
585
  throw new BoxSdkError({ message: "Can't deserialize FileFullLockTypeField" });
×
586
}
587
export function serializeFileFullLockAppTypeField(
144✔
588
  val: FileFullLockAppTypeField,
589
): SerializedData {
590
  return val;
×
591
}
592
export function deserializeFileFullLockAppTypeField(
144✔
593
  val: SerializedData,
594
): FileFullLockAppTypeField {
595
  if (val == 'gsuite') {
×
596
    return val;
×
597
  }
598
  if (val == 'office_wopi') {
×
599
    return val;
×
600
  }
601
  if (val == 'office_wopiplus') {
×
602
    return val;
×
603
  }
604
  if (val == 'other') {
×
605
    return val;
×
606
  }
607
  if (sdIsString(val)) {
×
608
    return val;
×
609
  }
610
  throw new BoxSdkError({
×
611
    message: "Can't deserialize FileFullLockAppTypeField",
612
  });
613
}
614
export function serializeFileFullLockField(
144✔
615
  val: FileFullLockField,
616
): SerializedData {
617
  return {
×
618
    ['id']: val.id,
619
    ['type']:
620
      val.type == void 0 ? val.type : serializeFileFullLockTypeField(val.type),
×
621
    ['created_by']:
622
      val.createdBy == void 0
×
623
        ? val.createdBy
624
        : serializeUserMini(val.createdBy),
625
    ['created_at']:
626
      val.createdAt == void 0
×
627
        ? val.createdAt
628
        : serializeDateTime(val.createdAt),
629
    ['expired_at']:
630
      val.expiredAt == void 0
×
631
        ? val.expiredAt
632
        : serializeDateTime(val.expiredAt),
633
    ['is_download_prevented']: val.isDownloadPrevented,
634
    ['app_type']:
635
      val.appType == void 0
×
636
        ? val.appType
637
        : serializeFileFullLockAppTypeField(val.appType),
638
  };
639
}
640
export function deserializeFileFullLockField(
144✔
641
  val: SerializedData,
642
): FileFullLockField {
643
  if (!sdIsMap(val)) {
2!
644
    throw new BoxSdkError({
×
645
      message: 'Expecting a map for "FileFullLockField"',
646
    });
647
  }
648
  if (!(val.id == void 0) && !sdIsString(val.id)) {
2!
649
    throw new BoxSdkError({
×
650
      message: 'Expecting string for "id" of type "FileFullLockField"',
651
    });
652
  }
653
  const id: undefined | string = val.id == void 0 ? void 0 : val.id;
2!
654
  const type: undefined | FileFullLockTypeField =
655
    val.type == void 0 ? void 0 : deserializeFileFullLockTypeField(val.type);
2!
656
  const createdBy: undefined | UserMini =
657
    val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by);
2!
658
  if (!(val.created_at == void 0) && !sdIsString(val.created_at)) {
2!
659
    throw new BoxSdkError({
×
660
      message: 'Expecting string for "created_at" of type "FileFullLockField"',
661
    });
662
  }
663
  const createdAt: undefined | DateTime =
664
    val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at);
2!
665
  if (!(val.expired_at == void 0) && !sdIsString(val.expired_at)) {
2!
666
    throw new BoxSdkError({
×
667
      message: 'Expecting string for "expired_at" of type "FileFullLockField"',
668
    });
669
  }
670
  const expiredAt: undefined | DateTime =
671
    val.expired_at == void 0 ? void 0 : deserializeDateTime(val.expired_at);
2!
672
  if (
2!
673
    !(val.is_download_prevented == void 0) &&
4✔
674
    !sdIsBoolean(val.is_download_prevented)
675
  ) {
676
    throw new BoxSdkError({
×
677
      message:
678
        'Expecting boolean for "is_download_prevented" of type "FileFullLockField"',
679
    });
680
  }
681
  const isDownloadPrevented: undefined | boolean =
682
    val.is_download_prevented == void 0 ? void 0 : val.is_download_prevented;
2!
683
  const appType: undefined | FileFullLockAppTypeField =
684
    val.app_type == void 0
2!
685
      ? void 0
686
      : deserializeFileFullLockAppTypeField(val.app_type);
687
  return {
2✔
688
    id: id,
689
    type: type,
690
    createdBy: createdBy,
691
    createdAt: createdAt,
692
    expiredAt: expiredAt,
693
    isDownloadPrevented: isDownloadPrevented,
694
    appType: appType,
695
  } satisfies FileFullLockField;
696
}
697
export function serializeFileFullExpiringEmbedLinkTokenTypeField(
144✔
698
  val: FileFullExpiringEmbedLinkTokenTypeField,
699
): SerializedData {
700
  return val;
×
701
}
702
export function deserializeFileFullExpiringEmbedLinkTokenTypeField(
144✔
703
  val: SerializedData,
704
): FileFullExpiringEmbedLinkTokenTypeField {
705
  if (val == 'bearer') {
×
706
    return val;
×
707
  }
708
  if (sdIsString(val)) {
×
709
    return val;
×
710
  }
711
  throw new BoxSdkError({
×
712
    message: "Can't deserialize FileFullExpiringEmbedLinkTokenTypeField",
713
  });
714
}
715
export function serializeFileFullExpiringEmbedLinkField(
144✔
716
  val: FileFullExpiringEmbedLinkField,
717
): SerializedData {
718
  return {
×
719
    ['access_token']: val.accessToken,
720
    ['expires_in']: val.expiresIn,
721
    ['token_type']:
722
      val.tokenType == void 0
×
723
        ? val.tokenType
724
        : serializeFileFullExpiringEmbedLinkTokenTypeField(val.tokenType),
725
    ['restricted_to']:
726
      val.restrictedTo == void 0
×
727
        ? val.restrictedTo
728
        : (val.restrictedTo.map(function (
729
            item: FileOrFolderScope,
730
          ): SerializedData {
731
            return serializeFileOrFolderScope(item);
×
732
          }) as readonly any[]),
733
    ['url']: val.url,
734
  };
735
}
736
export function deserializeFileFullExpiringEmbedLinkField(
144✔
737
  val: SerializedData,
738
): FileFullExpiringEmbedLinkField {
739
  if (!sdIsMap(val)) {
×
740
    throw new BoxSdkError({
×
741
      message: 'Expecting a map for "FileFullExpiringEmbedLinkField"',
742
    });
743
  }
744
  if (!(val.access_token == void 0) && !sdIsString(val.access_token)) {
×
745
    throw new BoxSdkError({
×
746
      message:
747
        'Expecting string for "access_token" of type "FileFullExpiringEmbedLinkField"',
748
    });
749
  }
750
  const accessToken: undefined | string =
751
    val.access_token == void 0 ? void 0 : val.access_token;
×
752
  if (!(val.expires_in == void 0) && !sdIsNumber(val.expires_in)) {
×
753
    throw new BoxSdkError({
×
754
      message:
755
        'Expecting number for "expires_in" of type "FileFullExpiringEmbedLinkField"',
756
    });
757
  }
758
  const expiresIn: undefined | number =
759
    val.expires_in == void 0 ? void 0 : val.expires_in;
×
760
  const tokenType: undefined | FileFullExpiringEmbedLinkTokenTypeField =
761
    val.token_type == void 0
×
762
      ? void 0
763
      : deserializeFileFullExpiringEmbedLinkTokenTypeField(val.token_type);
764
  if (!(val.restricted_to == void 0) && !sdIsList(val.restricted_to)) {
×
765
    throw new BoxSdkError({
×
766
      message:
767
        'Expecting array for "restricted_to" of type "FileFullExpiringEmbedLinkField"',
768
    });
769
  }
770
  const restrictedTo: undefined | readonly FileOrFolderScope[] =
771
    val.restricted_to == void 0
×
772
      ? void 0
773
      : sdIsList(val.restricted_to)
×
774
        ? (val.restricted_to.map(function (
775
            itm: SerializedData,
776
          ): FileOrFolderScope {
777
            return deserializeFileOrFolderScope(itm);
×
778
          }) as readonly any[])
779
        : [];
780
  if (!(val.url == void 0) && !sdIsString(val.url)) {
×
781
    throw new BoxSdkError({
×
782
      message:
783
        'Expecting string for "url" of type "FileFullExpiringEmbedLinkField"',
784
    });
785
  }
786
  const url: undefined | string = val.url == void 0 ? void 0 : val.url;
×
787
  return {
×
788
    accessToken: accessToken,
789
    expiresIn: expiresIn,
790
    tokenType: tokenType,
791
    restrictedTo: restrictedTo,
792
    url: url,
793
  } satisfies FileFullExpiringEmbedLinkField;
794
}
795
export function serializeFileFullWatermarkInfoField(
144✔
796
  val: FileFullWatermarkInfoField,
797
): SerializedData {
798
  return { ['is_watermarked']: val.isWatermarked };
×
799
}
800
export function deserializeFileFullWatermarkInfoField(
144✔
801
  val: SerializedData,
802
): FileFullWatermarkInfoField {
803
  if (!sdIsMap(val)) {
×
804
    throw new BoxSdkError({
×
805
      message: 'Expecting a map for "FileFullWatermarkInfoField"',
806
    });
807
  }
808
  if (!(val.is_watermarked == void 0) && !sdIsBoolean(val.is_watermarked)) {
×
809
    throw new BoxSdkError({
×
810
      message:
811
        'Expecting boolean for "is_watermarked" of type "FileFullWatermarkInfoField"',
812
    });
813
  }
814
  const isWatermarked: undefined | boolean =
815
    val.is_watermarked == void 0 ? void 0 : val.is_watermarked;
×
816
  return { isWatermarked: isWatermarked } satisfies FileFullWatermarkInfoField;
×
817
}
818
export function serializeFileFullAllowedInviteeRolesField(
144✔
819
  val: FileFullAllowedInviteeRolesField,
820
): SerializedData {
821
  return val;
×
822
}
823
export function deserializeFileFullAllowedInviteeRolesField(
144✔
824
  val: SerializedData,
825
): FileFullAllowedInviteeRolesField {
826
  if (val == 'editor') {
×
827
    return val;
×
828
  }
829
  if (val == 'viewer') {
×
830
    return val;
×
831
  }
832
  if (val == 'previewer') {
×
833
    return val;
×
834
  }
835
  if (val == 'uploader') {
×
836
    return val;
×
837
  }
838
  if (val == 'previewer uploader') {
×
839
    return val;
×
840
  }
841
  if (val == 'viewer uploader') {
×
842
    return val;
×
843
  }
844
  if (val == 'co-owner') {
×
845
    return val;
×
846
  }
847
  if (sdIsString(val)) {
×
848
    return val;
×
849
  }
850
  throw new BoxSdkError({
×
851
    message: "Can't deserialize FileFullAllowedInviteeRolesField",
852
  });
853
}
854
export function serializeFileFullMetadataField(
144✔
855
  val: FileFullMetadataField,
856
): SerializedData {
857
  return { ...{}, ...val.extraData };
×
858
}
859
export function deserializeFileFullMetadataField(
144✔
860
  val: SerializedData,
861
): FileFullMetadataField {
862
  if (!sdIsMap(val)) {
×
863
    throw new BoxSdkError({
×
864
      message: 'Expecting a map for "FileFullMetadataField"',
865
    });
866
  }
867
  if (!(val == void 0) && !sdIsMap(val)) {
×
868
    throw new BoxSdkError({
×
869
      message:
870
        'Expecting object for "extraData" of type "FileFullMetadataField"',
871
    });
872
  }
873
  const extraData:
874
    | undefined
875
    | {
876
        readonly [key: string]: {
877
          readonly [key: string]: MetadataFull;
878
        };
879
      } =
880
    val == void 0
×
881
      ? void 0
882
      : sdIsMap(val)
×
883
        ? (Object.fromEntries(
884
            Object.entries(val).map(([k, v]: [string, any]) => [
×
885
              k,
886
              (function (v: any): any {
887
                return sdIsMap(v)
×
888
                  ? (Object.fromEntries(
889
                      Object.entries(v).map(([k, v]: [string, any]) => [
×
890
                        k,
891
                        deserializeMetadataFull(v),
892
                      ]),
893
                    ) as {
894
                      readonly [key: string]: any;
895
                    })
896
                  : {};
897
              })(v),
898
            ]),
899
          ) as {
900
            readonly [key: string]: any;
901
          })
902
        : {};
903
  return { extraData: extraData } satisfies FileFullMetadataField;
×
904
}
905
export function serializeFileFullRepresentationsEntriesContentField(
144✔
906
  val: FileFullRepresentationsEntriesContentField,
907
): SerializedData {
908
  return { ['url_template']: val.urlTemplate };
×
909
}
910
export function deserializeFileFullRepresentationsEntriesContentField(
144✔
911
  val: SerializedData,
912
): FileFullRepresentationsEntriesContentField {
913
  if (!sdIsMap(val)) {
×
914
    throw new BoxSdkError({
×
915
      message:
916
        'Expecting a map for "FileFullRepresentationsEntriesContentField"',
917
    });
918
  }
919
  if (!(val.url_template == void 0) && !sdIsString(val.url_template)) {
×
920
    throw new BoxSdkError({
×
921
      message:
922
        'Expecting string for "url_template" of type "FileFullRepresentationsEntriesContentField"',
923
    });
924
  }
925
  const urlTemplate: undefined | string =
926
    val.url_template == void 0 ? void 0 : val.url_template;
×
927
  return {
×
928
    urlTemplate: urlTemplate,
929
  } satisfies FileFullRepresentationsEntriesContentField;
930
}
931
export function serializeFileFullRepresentationsEntriesInfoField(
144✔
932
  val: FileFullRepresentationsEntriesInfoField,
933
): SerializedData {
934
  return { ['url']: val.url };
×
935
}
936
export function deserializeFileFullRepresentationsEntriesInfoField(
144✔
937
  val: SerializedData,
938
): FileFullRepresentationsEntriesInfoField {
939
  if (!sdIsMap(val)) {
×
940
    throw new BoxSdkError({
×
941
      message: 'Expecting a map for "FileFullRepresentationsEntriesInfoField"',
942
    });
943
  }
944
  if (!(val.url == void 0) && !sdIsString(val.url)) {
×
945
    throw new BoxSdkError({
×
946
      message:
947
        'Expecting string for "url" of type "FileFullRepresentationsEntriesInfoField"',
948
    });
949
  }
950
  const url: undefined | string = val.url == void 0 ? void 0 : val.url;
×
951
  return { url: url } satisfies FileFullRepresentationsEntriesInfoField;
×
952
}
953
export function serializeFileFullRepresentationsEntriesPropertiesField(
144✔
954
  val: FileFullRepresentationsEntriesPropertiesField,
955
): SerializedData {
956
  return {
×
957
    ['dimensions']: val.dimensions,
958
    ['paged']: val.paged,
959
    ['thumb']: val.thumb,
960
  };
961
}
962
export function deserializeFileFullRepresentationsEntriesPropertiesField(
144✔
963
  val: SerializedData,
964
): FileFullRepresentationsEntriesPropertiesField {
965
  if (!sdIsMap(val)) {
×
966
    throw new BoxSdkError({
×
967
      message:
968
        'Expecting a map for "FileFullRepresentationsEntriesPropertiesField"',
969
    });
970
  }
971
  if (!(val.dimensions == void 0) && !sdIsString(val.dimensions)) {
×
972
    throw new BoxSdkError({
×
973
      message:
974
        'Expecting string for "dimensions" of type "FileFullRepresentationsEntriesPropertiesField"',
975
    });
976
  }
977
  const dimensions: undefined | string =
978
    val.dimensions == void 0 ? void 0 : val.dimensions;
×
NEW
979
  if (!(val.paged == void 0) && !sdIsString(val.paged)) {
×
980
    throw new BoxSdkError({
×
981
      message:
982
        'Expecting string for "paged" of type "FileFullRepresentationsEntriesPropertiesField"',
983
    });
984
  }
NEW
985
  const paged: undefined | string = val.paged == void 0 ? void 0 : val.paged;
×
NEW
986
  if (!(val.thumb == void 0) && !sdIsString(val.thumb)) {
×
UNCOV
987
    throw new BoxSdkError({
×
988
      message:
989
        'Expecting string for "thumb" of type "FileFullRepresentationsEntriesPropertiesField"',
990
    });
991
  }
NEW
992
  const thumb: undefined | string = val.thumb == void 0 ? void 0 : val.thumb;
×
993
  return {
×
994
    dimensions: dimensions,
995
    paged: paged,
996
    thumb: thumb,
997
  } satisfies FileFullRepresentationsEntriesPropertiesField;
998
}
999
export function serializeFileFullRepresentationsEntriesStatusStateField(
144✔
1000
  val: FileFullRepresentationsEntriesStatusStateField,
1001
): SerializedData {
1002
  return val;
×
1003
}
1004
export function deserializeFileFullRepresentationsEntriesStatusStateField(
144✔
1005
  val: SerializedData,
1006
): FileFullRepresentationsEntriesStatusStateField {
1007
  if (val == 'success') {
×
1008
    return val;
×
1009
  }
1010
  if (val == 'viewable') {
×
1011
    return val;
×
1012
  }
1013
  if (val == 'pending') {
×
1014
    return val;
×
1015
  }
1016
  if (val == 'none') {
×
1017
    return val;
×
1018
  }
1019
  if (sdIsString(val)) {
×
1020
    return val;
×
1021
  }
1022
  throw new BoxSdkError({
×
1023
    message: "Can't deserialize FileFullRepresentationsEntriesStatusStateField",
1024
  });
1025
}
1026
export function serializeFileFullRepresentationsEntriesStatusField(
144✔
1027
  val: FileFullRepresentationsEntriesStatusField,
1028
): SerializedData {
1029
  return {
×
1030
    ['state']:
1031
      val.state == void 0
×
1032
        ? val.state
1033
        : serializeFileFullRepresentationsEntriesStatusStateField(val.state),
1034
  };
1035
}
1036
export function deserializeFileFullRepresentationsEntriesStatusField(
144✔
1037
  val: SerializedData,
1038
): FileFullRepresentationsEntriesStatusField {
1039
  if (!sdIsMap(val)) {
×
1040
    throw new BoxSdkError({
×
1041
      message:
1042
        'Expecting a map for "FileFullRepresentationsEntriesStatusField"',
1043
    });
1044
  }
1045
  const state: undefined | FileFullRepresentationsEntriesStatusStateField =
1046
    val.state == void 0
×
1047
      ? void 0
1048
      : deserializeFileFullRepresentationsEntriesStatusStateField(val.state);
1049
  return { state: state } satisfies FileFullRepresentationsEntriesStatusField;
×
1050
}
1051
export function serializeFileFullRepresentationsEntriesField(
144✔
1052
  val: FileFullRepresentationsEntriesField,
1053
): SerializedData {
1054
  return {
×
1055
    ['content']:
1056
      val.content == void 0
×
1057
        ? val.content
1058
        : serializeFileFullRepresentationsEntriesContentField(val.content),
1059
    ['info']:
1060
      val.info == void 0
×
1061
        ? val.info
1062
        : serializeFileFullRepresentationsEntriesInfoField(val.info),
1063
    ['properties']:
1064
      val.properties == void 0
×
1065
        ? val.properties
1066
        : serializeFileFullRepresentationsEntriesPropertiesField(
1067
            val.properties,
1068
          ),
1069
    ['representation']: val.representation,
1070
    ['status']:
1071
      val.status == void 0
×
1072
        ? val.status
1073
        : serializeFileFullRepresentationsEntriesStatusField(val.status),
1074
  };
1075
}
1076
export function deserializeFileFullRepresentationsEntriesField(
144✔
1077
  val: SerializedData,
1078
): FileFullRepresentationsEntriesField {
1079
  if (!sdIsMap(val)) {
×
1080
    throw new BoxSdkError({
×
1081
      message: 'Expecting a map for "FileFullRepresentationsEntriesField"',
1082
    });
1083
  }
1084
  const content: undefined | FileFullRepresentationsEntriesContentField =
1085
    val.content == void 0
×
1086
      ? void 0
1087
      : deserializeFileFullRepresentationsEntriesContentField(val.content);
1088
  const info: undefined | FileFullRepresentationsEntriesInfoField =
1089
    val.info == void 0
×
1090
      ? void 0
1091
      : deserializeFileFullRepresentationsEntriesInfoField(val.info);
1092
  const properties: undefined | FileFullRepresentationsEntriesPropertiesField =
1093
    val.properties == void 0
×
1094
      ? void 0
1095
      : deserializeFileFullRepresentationsEntriesPropertiesField(
1096
          val.properties,
1097
        );
1098
  if (!(val.representation == void 0) && !sdIsString(val.representation)) {
×
1099
    throw new BoxSdkError({
×
1100
      message:
1101
        'Expecting string for "representation" of type "FileFullRepresentationsEntriesField"',
1102
    });
1103
  }
1104
  const representation: undefined | string =
1105
    val.representation == void 0 ? void 0 : val.representation;
×
1106
  const status: undefined | FileFullRepresentationsEntriesStatusField =
1107
    val.status == void 0
×
1108
      ? void 0
1109
      : deserializeFileFullRepresentationsEntriesStatusField(val.status);
1110
  return {
×
1111
    content: content,
1112
    info: info,
1113
    properties: properties,
1114
    representation: representation,
1115
    status: status,
1116
  } satisfies FileFullRepresentationsEntriesField;
1117
}
1118
export function serializeFileFullRepresentationsField(
144✔
1119
  val: FileFullRepresentationsField,
1120
): SerializedData {
1121
  return {
×
1122
    ['entries']:
1123
      val.entries == void 0
×
1124
        ? val.entries
1125
        : (val.entries.map(function (
1126
            item: FileFullRepresentationsEntriesField,
1127
          ): SerializedData {
1128
            return serializeFileFullRepresentationsEntriesField(item);
×
1129
          }) as readonly any[]),
1130
  };
1131
}
1132
export function deserializeFileFullRepresentationsField(
144✔
1133
  val: SerializedData,
1134
): FileFullRepresentationsField {
1135
  if (!sdIsMap(val)) {
×
1136
    throw new BoxSdkError({
×
1137
      message: 'Expecting a map for "FileFullRepresentationsField"',
1138
    });
1139
  }
1140
  if (!(val.entries == void 0) && !sdIsList(val.entries)) {
×
1141
    throw new BoxSdkError({
×
1142
      message:
1143
        'Expecting array for "entries" of type "FileFullRepresentationsField"',
1144
    });
1145
  }
1146
  const entries: undefined | readonly FileFullRepresentationsEntriesField[] =
1147
    val.entries == void 0
×
1148
      ? void 0
1149
      : sdIsList(val.entries)
×
1150
        ? (val.entries.map(function (
1151
            itm: SerializedData,
1152
          ): FileFullRepresentationsEntriesField {
1153
            return deserializeFileFullRepresentationsEntriesField(itm);
×
1154
          }) as readonly any[])
1155
        : [];
1156
  return { entries: entries } satisfies FileFullRepresentationsField;
×
1157
}
1158
export function serializeFileFullClassificationField(
144✔
1159
  val: FileFullClassificationField,
1160
): SerializedData {
1161
  return {
×
1162
    ['name']: val.name,
1163
    ['definition']: val.definition,
1164
    ['color']: val.color,
1165
  };
1166
}
1167
export function deserializeFileFullClassificationField(
144✔
1168
  val: SerializedData,
1169
): FileFullClassificationField {
1170
  if (!sdIsMap(val)) {
×
1171
    throw new BoxSdkError({
×
1172
      message: 'Expecting a map for "FileFullClassificationField"',
1173
    });
1174
  }
1175
  if (!(val.name == void 0) && !sdIsString(val.name)) {
×
1176
    throw new BoxSdkError({
×
1177
      message:
1178
        'Expecting string for "name" of type "FileFullClassificationField"',
1179
    });
1180
  }
1181
  const name: undefined | string = val.name == void 0 ? void 0 : val.name;
×
1182
  if (!(val.definition == void 0) && !sdIsString(val.definition)) {
×
1183
    throw new BoxSdkError({
×
1184
      message:
1185
        'Expecting string for "definition" of type "FileFullClassificationField"',
1186
    });
1187
  }
1188
  const definition: undefined | string =
1189
    val.definition == void 0 ? void 0 : val.definition;
×
1190
  if (!(val.color == void 0) && !sdIsString(val.color)) {
×
1191
    throw new BoxSdkError({
×
1192
      message:
1193
        'Expecting string for "color" of type "FileFullClassificationField"',
1194
    });
1195
  }
1196
  const color: undefined | string = val.color == void 0 ? void 0 : val.color;
×
1197
  return {
×
1198
    name: name,
1199
    definition: definition,
1200
    color: color,
1201
  } satisfies FileFullClassificationField;
1202
}
1203
export function serializeFileFullSharedLinkPermissionOptionsField(
144✔
1204
  val: FileFullSharedLinkPermissionOptionsField,
1205
): SerializedData {
1206
  return val;
×
1207
}
1208
export function deserializeFileFullSharedLinkPermissionOptionsField(
144✔
1209
  val: SerializedData,
1210
): FileFullSharedLinkPermissionOptionsField {
1211
  if (val == 'can_preview') {
×
1212
    return val;
×
1213
  }
1214
  if (val == 'can_download') {
×
1215
    return val;
×
1216
  }
1217
  if (val == 'can_edit') {
×
1218
    return val;
×
1219
  }
1220
  if (sdIsString(val)) {
×
1221
    return val;
×
1222
  }
1223
  throw new BoxSdkError({
×
1224
    message: "Can't deserialize FileFullSharedLinkPermissionOptionsField",
1225
  });
1226
}
1227
export function serializeFileFull(val: FileFull): SerializedData {
144✔
1228
  const base: any = serializeFile(val);
×
1229
  if (!sdIsMap(base)) {
×
1230
    throw new BoxSdkError({ message: 'Expecting a map for "FileFull"' });
×
1231
  }
1232
  return {
×
1233
    ...base,
1234
    ...{
1235
      ['version_number']: val.versionNumber,
1236
      ['comment_count']: val.commentCount,
1237
      ['permissions']:
1238
        val.permissions == void 0
×
1239
          ? val.permissions
1240
          : serializeFileFullPermissionsField(val.permissions),
1241
      ['tags']:
1242
        val.tags == void 0
×
1243
          ? val.tags
1244
          : (val.tags.map(function (item: string): SerializedData {
1245
              return item;
×
1246
            }) as readonly any[]),
1247
      ['lock']:
1248
        val.lock == void 0 ? val.lock : serializeFileFullLockField(val.lock),
×
1249
      ['extension']: val.extension,
1250
      ['is_package']: val.isPackage,
1251
      ['expiring_embed_link']:
1252
        val.expiringEmbedLink == void 0
×
1253
          ? val.expiringEmbedLink
1254
          : serializeFileFullExpiringEmbedLinkField(val.expiringEmbedLink),
1255
      ['watermark_info']:
1256
        val.watermarkInfo == void 0
×
1257
          ? val.watermarkInfo
1258
          : serializeFileFullWatermarkInfoField(val.watermarkInfo),
1259
      ['is_accessible_via_shared_link']: val.isAccessibleViaSharedLink,
1260
      ['allowed_invitee_roles']:
1261
        val.allowedInviteeRoles == void 0
×
1262
          ? val.allowedInviteeRoles
1263
          : (val.allowedInviteeRoles.map(function (
1264
              item: FileFullAllowedInviteeRolesField,
1265
            ): SerializedData {
1266
              return serializeFileFullAllowedInviteeRolesField(item);
×
1267
            }) as readonly any[]),
1268
      ['is_externally_owned']: val.isExternallyOwned,
1269
      ['has_collaborations']: val.hasCollaborations,
1270
      ['metadata']:
1271
        val.metadata == void 0
×
1272
          ? val.metadata
1273
          : serializeFileFullMetadataField(val.metadata),
1274
      ['expires_at']:
1275
        val.expiresAt == void 0
×
1276
          ? val.expiresAt
1277
          : serializeDateTime(val.expiresAt),
1278
      ['representations']:
1279
        val.representations == void 0
×
1280
          ? val.representations
1281
          : serializeFileFullRepresentationsField(val.representations),
1282
      ['classification']:
1283
        val.classification == void 0
×
1284
          ? val.classification
1285
          : serializeFileFullClassificationField(val.classification),
1286
      ['uploader_display_name']: val.uploaderDisplayName,
1287
      ['disposition_at']:
1288
        val.dispositionAt == void 0
×
1289
          ? val.dispositionAt
1290
          : serializeDateTime(val.dispositionAt),
1291
      ['shared_link_permission_options']:
1292
        val.sharedLinkPermissionOptions == void 0
×
1293
          ? val.sharedLinkPermissionOptions
1294
          : (val.sharedLinkPermissionOptions.map(function (
1295
              item: FileFullSharedLinkPermissionOptionsField,
1296
            ): SerializedData {
1297
              return serializeFileFullSharedLinkPermissionOptionsField(item);
×
1298
            }) as readonly any[]),
1299
      ['is_associated_with_app_item']: val.isAssociatedWithAppItem,
1300
    },
1301
  };
1302
}
1303
export function deserializeFileFull(val: SerializedData): FileFull {
144✔
1304
  if (!sdIsMap(val)) {
349!
1305
    throw new BoxSdkError({ message: 'Expecting a map for "FileFull"' });
×
1306
  }
1307
  if (!(val.version_number == void 0) && !sdIsString(val.version_number)) {
349!
1308
    throw new BoxSdkError({
×
1309
      message: 'Expecting string for "version_number" of type "FileFull"',
1310
    });
1311
  }
1312
  const versionNumber: undefined | string =
1313
    val.version_number == void 0 ? void 0 : val.version_number;
349!
1314
  if (!(val.comment_count == void 0) && !sdIsNumber(val.comment_count)) {
349!
1315
    throw new BoxSdkError({
×
1316
      message: 'Expecting number for "comment_count" of type "FileFull"',
1317
    });
1318
  }
1319
  const commentCount: undefined | number =
1320
    val.comment_count == void 0 ? void 0 : val.comment_count;
349!
1321
  const permissions: undefined | FileFullPermissionsField =
1322
    val.permissions == void 0
349!
1323
      ? void 0
1324
      : deserializeFileFullPermissionsField(val.permissions);
1325
  if (!(val.tags == void 0) && !sdIsList(val.tags)) {
349!
1326
    throw new BoxSdkError({
×
1327
      message: 'Expecting array for "tags" of type "FileFull"',
1328
    });
1329
  }
1330
  const tags: undefined | readonly string[] =
1331
    val.tags == void 0
349!
1332
      ? void 0
1333
      : sdIsList(val.tags)
×
1334
        ? (val.tags.map(function (itm: SerializedData): string {
1335
            if (!sdIsString(itm)) {
×
1336
              throw new BoxSdkError({
×
1337
                message: 'Expecting string for "FileFull"',
1338
              });
1339
            }
1340
            return itm;
×
1341
          }) as readonly any[])
1342
        : [];
1343
  const lock: undefined | FileFullLockField =
1344
    val.lock == void 0 ? void 0 : deserializeFileFullLockField(val.lock);
349✔
1345
  if (!(val.extension == void 0) && !sdIsString(val.extension)) {
349!
1346
    throw new BoxSdkError({
×
1347
      message: 'Expecting string for "extension" of type "FileFull"',
1348
    });
1349
  }
1350
  const extension: undefined | string =
1351
    val.extension == void 0 ? void 0 : val.extension;
349!
1352
  if (!(val.is_package == void 0) && !sdIsBoolean(val.is_package)) {
349!
1353
    throw new BoxSdkError({
×
1354
      message: 'Expecting boolean for "is_package" of type "FileFull"',
1355
    });
1356
  }
1357
  const isPackage: undefined | boolean =
1358
    val.is_package == void 0 ? void 0 : val.is_package;
349!
1359
  const expiringEmbedLink: undefined | FileFullExpiringEmbedLinkField =
1360
    val.expiring_embed_link == void 0
349!
1361
      ? void 0
1362
      : deserializeFileFullExpiringEmbedLinkField(val.expiring_embed_link);
1363
  const watermarkInfo: undefined | FileFullWatermarkInfoField =
1364
    val.watermark_info == void 0
349!
1365
      ? void 0
1366
      : deserializeFileFullWatermarkInfoField(val.watermark_info);
1367
  if (
349!
1368
    !(val.is_accessible_via_shared_link == void 0) &&
349!
1369
    !sdIsBoolean(val.is_accessible_via_shared_link)
1370
  ) {
1371
    throw new BoxSdkError({
×
1372
      message:
1373
        'Expecting boolean for "is_accessible_via_shared_link" of type "FileFull"',
1374
    });
1375
  }
1376
  const isAccessibleViaSharedLink: undefined | boolean =
1377
    val.is_accessible_via_shared_link == void 0
349!
1378
      ? void 0
1379
      : val.is_accessible_via_shared_link;
1380
  if (
349!
1381
    !(val.allowed_invitee_roles == void 0) &&
349!
1382
    !sdIsList(val.allowed_invitee_roles)
1383
  ) {
1384
    throw new BoxSdkError({
×
1385
      message: 'Expecting array for "allowed_invitee_roles" of type "FileFull"',
1386
    });
1387
  }
1388
  const allowedInviteeRoles:
1389
    | undefined
1390
    | readonly FileFullAllowedInviteeRolesField[] =
1391
    val.allowed_invitee_roles == void 0
349!
1392
      ? void 0
1393
      : sdIsList(val.allowed_invitee_roles)
×
1394
        ? (val.allowed_invitee_roles.map(function (
1395
            itm: SerializedData,
1396
          ): FileFullAllowedInviteeRolesField {
1397
            return deserializeFileFullAllowedInviteeRolesField(itm);
×
1398
          }) as readonly any[])
1399
        : [];
1400
  if (
349!
1401
    !(val.is_externally_owned == void 0) &&
351✔
1402
    !sdIsBoolean(val.is_externally_owned)
1403
  ) {
1404
    throw new BoxSdkError({
×
1405
      message: 'Expecting boolean for "is_externally_owned" of type "FileFull"',
1406
    });
1407
  }
1408
  const isExternallyOwned: undefined | boolean =
1409
    val.is_externally_owned == void 0 ? void 0 : val.is_externally_owned;
349✔
1410
  if (
349!
1411
    !(val.has_collaborations == void 0) &&
351✔
1412
    !sdIsBoolean(val.has_collaborations)
1413
  ) {
1414
    throw new BoxSdkError({
×
1415
      message: 'Expecting boolean for "has_collaborations" of type "FileFull"',
1416
    });
1417
  }
1418
  const hasCollaborations: undefined | boolean =
1419
    val.has_collaborations == void 0 ? void 0 : val.has_collaborations;
349✔
1420
  const metadata: undefined | FileFullMetadataField =
1421
    val.metadata == void 0
349!
1422
      ? void 0
1423
      : deserializeFileFullMetadataField(val.metadata);
1424
  if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) {
349!
1425
    throw new BoxSdkError({
×
1426
      message: 'Expecting string for "expires_at" of type "FileFull"',
1427
    });
1428
  }
1429
  const expiresAt: undefined | DateTime =
1430
    val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at);
349!
1431
  const representations: undefined | FileFullRepresentationsField =
1432
    val.representations == void 0
349!
1433
      ? void 0
1434
      : deserializeFileFullRepresentationsField(val.representations);
1435
  const classification: undefined | FileFullClassificationField =
1436
    val.classification == void 0
349!
1437
      ? void 0
1438
      : deserializeFileFullClassificationField(val.classification);
1439
  if (
349!
1440
    !(val.uploader_display_name == void 0) &&
349!
1441
    !sdIsString(val.uploader_display_name)
1442
  ) {
1443
    throw new BoxSdkError({
×
1444
      message:
1445
        'Expecting string for "uploader_display_name" of type "FileFull"',
1446
    });
1447
  }
1448
  const uploaderDisplayName: undefined | string =
1449
    val.uploader_display_name == void 0 ? void 0 : val.uploader_display_name;
349!
1450
  if (!(val.disposition_at == void 0) && !sdIsString(val.disposition_at)) {
349!
1451
    throw new BoxSdkError({
×
1452
      message: 'Expecting string for "disposition_at" of type "FileFull"',
1453
    });
1454
  }
1455
  const dispositionAt: undefined | DateTime =
1456
    val.disposition_at == void 0
349!
1457
      ? void 0
1458
      : deserializeDateTime(val.disposition_at);
1459
  if (
349!
1460
    !(val.shared_link_permission_options == void 0) &&
349!
1461
    !sdIsList(val.shared_link_permission_options)
1462
  ) {
1463
    throw new BoxSdkError({
×
1464
      message:
1465
        'Expecting array for "shared_link_permission_options" of type "FileFull"',
1466
    });
1467
  }
1468
  const sharedLinkPermissionOptions:
1469
    | undefined
1470
    | readonly FileFullSharedLinkPermissionOptionsField[] =
1471
    val.shared_link_permission_options == void 0
349!
1472
      ? void 0
1473
      : sdIsList(val.shared_link_permission_options)
×
1474
        ? (val.shared_link_permission_options.map(function (
1475
            itm: SerializedData,
1476
          ): FileFullSharedLinkPermissionOptionsField {
1477
            return deserializeFileFullSharedLinkPermissionOptionsField(itm);
×
1478
          }) as readonly any[])
1479
        : [];
1480
  if (
349!
1481
    !(val.is_associated_with_app_item == void 0) &&
351✔
1482
    !sdIsBoolean(val.is_associated_with_app_item)
1483
  ) {
1484
    throw new BoxSdkError({
×
1485
      message:
1486
        'Expecting boolean for "is_associated_with_app_item" of type "FileFull"',
1487
    });
1488
  }
1489
  const isAssociatedWithAppItem: undefined | boolean =
1490
    val.is_associated_with_app_item == void 0
349✔
1491
      ? void 0
1492
      : val.is_associated_with_app_item;
1493
  if (!(val.description == void 0) && !sdIsString(val.description)) {
349!
1494
    throw new BoxSdkError({
×
1495
      message: 'Expecting string for "description" of type "FileFull"',
1496
    });
1497
  }
1498
  const description: undefined | string =
1499
    val.description == void 0 ? void 0 : val.description;
349✔
1500
  if (!(val.size == void 0) && !sdIsNumber(val.size)) {
349!
1501
    throw new BoxSdkError({
×
1502
      message: 'Expecting number for "size" of type "FileFull"',
1503
    });
1504
  }
1505
  const size: undefined | number = val.size == void 0 ? void 0 : val.size;
349✔
1506
  const pathCollection: undefined | FilePathCollectionField =
1507
    val.path_collection == void 0
349✔
1508
      ? void 0
1509
      : deserializeFilePathCollectionField(val.path_collection);
1510
  if (!(val.created_at == void 0) && !sdIsString(val.created_at)) {
349!
1511
    throw new BoxSdkError({
×
1512
      message: 'Expecting string for "created_at" of type "FileFull"',
1513
    });
1514
  }
1515
  const createdAt: undefined | DateTime =
1516
    val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at);
349✔
1517
  if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) {
349!
1518
    throw new BoxSdkError({
×
1519
      message: 'Expecting string for "modified_at" of type "FileFull"',
1520
    });
1521
  }
1522
  const modifiedAt: undefined | DateTime =
1523
    val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at);
349✔
1524
  if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) {
349!
1525
    throw new BoxSdkError({
×
1526
      message: 'Expecting string for "trashed_at" of type "FileFull"',
1527
    });
1528
  }
1529
  const trashedAt: undefined | DateTime =
1530
    val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at);
349✔
1531
  if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) {
349!
1532
    throw new BoxSdkError({
×
1533
      message: 'Expecting string for "purged_at" of type "FileFull"',
1534
    });
1535
  }
1536
  const purgedAt: undefined | DateTime =
1537
    val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at);
349✔
1538
  if (
349!
1539
    !(val.content_created_at == void 0) &&
573✔
1540
    !sdIsString(val.content_created_at)
1541
  ) {
1542
    throw new BoxSdkError({
×
1543
      message: 'Expecting string for "content_created_at" of type "FileFull"',
1544
    });
1545
  }
1546
  const contentCreatedAt: undefined | DateTime =
1547
    val.content_created_at == void 0
349✔
1548
      ? void 0
1549
      : deserializeDateTime(val.content_created_at);
1550
  if (
349!
1551
    !(val.content_modified_at == void 0) &&
573✔
1552
    !sdIsString(val.content_modified_at)
1553
  ) {
1554
    throw new BoxSdkError({
×
1555
      message: 'Expecting string for "content_modified_at" of type "FileFull"',
1556
    });
1557
  }
1558
  const contentModifiedAt: undefined | DateTime =
1559
    val.content_modified_at == void 0
349✔
1560
      ? void 0
1561
      : deserializeDateTime(val.content_modified_at);
1562
  const createdBy: undefined | UserMini =
1563
    val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by);
349✔
1564
  const modifiedBy: undefined | UserMini =
1565
    val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by);
349✔
1566
  const ownedBy: undefined | UserMini =
1567
    val.owned_by == void 0 ? void 0 : deserializeUserMini(val.owned_by);
349✔
1568
  const sharedLink: undefined | FileSharedLinkField =
1569
    val.shared_link == void 0
349✔
1570
      ? void 0
1571
      : deserializeFileSharedLinkField(val.shared_link);
1572
  const parent: undefined | FolderMini =
1573
    val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent);
349✔
1574
  const itemStatus: undefined | FileItemStatusField =
1575
    val.item_status == void 0
349✔
1576
      ? void 0
1577
      : deserializeFileItemStatusField(val.item_status);
1578
  if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) {
349!
1579
    throw new BoxSdkError({
×
1580
      message: 'Expecting string for "sequence_id" of type "FileFull"',
1581
    });
1582
  }
1583
  const sequenceId: undefined | string =
1584
    val.sequence_id == void 0 ? void 0 : val.sequence_id;
349✔
1585
  if (!(val.name == void 0) && !sdIsString(val.name)) {
349!
1586
    throw new BoxSdkError({
×
1587
      message: 'Expecting string for "name" of type "FileFull"',
1588
    });
1589
  }
1590
  const name: undefined | string = val.name == void 0 ? void 0 : val.name;
349✔
1591
  if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) {
349!
1592
    throw new BoxSdkError({
×
1593
      message: 'Expecting string for "sha1" of type "FileFull"',
1594
    });
1595
  }
1596
  const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1;
349✔
1597
  const fileVersion: undefined | FileVersionMini =
1598
    val.file_version == void 0
349✔
1599
      ? void 0
1600
      : deserializeFileVersionMini(val.file_version);
1601
  if (val.id == void 0) {
349!
1602
    throw new BoxSdkError({
×
1603
      message: 'Expecting "id" of type "FileFull" to be defined',
1604
    });
1605
  }
1606
  if (!sdIsString(val.id)) {
349!
1607
    throw new BoxSdkError({
×
1608
      message: 'Expecting string for "id" of type "FileFull"',
1609
    });
1610
  }
1611
  const id: string = val.id;
349✔
1612
  if (!(val.etag == void 0) && !sdIsString(val.etag)) {
349!
1613
    throw new BoxSdkError({
×
1614
      message: 'Expecting string for "etag" of type "FileFull"',
1615
    });
1616
  }
1617
  const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag;
349!
1618
  if (val.type == void 0) {
349!
1619
    throw new BoxSdkError({
×
1620
      message: 'Expecting "type" of type "FileFull" to be defined',
1621
    });
1622
  }
1623
  const type: FileBaseTypeField = deserializeFileBaseTypeField(val.type);
349✔
1624
  return {
349✔
1625
    versionNumber: versionNumber,
1626
    commentCount: commentCount,
1627
    permissions: permissions,
1628
    tags: tags,
1629
    lock: lock,
1630
    extension: extension,
1631
    isPackage: isPackage,
1632
    expiringEmbedLink: expiringEmbedLink,
1633
    watermarkInfo: watermarkInfo,
1634
    isAccessibleViaSharedLink: isAccessibleViaSharedLink,
1635
    allowedInviteeRoles: allowedInviteeRoles,
1636
    isExternallyOwned: isExternallyOwned,
1637
    hasCollaborations: hasCollaborations,
1638
    metadata: metadata,
1639
    expiresAt: expiresAt,
1640
    representations: representations,
1641
    classification: classification,
1642
    uploaderDisplayName: uploaderDisplayName,
1643
    dispositionAt: dispositionAt,
1644
    sharedLinkPermissionOptions: sharedLinkPermissionOptions,
1645
    isAssociatedWithAppItem: isAssociatedWithAppItem,
1646
    description: description,
1647
    size: size,
1648
    pathCollection: pathCollection,
1649
    createdAt: createdAt,
1650
    modifiedAt: modifiedAt,
1651
    trashedAt: trashedAt,
1652
    purgedAt: purgedAt,
1653
    contentCreatedAt: contentCreatedAt,
1654
    contentModifiedAt: contentModifiedAt,
1655
    createdBy: createdBy,
1656
    modifiedBy: modifiedBy,
1657
    ownedBy: ownedBy,
1658
    sharedLink: sharedLink,
1659
    parent: parent,
1660
    itemStatus: itemStatus,
1661
    sequenceId: sequenceId,
1662
    name: name,
1663
    sha1: sha1,
1664
    fileVersion: fileVersion,
1665
    id: id,
1666
    etag: etag,
1667
    type: type,
1668
  } satisfies FileFull;
1669
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc