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

box / box-typescript-sdk-gen / 12870156465

20 Jan 2025 02:28PM UTC coverage: 42.419%. First build
12870156465

push

github

web-flow
feat: Use extensible enums (box/box-codegen#639) (#487)

3990 of 15999 branches covered (24.94%)

Branch coverage included in aggregate %.

0 of 408 new or added lines in 104 files covered. (0.0%)

14249 of 26998 relevant lines covered (52.78%)

93.02 hits per line

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

17.92
/src/managers/classifications.generated.ts
1
import { serializeClassificationTemplate } from '../schemas/classificationTemplate.generated.js';
2
import { deserializeClassificationTemplate } from '../schemas/classificationTemplate.generated.js';
144✔
3
import { serializeClientError } from '../schemas/clientError.generated.js';
4
import { deserializeClientError } from '../schemas/clientError.generated.js';
5
import { ResponseFormat } from '../networking/fetchOptions.generated.js';
6
import { ClassificationTemplate } from '../schemas/classificationTemplate.generated.js';
7
import { ClientError } from '../schemas/clientError.generated.js';
8
import { BoxSdkError } from '../box/errors.js';
144✔
9
import { Authentication } from '../networking/auth.generated.js';
10
import { NetworkSession } from '../networking/network.generated.js';
144✔
11
import { FetchOptions } from '../networking/fetchOptions.generated.js';
144✔
12
import { FetchResponse } from '../networking/fetchResponse.generated.js';
13
import { prepareParams } from '../internal/utils.js';
144✔
14
import { toString } from '../internal/utils.js';
15
import { ByteStream } from '../internal/utils.js';
16
import { CancellationToken } from '../internal/utils.js';
17
import { SerializedData } from '../serialization/json.js';
18
import { sdIsEmpty } from '../serialization/json.js';
19
import { sdIsBoolean } from '../serialization/json.js';
144✔
20
import { sdIsNumber } from '../serialization/json.js';
144✔
21
import { sdIsString } from '../serialization/json.js';
144✔
22
import { sdIsList } from '../serialization/json.js';
144✔
23
import { sdIsMap } from '../serialization/json.js';
144✔
24
export class AddClassificationOptionals {
144✔
25
  readonly headers: AddClassificationHeaders = new AddClassificationHeaders({});
×
26
  readonly cancellationToken?: CancellationToken = void 0;
×
27
  constructor(
28
    fields: Omit<AddClassificationOptionals, 'headers' | 'cancellationToken'> &
29
      Partial<
30
        Pick<AddClassificationOptionals, 'headers' | 'cancellationToken'>
31
      >,
32
  ) {
33
    if (fields.headers !== undefined) {
×
34
      this.headers = fields.headers;
×
35
    }
36
    if (fields.cancellationToken !== undefined) {
×
37
      this.cancellationToken = fields.cancellationToken;
×
38
    }
39
  }
40
}
41
export interface AddClassificationOptionalsInput {
42
  readonly headers?: AddClassificationHeaders;
43
  readonly cancellationToken?: undefined | CancellationToken;
44
}
45
export class UpdateClassificationOptionals {
144✔
46
  readonly headers: UpdateClassificationHeaders =
2✔
47
    new UpdateClassificationHeaders({});
48
  readonly cancellationToken?: CancellationToken = void 0;
2✔
49
  constructor(
50
    fields: Omit<
51
      UpdateClassificationOptionals,
52
      'headers' | 'cancellationToken'
53
    > &
54
      Partial<
55
        Pick<UpdateClassificationOptionals, 'headers' | 'cancellationToken'>
56
      >,
57
  ) {
58
    if (fields.headers !== undefined) {
2!
59
      this.headers = fields.headers;
×
60
    }
61
    if (fields.cancellationToken !== undefined) {
2!
62
      this.cancellationToken = fields.cancellationToken;
×
63
    }
64
  }
65
}
66
export interface UpdateClassificationOptionalsInput {
67
  readonly headers?: UpdateClassificationHeaders;
68
  readonly cancellationToken?: undefined | CancellationToken;
69
}
70
export class CreateClassificationTemplateOptionals {
144✔
71
  readonly headers: CreateClassificationTemplateHeaders =
×
72
    new CreateClassificationTemplateHeaders({});
73
  readonly cancellationToken?: CancellationToken = void 0;
×
74
  constructor(
75
    fields: Omit<
76
      CreateClassificationTemplateOptionals,
77
      'headers' | 'cancellationToken'
78
    > &
79
      Partial<
80
        Pick<
81
          CreateClassificationTemplateOptionals,
82
          'headers' | 'cancellationToken'
83
        >
84
      >,
85
  ) {
86
    if (fields.headers !== undefined) {
×
87
      this.headers = fields.headers;
×
88
    }
89
    if (fields.cancellationToken !== undefined) {
×
90
      this.cancellationToken = fields.cancellationToken;
×
91
    }
92
  }
93
}
94
export interface CreateClassificationTemplateOptionalsInput {
95
  readonly headers?: CreateClassificationTemplateHeaders;
96
  readonly cancellationToken?: undefined | CancellationToken;
97
}
98
export class GetClassificationTemplateHeaders {
144✔
99
  /**
100
   * Extra headers that will be included in the HTTP request. */
101
  readonly extraHeaders?: {
12✔
102
    readonly [key: string]: undefined | string;
103
  } = {};
104
  constructor(
105
    fields: Omit<GetClassificationTemplateHeaders, 'extraHeaders'> &
106
      Partial<Pick<GetClassificationTemplateHeaders, 'extraHeaders'>>,
107
  ) {
108
    if (fields.extraHeaders !== undefined) {
12✔
109
      this.extraHeaders = fields.extraHeaders;
6✔
110
    }
111
  }
112
}
113
export interface GetClassificationTemplateHeadersInput {
114
  /**
115
   * Extra headers that will be included in the HTTP request. */
116
  readonly extraHeaders?:
117
    | undefined
118
    | {
119
        readonly [key: string]: undefined | string;
120
      };
121
}
122
export type AddClassificationRequestBodyOpField = 'addEnumOption' | string;
123
export type AddClassificationRequestBodyFieldKeyField =
124
  | 'Box__Security__Classification__Key'
125
  | string;
126
export interface AddClassificationRequestBodyDataStaticConfigClassificationField {
127
  /**
128
   * A longer description of the classification. */
129
  readonly classificationDefinition?: string;
130
  /**
131
   * An internal Box identifier used to assign a color to
132
   * a classification label.
133
   *
134
   * Mapping between a `colorID` and a color may change
135
   * without notice. Currently, the color mappings are as
136
   * follows.
137
   *
138
   * * `0`: Yellow
139
   * * `1`: Orange
140
   * * `2`: Watermelon red
141
   * * `3`: Purple rain
142
   * * `4`: Light blue
143
   * * `5`: Dark blue
144
   * * `6`: Light green
145
   * * `7`: Gray */
146
  readonly colorId?: number;
147
  readonly rawData?: SerializedData;
148
}
149
export interface AddClassificationRequestBodyDataStaticConfigField {
150
  /**
151
   * Additional details for the classification. */
152
  readonly classification?: AddClassificationRequestBodyDataStaticConfigClassificationField;
153
  readonly rawData?: SerializedData;
154
}
155
export interface AddClassificationRequestBodyDataField {
156
  /**
157
   * The label of the classification as shown in the web and
158
   * mobile interfaces. This is the only field required to
159
   * add a classification. */
160
  readonly key: string;
161
  /**
162
   * A static configuration for the classification. */
163
  readonly staticConfig?: AddClassificationRequestBodyDataStaticConfigField;
164
  readonly rawData?: SerializedData;
165
}
166
export class AddClassificationRequestBody {
144✔
167
  /**
168
   * The type of change to perform on the classification
169
   * object. */
170
  readonly op: AddClassificationRequestBodyOpField =
×
171
    'addEnumOption' as AddClassificationRequestBodyOpField;
172
  /**
173
   * Defines classifications
174
   * available in the enterprise. */
175
  readonly fieldKey: AddClassificationRequestBodyFieldKeyField =
×
176
    'Box__Security__Classification__Key' as AddClassificationRequestBodyFieldKeyField;
177
  /**
178
   * The details of the classification to add. */
179
  readonly data!: AddClassificationRequestBodyDataField;
180
  readonly rawData?: SerializedData;
181
  constructor(
182
    fields: Omit<AddClassificationRequestBody, 'op' | 'fieldKey'> &
183
      Partial<Pick<AddClassificationRequestBody, 'op' | 'fieldKey'>>,
184
  ) {
185
    if (fields.op !== undefined) {
×
186
      this.op = fields.op;
×
187
    }
188
    if (fields.fieldKey !== undefined) {
×
189
      this.fieldKey = fields.fieldKey;
×
190
    }
191
    if (fields.data !== undefined) {
×
192
      this.data = fields.data;
×
193
    }
194
    if (fields.rawData !== undefined) {
×
195
      this.rawData = fields.rawData;
×
196
    }
197
  }
198
}
199
export interface AddClassificationRequestBodyInput {
200
  /**
201
   * The type of change to perform on the classification
202
   * object. */
203
  readonly op?: AddClassificationRequestBodyOpField;
204
  /**
205
   * Defines classifications
206
   * available in the enterprise. */
207
  readonly fieldKey?: AddClassificationRequestBodyFieldKeyField;
208
  /**
209
   * The details of the classification to add. */
210
  readonly data: AddClassificationRequestBodyDataField;
211
  readonly rawData?: SerializedData;
212
}
213
export class AddClassificationHeaders {
144✔
214
  /**
215
   * Extra headers that will be included in the HTTP request. */
216
  readonly extraHeaders?: {
×
217
    readonly [key: string]: undefined | string;
218
  } = {};
219
  constructor(
220
    fields: Omit<AddClassificationHeaders, 'extraHeaders'> &
221
      Partial<Pick<AddClassificationHeaders, 'extraHeaders'>>,
222
  ) {
223
    if (fields.extraHeaders !== undefined) {
×
224
      this.extraHeaders = fields.extraHeaders;
×
225
    }
226
  }
227
}
228
export interface AddClassificationHeadersInput {
229
  /**
230
   * Extra headers that will be included in the HTTP request. */
231
  readonly extraHeaders?:
232
    | undefined
233
    | {
234
        readonly [key: string]: undefined | string;
235
      };
236
}
237
export type UpdateClassificationRequestBodyOpField = 'editEnumOption' | string;
238
export type UpdateClassificationRequestBodyFieldKeyField =
239
  | 'Box__Security__Classification__Key'
240
  | string;
241
export interface UpdateClassificationRequestBodyDataStaticConfigClassificationField {
242
  /**
243
   * A longer description of the classification. */
244
  readonly classificationDefinition?: string;
245
  /**
246
   * An internal Box identifier used to assign a color to
247
   * a classification label.
248
   *
249
   * Mapping between a `colorID` and a color may change
250
   * without notice. Currently, the color mappings are as
251
   * follows.
252
   *
253
   * * `0`: Yellow
254
   * * `1`: Orange
255
   * * `2`: Watermelon red
256
   * * `3`: Purple rain
257
   * * `4`: Light blue
258
   * * `5`: Dark blue
259
   * * `6`: Light green
260
   * * `7`: Gray */
261
  readonly colorId?: number;
262
  readonly rawData?: SerializedData;
263
}
264
export interface UpdateClassificationRequestBodyDataStaticConfigField {
265
  /**
266
   * Additional details for the classification. */
267
  readonly classification?: UpdateClassificationRequestBodyDataStaticConfigClassificationField;
268
  readonly rawData?: SerializedData;
269
}
270
export interface UpdateClassificationRequestBodyDataField {
271
  /**
272
   * A new label for the classification, as it will be
273
   * shown in the web and mobile interfaces. */
274
  readonly key: string;
275
  /**
276
   * A static configuration for the classification. */
277
  readonly staticConfig?: UpdateClassificationRequestBodyDataStaticConfigField;
278
  readonly rawData?: SerializedData;
279
}
280
export class UpdateClassificationRequestBody {
144✔
281
  /**
282
   * The type of change to perform on the classification
283
   * object. */
284
  readonly op: UpdateClassificationRequestBodyOpField =
2✔
285
    'editEnumOption' as UpdateClassificationRequestBodyOpField;
286
  /**
287
   * Defines classifications
288
   * available in the enterprise. */
289
  readonly fieldKey: UpdateClassificationRequestBodyFieldKeyField =
2✔
290
    'Box__Security__Classification__Key' as UpdateClassificationRequestBodyFieldKeyField;
291
  /**
292
   * The original label of the classification to change. */
293
  readonly enumOptionKey!: string;
294
  /**
295
   * The details of the updated classification. */
296
  readonly data!: UpdateClassificationRequestBodyDataField;
297
  readonly rawData?: SerializedData;
298
  constructor(
299
    fields: Omit<UpdateClassificationRequestBody, 'op' | 'fieldKey'> &
300
      Partial<Pick<UpdateClassificationRequestBody, 'op' | 'fieldKey'>>,
301
  ) {
302
    if (fields.op !== undefined) {
2!
303
      this.op = fields.op;
×
304
    }
305
    if (fields.fieldKey !== undefined) {
2!
306
      this.fieldKey = fields.fieldKey;
×
307
    }
308
    if (fields.enumOptionKey !== undefined) {
2✔
309
      this.enumOptionKey = fields.enumOptionKey;
2✔
310
    }
311
    if (fields.data !== undefined) {
2✔
312
      this.data = fields.data;
2✔
313
    }
314
    if (fields.rawData !== undefined) {
2!
315
      this.rawData = fields.rawData;
×
316
    }
317
  }
318
}
319
export interface UpdateClassificationRequestBodyInput {
320
  /**
321
   * The type of change to perform on the classification
322
   * object. */
323
  readonly op?: UpdateClassificationRequestBodyOpField;
324
  /**
325
   * Defines classifications
326
   * available in the enterprise. */
327
  readonly fieldKey?: UpdateClassificationRequestBodyFieldKeyField;
328
  /**
329
   * The original label of the classification to change. */
330
  readonly enumOptionKey: string;
331
  /**
332
   * The details of the updated classification. */
333
  readonly data: UpdateClassificationRequestBodyDataField;
334
  readonly rawData?: SerializedData;
335
}
336
export class UpdateClassificationHeaders {
144✔
337
  /**
338
   * Extra headers that will be included in the HTTP request. */
339
  readonly extraHeaders?: {
2✔
340
    readonly [key: string]: undefined | string;
341
  } = {};
342
  constructor(
343
    fields: Omit<UpdateClassificationHeaders, 'extraHeaders'> &
344
      Partial<Pick<UpdateClassificationHeaders, 'extraHeaders'>>,
345
  ) {
346
    if (fields.extraHeaders !== undefined) {
2!
347
      this.extraHeaders = fields.extraHeaders;
×
348
    }
349
  }
350
}
351
export interface UpdateClassificationHeadersInput {
352
  /**
353
   * Extra headers that will be included in the HTTP request. */
354
  readonly extraHeaders?:
355
    | undefined
356
    | {
357
        readonly [key: string]: undefined | string;
358
      };
359
}
360
export type CreateClassificationTemplateRequestBodyScopeField =
361
  | 'enterprise'
362
  | string;
363
export type CreateClassificationTemplateRequestBodyTemplateKeyField =
364
  | 'securityClassification-6VMVochwUWo'
365
  | string;
366
export type CreateClassificationTemplateRequestBodyDisplayNameField =
367
  | 'Classification'
368
  | string;
369
export type CreateClassificationTemplateRequestBodyFieldsTypeField = 'enum';
370
export type CreateClassificationTemplateRequestBodyFieldsKeyField =
371
  | 'Box__Security__Classification__Key'
372
  | string;
373
export type CreateClassificationTemplateRequestBodyFieldsDisplayNameField =
374
  | 'Classification'
375
  | string;
376
export interface CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField {
377
  /**
378
   * A longer description of the classification. */
379
  readonly classificationDefinition?: string;
380
  /**
381
   * An identifier used to assign a color to
382
   * a classification label.
383
   *
384
   * Mapping between a `colorID` and a color may
385
   * change without notice. Currently, the color
386
   * mappings are as follows.
387
   *
388
   * * `0`: Yellow
389
   * * `1`: Orange
390
   * * `2`: Watermelon red
391
   * * `3`: Purple rain
392
   * * `4`: Light blue
393
   * * `5`: Dark blue
394
   * * `6`: Light green
395
   * * `7`: Gray */
396
  readonly colorId?: number;
397
  readonly rawData?: SerializedData;
398
}
399
export interface CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField {
400
  /**
401
   * Additional information about the classification. */
402
  readonly classification?: CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField;
403
  readonly rawData?: SerializedData;
404
}
405
export interface CreateClassificationTemplateRequestBodyFieldsOptionsField {
406
  /**
407
   * The display name and key this classification. This
408
   * will be show in the Box UI. */
409
  readonly key: string;
410
  /**
411
   * Additional information about the classification. */
412
  readonly staticConfig?: CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField;
413
  readonly rawData?: SerializedData;
414
}
415
export class CreateClassificationTemplateRequestBodyFieldsField {
144✔
416
  /**
417
   * The type of the field
418
   * that is always enum. */
419
  readonly type: CreateClassificationTemplateRequestBodyFieldsTypeField =
×
420
    'enum' as CreateClassificationTemplateRequestBodyFieldsTypeField;
421
  /**
422
   * Defines classifications
423
   * available in the enterprise. */
424
  readonly key: CreateClassificationTemplateRequestBodyFieldsKeyField =
×
425
    'Box__Security__Classification__Key' as CreateClassificationTemplateRequestBodyFieldsKeyField;
426
  /**
427
   * A display name for the classification. */
428
  readonly displayName: CreateClassificationTemplateRequestBodyFieldsDisplayNameField =
×
429
    'Classification' as CreateClassificationTemplateRequestBodyFieldsDisplayNameField;
430
  /**
431
   * Determines if the classification
432
   * template is
433
   * hidden or available on
434
   * web and mobile
435
   * devices. */
436
  readonly hidden?: boolean;
437
  /**
438
   * The actual list of classifications that are present on
439
   * this template. */
440
  readonly options!: readonly CreateClassificationTemplateRequestBodyFieldsOptionsField[];
441
  readonly rawData?: SerializedData;
442
  constructor(
443
    fields: Omit<
444
      CreateClassificationTemplateRequestBodyFieldsField,
445
      'type' | 'key' | 'displayName'
446
    > &
447
      Partial<
448
        Pick<
449
          CreateClassificationTemplateRequestBodyFieldsField,
450
          'type' | 'key' | 'displayName'
451
        >
452
      >,
453
  ) {
454
    if (fields.type !== undefined) {
×
455
      this.type = fields.type;
×
456
    }
457
    if (fields.key !== undefined) {
×
458
      this.key = fields.key;
×
459
    }
460
    if (fields.displayName !== undefined) {
×
461
      this.displayName = fields.displayName;
×
462
    }
463
    if (fields.hidden !== undefined) {
×
464
      this.hidden = fields.hidden;
×
465
    }
466
    if (fields.options !== undefined) {
×
467
      this.options = fields.options;
×
468
    }
469
    if (fields.rawData !== undefined) {
×
470
      this.rawData = fields.rawData;
×
471
    }
472
  }
473
}
474
export interface CreateClassificationTemplateRequestBodyFieldsFieldInput {
475
  /**
476
   * The type of the field
477
   * that is always enum. */
478
  readonly type?: CreateClassificationTemplateRequestBodyFieldsTypeField;
479
  /**
480
   * Defines classifications
481
   * available in the enterprise. */
482
  readonly key?: CreateClassificationTemplateRequestBodyFieldsKeyField;
483
  /**
484
   * A display name for the classification. */
485
  readonly displayName?: CreateClassificationTemplateRequestBodyFieldsDisplayNameField;
486
  /**
487
   * Determines if the classification
488
   * template is
489
   * hidden or available on
490
   * web and mobile
491
   * devices. */
492
  readonly hidden?: boolean;
493
  /**
494
   * The actual list of classifications that are present on
495
   * this template. */
496
  readonly options: readonly CreateClassificationTemplateRequestBodyFieldsOptionsField[];
497
  readonly rawData?: SerializedData;
498
}
499
export class CreateClassificationTemplateRequestBody {
144✔
500
  /**
501
   * The scope in which to create the classifications. This should
502
   * be `enterprise` or `enterprise_{id}` where `id` is the unique
503
   * ID of the enterprise. */
504
  readonly scope: CreateClassificationTemplateRequestBodyScopeField =
×
505
    'enterprise' as CreateClassificationTemplateRequestBodyScopeField;
506
  /**
507
   * Defines the list of metadata templates. */
508
  readonly templateKey: CreateClassificationTemplateRequestBodyTemplateKeyField =
×
509
    'securityClassification-6VMVochwUWo' as CreateClassificationTemplateRequestBodyTemplateKeyField;
510
  /**
511
   * The name of the
512
   * template as shown in web and mobile interfaces. */
513
  readonly displayName: CreateClassificationTemplateRequestBodyDisplayNameField =
×
514
    'Classification' as CreateClassificationTemplateRequestBodyDisplayNameField;
515
  /**
516
   * Determines if the classification template is
517
   * hidden or available on web and mobile
518
   * devices. */
519
  readonly hidden?: boolean;
520
  /**
521
   * Determines if classifications are
522
   * copied along when the file or folder is
523
   * copied. */
524
  readonly copyInstanceOnItemCopy?: boolean;
525
  /**
526
   * The classification template requires exactly
527
   * one field, which holds
528
   * all the valid classification values. */
529
  readonly fields!: readonly CreateClassificationTemplateRequestBodyFieldsField[];
530
  readonly rawData?: SerializedData;
531
  constructor(
532
    fields: Omit<
533
      CreateClassificationTemplateRequestBody,
534
      'scope' | 'templateKey' | 'displayName'
535
    > &
536
      Partial<
537
        Pick<
538
          CreateClassificationTemplateRequestBody,
539
          'scope' | 'templateKey' | 'displayName'
540
        >
541
      >,
542
  ) {
543
    if (fields.scope !== undefined) {
×
544
      this.scope = fields.scope;
×
545
    }
546
    if (fields.templateKey !== undefined) {
×
547
      this.templateKey = fields.templateKey;
×
548
    }
549
    if (fields.displayName !== undefined) {
×
550
      this.displayName = fields.displayName;
×
551
    }
552
    if (fields.hidden !== undefined) {
×
553
      this.hidden = fields.hidden;
×
554
    }
555
    if (fields.copyInstanceOnItemCopy !== undefined) {
×
556
      this.copyInstanceOnItemCopy = fields.copyInstanceOnItemCopy;
×
557
    }
558
    if (fields.fields !== undefined) {
×
559
      this.fields = fields.fields;
×
560
    }
561
    if (fields.rawData !== undefined) {
×
562
      this.rawData = fields.rawData;
×
563
    }
564
  }
565
}
566
export interface CreateClassificationTemplateRequestBodyInput {
567
  /**
568
   * The scope in which to create the classifications. This should
569
   * be `enterprise` or `enterprise_{id}` where `id` is the unique
570
   * ID of the enterprise. */
571
  readonly scope?: CreateClassificationTemplateRequestBodyScopeField;
572
  /**
573
   * Defines the list of metadata templates. */
574
  readonly templateKey?: CreateClassificationTemplateRequestBodyTemplateKeyField;
575
  /**
576
   * The name of the
577
   * template as shown in web and mobile interfaces. */
578
  readonly displayName?: CreateClassificationTemplateRequestBodyDisplayNameField;
579
  /**
580
   * Determines if the classification template is
581
   * hidden or available on web and mobile
582
   * devices. */
583
  readonly hidden?: boolean;
584
  /**
585
   * Determines if classifications are
586
   * copied along when the file or folder is
587
   * copied. */
588
  readonly copyInstanceOnItemCopy?: boolean;
589
  /**
590
   * The classification template requires exactly
591
   * one field, which holds
592
   * all the valid classification values. */
593
  readonly fields: readonly CreateClassificationTemplateRequestBodyFieldsField[];
594
  readonly rawData?: SerializedData;
595
}
596
export class CreateClassificationTemplateHeaders {
144✔
597
  /**
598
   * Extra headers that will be included in the HTTP request. */
599
  readonly extraHeaders?: {
×
600
    readonly [key: string]: undefined | string;
601
  } = {};
602
  constructor(
603
    fields: Omit<CreateClassificationTemplateHeaders, 'extraHeaders'> &
604
      Partial<Pick<CreateClassificationTemplateHeaders, 'extraHeaders'>>,
605
  ) {
606
    if (fields.extraHeaders !== undefined) {
×
607
      this.extraHeaders = fields.extraHeaders;
×
608
    }
609
  }
610
}
611
export interface CreateClassificationTemplateHeadersInput {
612
  /**
613
   * Extra headers that will be included in the HTTP request. */
614
  readonly extraHeaders?:
615
    | undefined
616
    | {
617
        readonly [key: string]: undefined | string;
618
      };
619
}
620
export class ClassificationsManager {
144✔
621
  readonly auth?: Authentication;
622
  readonly networkSession: NetworkSession = new NetworkSession({});
312✔
623
  constructor(
624
    fields: Omit<
625
      ClassificationsManager,
626
      | 'networkSession'
627
      | 'getClassificationTemplate'
628
      | 'addClassification'
629
      | 'updateClassification'
630
      | 'createClassificationTemplate'
631
    > &
632
      Partial<Pick<ClassificationsManager, 'networkSession'>>,
633
  ) {
634
    if (fields.auth !== undefined) {
312✔
635
      this.auth = fields.auth;
312✔
636
    }
637
    if (fields.networkSession !== undefined) {
312✔
638
      this.networkSession = fields.networkSession;
312✔
639
    }
640
  }
641
  /**
642
   * Retrieves the classification metadata template and lists all the
643
   * classifications available to this enterprise.
644
   *
645
   * This API can also be called by including the enterprise ID in the
646
   * URL explicitly, for example
647
   * `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
648
   * @param {GetClassificationTemplateHeadersInput} headersInput Headers of getClassificationTemplate method
649
   * @param {CancellationToken} cancellationToken Token used for request cancellation.
650
   * @returns {Promise<ClassificationTemplate>}
651
   */
652
  async getClassificationTemplate(
653
    headersInput: GetClassificationTemplateHeadersInput = new GetClassificationTemplateHeaders(
6✔
654
      {},
655
    ),
656
    cancellationToken?: CancellationToken,
657
  ): Promise<ClassificationTemplate> {
658
    const headers: GetClassificationTemplateHeaders =
659
      new GetClassificationTemplateHeaders({
6✔
660
        extraHeaders: headersInput.extraHeaders,
661
      });
662
    const headersMap: {
663
      readonly [key: string]: string;
664
    } = prepareParams({ ...{}, ...headers.extraHeaders });
6✔
665
    const response: FetchResponse =
666
      await this.networkSession.networkClient.fetch(
6✔
667
        new FetchOptions({
668
          url: ''.concat(
669
            this.networkSession.baseUrls.baseUrl,
670
            '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema',
671
          ) as string,
672
          method: 'GET',
673
          headers: headersMap,
674
          responseFormat: 'json' as ResponseFormat,
675
          auth: this.auth,
676
          networkSession: this.networkSession,
677
          cancellationToken: cancellationToken,
678
        }),
679
      );
680
    return {
6✔
681
      ...deserializeClassificationTemplate(response.data!),
682
      rawData: response.data!,
683
    };
684
  }
685
  /**
686
   * Adds one or more new classifications to the list of classifications
687
   * available to the enterprise.
688
   *
689
   * This API can also be called by including the enterprise ID in the
690
   * URL explicitly, for example
691
   * `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
692
   * @param {readonly AddClassificationRequestBody[]} requestBody Request body of addClassification method
693
   * @param {AddClassificationOptionalsInput} optionalsInput
694
   * @returns {Promise<ClassificationTemplate>}
695
   */
696
  async addClassification(
697
    requestBody: readonly AddClassificationRequestBody[],
×
698
    optionalsInput: AddClassificationOptionalsInput = {},
×
699
  ): Promise<ClassificationTemplate> {
700
    const optionals: AddClassificationOptionals =
701
      new AddClassificationOptionals({
×
702
        headers: optionalsInput.headers,
703
        cancellationToken: optionalsInput.cancellationToken,
704
      });
705
    const headers: any = optionals.headers;
×
706
    const cancellationToken: any = optionals.cancellationToken;
×
707
    const headersMap: {
708
      readonly [key: string]: string;
709
    } = prepareParams({ ...{}, ...headers.extraHeaders });
×
710
    const response: FetchResponse =
711
      await this.networkSession.networkClient.fetch(
×
712
        new FetchOptions({
713
          url: ''.concat(
714
            this.networkSession.baseUrls.baseUrl,
715
            '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#add',
716
          ) as string,
717
          method: 'PUT',
718
          headers: headersMap,
719
          data: requestBody.map(
720
            serializeAddClassificationRequestBody,
721
          ) as readonly any[],
722
          contentType: 'application/json',
723
          responseFormat: 'json' as ResponseFormat,
724
          auth: this.auth,
725
          networkSession: this.networkSession,
726
          cancellationToken: cancellationToken,
727
        }),
728
      );
729
    return {
×
730
      ...deserializeClassificationTemplate(response.data!),
731
      rawData: response.data!,
732
    };
733
  }
734
  /**
735
   * Updates the labels and descriptions of one or more classifications
736
   * available to the enterprise.
737
   *
738
   * This API can also be called by including the enterprise ID in the
739
   * URL explicitly, for example
740
   * `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
741
   * @param {readonly UpdateClassificationRequestBody[]} requestBody Request body of updateClassification method
742
   * @param {UpdateClassificationOptionalsInput} optionalsInput
743
   * @returns {Promise<ClassificationTemplate>}
744
   */
745
  async updateClassification(
746
    requestBody: readonly UpdateClassificationRequestBody[],
2✔
747
    optionalsInput: UpdateClassificationOptionalsInput = {},
2✔
748
  ): Promise<ClassificationTemplate> {
749
    const optionals: UpdateClassificationOptionals =
750
      new UpdateClassificationOptionals({
2✔
751
        headers: optionalsInput.headers,
752
        cancellationToken: optionalsInput.cancellationToken,
753
      });
754
    const headers: any = optionals.headers;
2✔
755
    const cancellationToken: any = optionals.cancellationToken;
2✔
756
    const headersMap: {
757
      readonly [key: string]: string;
758
    } = prepareParams({ ...{}, ...headers.extraHeaders });
2✔
759
    const response: FetchResponse =
760
      await this.networkSession.networkClient.fetch(
2✔
761
        new FetchOptions({
762
          url: ''.concat(
763
            this.networkSession.baseUrls.baseUrl,
764
            '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#update',
765
          ) as string,
766
          method: 'PUT',
767
          headers: headersMap,
768
          data: requestBody.map(
769
            serializeUpdateClassificationRequestBody,
770
          ) as readonly any[],
771
          contentType: 'application/json-patch+json',
772
          responseFormat: 'json' as ResponseFormat,
773
          auth: this.auth,
774
          networkSession: this.networkSession,
775
          cancellationToken: cancellationToken,
776
        }),
777
      );
778
    return {
2✔
779
      ...deserializeClassificationTemplate(response.data!),
780
      rawData: response.data!,
781
    };
782
  }
783
  /**
784
   * When an enterprise does not yet have any classifications, this API call
785
   * initializes the classification template with an initial set of
786
   * classifications.
787
   *
788
   * If an enterprise already has a classification, the template will already
789
   * exist and instead an API call should be made to add additional
790
   * classifications.
791
   * @param {CreateClassificationTemplateRequestBodyInput} requestBodyInput Request body of createClassificationTemplate method
792
   * @param {CreateClassificationTemplateOptionalsInput} optionalsInput
793
   * @returns {Promise<ClassificationTemplate>}
794
   */
795
  async createClassificationTemplate(
796
    requestBodyInput: CreateClassificationTemplateRequestBodyInput,
×
797
    optionalsInput: CreateClassificationTemplateOptionalsInput = {},
×
798
  ): Promise<ClassificationTemplate> {
799
    const requestBody: CreateClassificationTemplateRequestBody =
800
      new CreateClassificationTemplateRequestBody({
×
801
        scope: requestBodyInput.scope,
802
        templateKey: requestBodyInput.templateKey,
803
        displayName: requestBodyInput.displayName,
804
        hidden: requestBodyInput.hidden,
805
        copyInstanceOnItemCopy: requestBodyInput.copyInstanceOnItemCopy,
806
        fields: requestBodyInput.fields,
807
      });
808
    const optionals: CreateClassificationTemplateOptionals =
809
      new CreateClassificationTemplateOptionals({
×
810
        headers: optionalsInput.headers,
811
        cancellationToken: optionalsInput.cancellationToken,
812
      });
813
    const headers: any = optionals.headers;
×
814
    const cancellationToken: any = optionals.cancellationToken;
×
815
    const headersMap: {
816
      readonly [key: string]: string;
817
    } = prepareParams({ ...{}, ...headers.extraHeaders });
×
818
    const response: FetchResponse =
819
      await this.networkSession.networkClient.fetch(
×
820
        new FetchOptions({
821
          url: ''.concat(
822
            this.networkSession.baseUrls.baseUrl,
823
            '/2.0/metadata_templates/schema#classifications',
824
          ) as string,
825
          method: 'POST',
826
          headers: headersMap,
827
          data: serializeCreateClassificationTemplateRequestBody(requestBody),
828
          contentType: 'application/json',
829
          responseFormat: 'json' as ResponseFormat,
830
          auth: this.auth,
831
          networkSession: this.networkSession,
832
          cancellationToken: cancellationToken,
833
        }),
834
      );
835
    return {
×
836
      ...deserializeClassificationTemplate(response.data!),
837
      rawData: response.data!,
838
    };
839
  }
840
}
841
export interface ClassificationsManagerInput {
842
  readonly auth?: Authentication;
843
  readonly networkSession?: NetworkSession;
844
}
845
export function serializeAddClassificationRequestBodyOpField(
144✔
846
  val: AddClassificationRequestBodyOpField,
847
): SerializedData {
848
  return val;
×
849
}
850
export function deserializeAddClassificationRequestBodyOpField(
144✔
851
  val: SerializedData,
852
): AddClassificationRequestBodyOpField {
853
  if (val == 'addEnumOption') {
×
854
    return val;
×
855
  }
NEW
856
  if (sdIsString(val)) {
×
NEW
857
    return val;
×
858
  }
859
  throw new BoxSdkError({
×
860
    message: "Can't deserialize AddClassificationRequestBodyOpField",
861
  });
862
}
863
export function serializeAddClassificationRequestBodyFieldKeyField(
144✔
864
  val: AddClassificationRequestBodyFieldKeyField,
865
): SerializedData {
866
  return val;
×
867
}
868
export function deserializeAddClassificationRequestBodyFieldKeyField(
144✔
869
  val: SerializedData,
870
): AddClassificationRequestBodyFieldKeyField {
871
  if (val == 'Box__Security__Classification__Key') {
×
872
    return val;
×
873
  }
NEW
874
  if (sdIsString(val)) {
×
NEW
875
    return val;
×
876
  }
877
  throw new BoxSdkError({
×
878
    message: "Can't deserialize AddClassificationRequestBodyFieldKeyField",
879
  });
880
}
881
export function serializeAddClassificationRequestBodyDataStaticConfigClassificationField(
144✔
882
  val: AddClassificationRequestBodyDataStaticConfigClassificationField,
883
): SerializedData {
884
  return {
×
885
    ['classificationDefinition']: val.classificationDefinition,
886
    ['colorID']: val.colorId,
887
  };
888
}
889
export function deserializeAddClassificationRequestBodyDataStaticConfigClassificationField(
144✔
890
  val: SerializedData,
891
): AddClassificationRequestBodyDataStaticConfigClassificationField {
892
  if (!sdIsMap(val)) {
×
893
    throw new BoxSdkError({
×
894
      message:
895
        'Expecting a map for "AddClassificationRequestBodyDataStaticConfigClassificationField"',
896
    });
897
  }
898
  if (
×
899
    !(val.classificationDefinition == void 0) &&
×
900
    !sdIsString(val.classificationDefinition)
901
  ) {
902
    throw new BoxSdkError({
×
903
      message:
904
        'Expecting string for "classificationDefinition" of type "AddClassificationRequestBodyDataStaticConfigClassificationField"',
905
    });
906
  }
907
  const classificationDefinition: undefined | string =
908
    val.classificationDefinition == void 0
×
909
      ? void 0
910
      : val.classificationDefinition;
911
  if (!(val.colorID == void 0) && !sdIsNumber(val.colorID)) {
×
912
    throw new BoxSdkError({
×
913
      message:
914
        'Expecting number for "colorID" of type "AddClassificationRequestBodyDataStaticConfigClassificationField"',
915
    });
916
  }
917
  const colorId: undefined | number =
918
    val.colorID == void 0 ? void 0 : val.colorID;
×
919
  return {
×
920
    classificationDefinition: classificationDefinition,
921
    colorId: colorId,
922
  } satisfies AddClassificationRequestBodyDataStaticConfigClassificationField;
923
}
924
export function serializeAddClassificationRequestBodyDataStaticConfigField(
144✔
925
  val: AddClassificationRequestBodyDataStaticConfigField,
926
): SerializedData {
927
  return {
×
928
    ['classification']:
929
      val.classification == void 0
×
930
        ? val.classification
931
        : serializeAddClassificationRequestBodyDataStaticConfigClassificationField(
932
            val.classification,
933
          ),
934
  };
935
}
936
export function deserializeAddClassificationRequestBodyDataStaticConfigField(
144✔
937
  val: SerializedData,
938
): AddClassificationRequestBodyDataStaticConfigField {
939
  if (!sdIsMap(val)) {
×
940
    throw new BoxSdkError({
×
941
      message:
942
        'Expecting a map for "AddClassificationRequestBodyDataStaticConfigField"',
943
    });
944
  }
945
  const classification:
946
    | undefined
947
    | AddClassificationRequestBodyDataStaticConfigClassificationField =
948
    val.classification == void 0
×
949
      ? void 0
950
      : deserializeAddClassificationRequestBodyDataStaticConfigClassificationField(
951
          val.classification,
952
        );
953
  return {
×
954
    classification: classification,
955
  } satisfies AddClassificationRequestBodyDataStaticConfigField;
956
}
957
export function serializeAddClassificationRequestBodyDataField(
144✔
958
  val: AddClassificationRequestBodyDataField,
959
): SerializedData {
960
  return {
×
961
    ['key']: val.key,
962
    ['staticConfig']:
963
      val.staticConfig == void 0
×
964
        ? val.staticConfig
965
        : serializeAddClassificationRequestBodyDataStaticConfigField(
966
            val.staticConfig,
967
          ),
968
  };
969
}
970
export function deserializeAddClassificationRequestBodyDataField(
144✔
971
  val: SerializedData,
972
): AddClassificationRequestBodyDataField {
973
  if (!sdIsMap(val)) {
×
974
    throw new BoxSdkError({
×
975
      message: 'Expecting a map for "AddClassificationRequestBodyDataField"',
976
    });
977
  }
978
  if (val.key == void 0) {
×
979
    throw new BoxSdkError({
×
980
      message:
981
        'Expecting "key" of type "AddClassificationRequestBodyDataField" to be defined',
982
    });
983
  }
984
  if (!sdIsString(val.key)) {
×
985
    throw new BoxSdkError({
×
986
      message:
987
        'Expecting string for "key" of type "AddClassificationRequestBodyDataField"',
988
    });
989
  }
990
  const key: string = val.key;
×
991
  const staticConfig:
992
    | undefined
993
    | AddClassificationRequestBodyDataStaticConfigField =
994
    val.staticConfig == void 0
×
995
      ? void 0
996
      : deserializeAddClassificationRequestBodyDataStaticConfigField(
997
          val.staticConfig,
998
        );
999
  return {
×
1000
    key: key,
1001
    staticConfig: staticConfig,
1002
  } satisfies AddClassificationRequestBodyDataField;
1003
}
1004
export function serializeAddClassificationRequestBody(
144✔
1005
  val: AddClassificationRequestBody,
1006
): SerializedData {
1007
  return {
×
1008
    ['op']: serializeAddClassificationRequestBodyOpField(val.op),
1009
    ['fieldKey']: serializeAddClassificationRequestBodyFieldKeyField(
1010
      val.fieldKey,
1011
    ),
1012
    ['data']: serializeAddClassificationRequestBodyDataField(val.data),
1013
  };
1014
}
1015
export function deserializeAddClassificationRequestBody(
144✔
1016
  val: SerializedData,
1017
): AddClassificationRequestBody {
1018
  if (!sdIsMap(val)) {
×
1019
    throw new BoxSdkError({
×
1020
      message: 'Expecting a map for "AddClassificationRequestBody"',
1021
    });
1022
  }
1023
  if (val.op == void 0) {
×
1024
    throw new BoxSdkError({
×
1025
      message:
1026
        'Expecting "op" of type "AddClassificationRequestBody" to be defined',
1027
    });
1028
  }
1029
  const op: AddClassificationRequestBodyOpField =
1030
    deserializeAddClassificationRequestBodyOpField(val.op);
×
1031
  if (val.fieldKey == void 0) {
×
1032
    throw new BoxSdkError({
×
1033
      message:
1034
        'Expecting "fieldKey" of type "AddClassificationRequestBody" to be defined',
1035
    });
1036
  }
1037
  const fieldKey: AddClassificationRequestBodyFieldKeyField =
1038
    deserializeAddClassificationRequestBodyFieldKeyField(val.fieldKey);
×
1039
  if (val.data == void 0) {
×
1040
    throw new BoxSdkError({
×
1041
      message:
1042
        'Expecting "data" of type "AddClassificationRequestBody" to be defined',
1043
    });
1044
  }
1045
  const data: AddClassificationRequestBodyDataField =
1046
    deserializeAddClassificationRequestBodyDataField(val.data);
×
1047
  return {
×
1048
    op: op,
1049
    fieldKey: fieldKey,
1050
    data: data,
1051
  } satisfies AddClassificationRequestBody;
1052
}
1053
export function serializeAddClassificationRequestBodyInput(
144✔
1054
  val: AddClassificationRequestBodyInput,
1055
): SerializedData {
1056
  return {
×
1057
    ['op']:
1058
      val.op == void 0
×
1059
        ? val.op
1060
        : serializeAddClassificationRequestBodyOpField(val.op),
1061
    ['fieldKey']:
1062
      val.fieldKey == void 0
×
1063
        ? val.fieldKey
1064
        : serializeAddClassificationRequestBodyFieldKeyField(val.fieldKey),
1065
    ['data']: serializeAddClassificationRequestBodyDataField(val.data),
1066
  };
1067
}
1068
export function deserializeAddClassificationRequestBodyInput(
144✔
1069
  val: SerializedData,
1070
): AddClassificationRequestBodyInput {
1071
  if (!sdIsMap(val)) {
×
1072
    throw new BoxSdkError({
×
1073
      message: 'Expecting a map for "AddClassificationRequestBodyInput"',
1074
    });
1075
  }
1076
  const op: undefined | AddClassificationRequestBodyOpField =
1077
    val.op == void 0
×
1078
      ? void 0
1079
      : deserializeAddClassificationRequestBodyOpField(val.op);
1080
  const fieldKey: undefined | AddClassificationRequestBodyFieldKeyField =
1081
    val.fieldKey == void 0
×
1082
      ? void 0
1083
      : deserializeAddClassificationRequestBodyFieldKeyField(val.fieldKey);
1084
  if (val.data == void 0) {
×
1085
    throw new BoxSdkError({
×
1086
      message:
1087
        'Expecting "data" of type "AddClassificationRequestBodyInput" to be defined',
1088
    });
1089
  }
1090
  const data: AddClassificationRequestBodyDataField =
1091
    deserializeAddClassificationRequestBodyDataField(val.data);
×
1092
  return {
×
1093
    op: op,
1094
    fieldKey: fieldKey,
1095
    data: data,
1096
  } satisfies AddClassificationRequestBodyInput;
1097
}
1098
export function serializeUpdateClassificationRequestBodyOpField(
144✔
1099
  val: UpdateClassificationRequestBodyOpField,
1100
): SerializedData {
1101
  return val;
2✔
1102
}
1103
export function deserializeUpdateClassificationRequestBodyOpField(
144✔
1104
  val: SerializedData,
1105
): UpdateClassificationRequestBodyOpField {
1106
  if (val == 'editEnumOption') {
×
1107
    return val;
×
1108
  }
NEW
1109
  if (sdIsString(val)) {
×
NEW
1110
    return val;
×
1111
  }
1112
  throw new BoxSdkError({
×
1113
    message: "Can't deserialize UpdateClassificationRequestBodyOpField",
1114
  });
1115
}
1116
export function serializeUpdateClassificationRequestBodyFieldKeyField(
144✔
1117
  val: UpdateClassificationRequestBodyFieldKeyField,
1118
): SerializedData {
1119
  return val;
2✔
1120
}
1121
export function deserializeUpdateClassificationRequestBodyFieldKeyField(
144✔
1122
  val: SerializedData,
1123
): UpdateClassificationRequestBodyFieldKeyField {
1124
  if (val == 'Box__Security__Classification__Key') {
×
1125
    return val;
×
1126
  }
NEW
1127
  if (sdIsString(val)) {
×
NEW
1128
    return val;
×
1129
  }
1130
  throw new BoxSdkError({
×
1131
    message: "Can't deserialize UpdateClassificationRequestBodyFieldKeyField",
1132
  });
1133
}
1134
export function serializeUpdateClassificationRequestBodyDataStaticConfigClassificationField(
144✔
1135
  val: UpdateClassificationRequestBodyDataStaticConfigClassificationField,
1136
): SerializedData {
1137
  return {
2✔
1138
    ['classificationDefinition']: val.classificationDefinition,
1139
    ['colorID']: val.colorId,
1140
  };
1141
}
1142
export function deserializeUpdateClassificationRequestBodyDataStaticConfigClassificationField(
144✔
1143
  val: SerializedData,
1144
): UpdateClassificationRequestBodyDataStaticConfigClassificationField {
1145
  if (!sdIsMap(val)) {
×
1146
    throw new BoxSdkError({
×
1147
      message:
1148
        'Expecting a map for "UpdateClassificationRequestBodyDataStaticConfigClassificationField"',
1149
    });
1150
  }
1151
  if (
×
1152
    !(val.classificationDefinition == void 0) &&
×
1153
    !sdIsString(val.classificationDefinition)
1154
  ) {
1155
    throw new BoxSdkError({
×
1156
      message:
1157
        'Expecting string for "classificationDefinition" of type "UpdateClassificationRequestBodyDataStaticConfigClassificationField"',
1158
    });
1159
  }
1160
  const classificationDefinition: undefined | string =
1161
    val.classificationDefinition == void 0
×
1162
      ? void 0
1163
      : val.classificationDefinition;
1164
  if (!(val.colorID == void 0) && !sdIsNumber(val.colorID)) {
×
1165
    throw new BoxSdkError({
×
1166
      message:
1167
        'Expecting number for "colorID" of type "UpdateClassificationRequestBodyDataStaticConfigClassificationField"',
1168
    });
1169
  }
1170
  const colorId: undefined | number =
1171
    val.colorID == void 0 ? void 0 : val.colorID;
×
1172
  return {
×
1173
    classificationDefinition: classificationDefinition,
1174
    colorId: colorId,
1175
  } satisfies UpdateClassificationRequestBodyDataStaticConfigClassificationField;
1176
}
1177
export function serializeUpdateClassificationRequestBodyDataStaticConfigField(
144✔
1178
  val: UpdateClassificationRequestBodyDataStaticConfigField,
1179
): SerializedData {
1180
  return {
2✔
1181
    ['classification']:
1182
      val.classification == void 0
2!
1183
        ? val.classification
1184
        : serializeUpdateClassificationRequestBodyDataStaticConfigClassificationField(
1185
            val.classification,
1186
          ),
1187
  };
1188
}
1189
export function deserializeUpdateClassificationRequestBodyDataStaticConfigField(
144✔
1190
  val: SerializedData,
1191
): UpdateClassificationRequestBodyDataStaticConfigField {
1192
  if (!sdIsMap(val)) {
×
1193
    throw new BoxSdkError({
×
1194
      message:
1195
        'Expecting a map for "UpdateClassificationRequestBodyDataStaticConfigField"',
1196
    });
1197
  }
1198
  const classification:
1199
    | undefined
1200
    | UpdateClassificationRequestBodyDataStaticConfigClassificationField =
1201
    val.classification == void 0
×
1202
      ? void 0
1203
      : deserializeUpdateClassificationRequestBodyDataStaticConfigClassificationField(
1204
          val.classification,
1205
        );
1206
  return {
×
1207
    classification: classification,
1208
  } satisfies UpdateClassificationRequestBodyDataStaticConfigField;
1209
}
1210
export function serializeUpdateClassificationRequestBodyDataField(
144✔
1211
  val: UpdateClassificationRequestBodyDataField,
1212
): SerializedData {
1213
  return {
2✔
1214
    ['key']: val.key,
1215
    ['staticConfig']:
1216
      val.staticConfig == void 0
2!
1217
        ? val.staticConfig
1218
        : serializeUpdateClassificationRequestBodyDataStaticConfigField(
1219
            val.staticConfig,
1220
          ),
1221
  };
1222
}
1223
export function deserializeUpdateClassificationRequestBodyDataField(
144✔
1224
  val: SerializedData,
1225
): UpdateClassificationRequestBodyDataField {
1226
  if (!sdIsMap(val)) {
×
1227
    throw new BoxSdkError({
×
1228
      message: 'Expecting a map for "UpdateClassificationRequestBodyDataField"',
1229
    });
1230
  }
1231
  if (val.key == void 0) {
×
1232
    throw new BoxSdkError({
×
1233
      message:
1234
        'Expecting "key" of type "UpdateClassificationRequestBodyDataField" to be defined',
1235
    });
1236
  }
1237
  if (!sdIsString(val.key)) {
×
1238
    throw new BoxSdkError({
×
1239
      message:
1240
        'Expecting string for "key" of type "UpdateClassificationRequestBodyDataField"',
1241
    });
1242
  }
1243
  const key: string = val.key;
×
1244
  const staticConfig:
1245
    | undefined
1246
    | UpdateClassificationRequestBodyDataStaticConfigField =
1247
    val.staticConfig == void 0
×
1248
      ? void 0
1249
      : deserializeUpdateClassificationRequestBodyDataStaticConfigField(
1250
          val.staticConfig,
1251
        );
1252
  return {
×
1253
    key: key,
1254
    staticConfig: staticConfig,
1255
  } satisfies UpdateClassificationRequestBodyDataField;
1256
}
1257
export function serializeUpdateClassificationRequestBody(
144✔
1258
  val: UpdateClassificationRequestBody,
1259
): SerializedData {
1260
  return {
2✔
1261
    ['op']: serializeUpdateClassificationRequestBodyOpField(val.op),
1262
    ['fieldKey']: serializeUpdateClassificationRequestBodyFieldKeyField(
1263
      val.fieldKey,
1264
    ),
1265
    ['enumOptionKey']: val.enumOptionKey,
1266
    ['data']: serializeUpdateClassificationRequestBodyDataField(val.data),
1267
  };
1268
}
1269
export function deserializeUpdateClassificationRequestBody(
144✔
1270
  val: SerializedData,
1271
): UpdateClassificationRequestBody {
1272
  if (!sdIsMap(val)) {
×
1273
    throw new BoxSdkError({
×
1274
      message: 'Expecting a map for "UpdateClassificationRequestBody"',
1275
    });
1276
  }
1277
  if (val.op == void 0) {
×
1278
    throw new BoxSdkError({
×
1279
      message:
1280
        'Expecting "op" of type "UpdateClassificationRequestBody" to be defined',
1281
    });
1282
  }
1283
  const op: UpdateClassificationRequestBodyOpField =
1284
    deserializeUpdateClassificationRequestBodyOpField(val.op);
×
1285
  if (val.fieldKey == void 0) {
×
1286
    throw new BoxSdkError({
×
1287
      message:
1288
        'Expecting "fieldKey" of type "UpdateClassificationRequestBody" to be defined',
1289
    });
1290
  }
1291
  const fieldKey: UpdateClassificationRequestBodyFieldKeyField =
1292
    deserializeUpdateClassificationRequestBodyFieldKeyField(val.fieldKey);
×
1293
  if (val.enumOptionKey == void 0) {
×
1294
    throw new BoxSdkError({
×
1295
      message:
1296
        'Expecting "enumOptionKey" of type "UpdateClassificationRequestBody" to be defined',
1297
    });
1298
  }
1299
  if (!sdIsString(val.enumOptionKey)) {
×
1300
    throw new BoxSdkError({
×
1301
      message:
1302
        'Expecting string for "enumOptionKey" of type "UpdateClassificationRequestBody"',
1303
    });
1304
  }
1305
  const enumOptionKey: string = val.enumOptionKey;
×
1306
  if (val.data == void 0) {
×
1307
    throw new BoxSdkError({
×
1308
      message:
1309
        'Expecting "data" of type "UpdateClassificationRequestBody" to be defined',
1310
    });
1311
  }
1312
  const data: UpdateClassificationRequestBodyDataField =
1313
    deserializeUpdateClassificationRequestBodyDataField(val.data);
×
1314
  return {
×
1315
    op: op,
1316
    fieldKey: fieldKey,
1317
    enumOptionKey: enumOptionKey,
1318
    data: data,
1319
  } satisfies UpdateClassificationRequestBody;
1320
}
1321
export function serializeUpdateClassificationRequestBodyInput(
144✔
1322
  val: UpdateClassificationRequestBodyInput,
1323
): SerializedData {
1324
  return {
×
1325
    ['op']:
1326
      val.op == void 0
×
1327
        ? val.op
1328
        : serializeUpdateClassificationRequestBodyOpField(val.op),
1329
    ['fieldKey']:
1330
      val.fieldKey == void 0
×
1331
        ? val.fieldKey
1332
        : serializeUpdateClassificationRequestBodyFieldKeyField(val.fieldKey),
1333
    ['enumOptionKey']: val.enumOptionKey,
1334
    ['data']: serializeUpdateClassificationRequestBodyDataField(val.data),
1335
  };
1336
}
1337
export function deserializeUpdateClassificationRequestBodyInput(
144✔
1338
  val: SerializedData,
1339
): UpdateClassificationRequestBodyInput {
1340
  if (!sdIsMap(val)) {
×
1341
    throw new BoxSdkError({
×
1342
      message: 'Expecting a map for "UpdateClassificationRequestBodyInput"',
1343
    });
1344
  }
1345
  const op: undefined | UpdateClassificationRequestBodyOpField =
1346
    val.op == void 0
×
1347
      ? void 0
1348
      : deserializeUpdateClassificationRequestBodyOpField(val.op);
1349
  const fieldKey: undefined | UpdateClassificationRequestBodyFieldKeyField =
1350
    val.fieldKey == void 0
×
1351
      ? void 0
1352
      : deserializeUpdateClassificationRequestBodyFieldKeyField(val.fieldKey);
1353
  if (val.enumOptionKey == void 0) {
×
1354
    throw new BoxSdkError({
×
1355
      message:
1356
        'Expecting "enumOptionKey" of type "UpdateClassificationRequestBodyInput" to be defined',
1357
    });
1358
  }
1359
  if (!sdIsString(val.enumOptionKey)) {
×
1360
    throw new BoxSdkError({
×
1361
      message:
1362
        'Expecting string for "enumOptionKey" of type "UpdateClassificationRequestBodyInput"',
1363
    });
1364
  }
1365
  const enumOptionKey: string = val.enumOptionKey;
×
1366
  if (val.data == void 0) {
×
1367
    throw new BoxSdkError({
×
1368
      message:
1369
        'Expecting "data" of type "UpdateClassificationRequestBodyInput" to be defined',
1370
    });
1371
  }
1372
  const data: UpdateClassificationRequestBodyDataField =
1373
    deserializeUpdateClassificationRequestBodyDataField(val.data);
×
1374
  return {
×
1375
    op: op,
1376
    fieldKey: fieldKey,
1377
    enumOptionKey: enumOptionKey,
1378
    data: data,
1379
  } satisfies UpdateClassificationRequestBodyInput;
1380
}
1381
export function serializeCreateClassificationTemplateRequestBodyScopeField(
144✔
1382
  val: CreateClassificationTemplateRequestBodyScopeField,
1383
): SerializedData {
1384
  return val;
×
1385
}
1386
export function deserializeCreateClassificationTemplateRequestBodyScopeField(
144✔
1387
  val: SerializedData,
1388
): CreateClassificationTemplateRequestBodyScopeField {
1389
  if (val == 'enterprise') {
×
1390
    return val;
×
1391
  }
NEW
1392
  if (sdIsString(val)) {
×
NEW
1393
    return val;
×
1394
  }
1395
  throw new BoxSdkError({
×
1396
    message:
1397
      "Can't deserialize CreateClassificationTemplateRequestBodyScopeField",
1398
  });
1399
}
1400
export function serializeCreateClassificationTemplateRequestBodyTemplateKeyField(
144✔
1401
  val: CreateClassificationTemplateRequestBodyTemplateKeyField,
1402
): SerializedData {
1403
  return val;
×
1404
}
1405
export function deserializeCreateClassificationTemplateRequestBodyTemplateKeyField(
144✔
1406
  val: SerializedData,
1407
): CreateClassificationTemplateRequestBodyTemplateKeyField {
1408
  if (val == 'securityClassification-6VMVochwUWo') {
×
1409
    return val;
×
1410
  }
NEW
1411
  if (sdIsString(val)) {
×
NEW
1412
    return val;
×
1413
  }
1414
  throw new BoxSdkError({
×
1415
    message:
1416
      "Can't deserialize CreateClassificationTemplateRequestBodyTemplateKeyField",
1417
  });
1418
}
1419
export function serializeCreateClassificationTemplateRequestBodyDisplayNameField(
144✔
1420
  val: CreateClassificationTemplateRequestBodyDisplayNameField,
1421
): SerializedData {
1422
  return val;
×
1423
}
1424
export function deserializeCreateClassificationTemplateRequestBodyDisplayNameField(
144✔
1425
  val: SerializedData,
1426
): CreateClassificationTemplateRequestBodyDisplayNameField {
1427
  if (val == 'Classification') {
×
1428
    return val;
×
1429
  }
NEW
1430
  if (sdIsString(val)) {
×
NEW
1431
    return val;
×
1432
  }
1433
  throw new BoxSdkError({
×
1434
    message:
1435
      "Can't deserialize CreateClassificationTemplateRequestBodyDisplayNameField",
1436
  });
1437
}
1438
export function serializeCreateClassificationTemplateRequestBodyFieldsTypeField(
144✔
1439
  val: CreateClassificationTemplateRequestBodyFieldsTypeField,
1440
): SerializedData {
1441
  return val;
×
1442
}
1443
export function deserializeCreateClassificationTemplateRequestBodyFieldsTypeField(
144✔
1444
  val: SerializedData,
1445
): CreateClassificationTemplateRequestBodyFieldsTypeField {
1446
  if (val == 'enum') {
×
1447
    return val;
×
1448
  }
1449
  throw new BoxSdkError({
×
1450
    message:
1451
      "Can't deserialize CreateClassificationTemplateRequestBodyFieldsTypeField",
1452
  });
1453
}
1454
export function serializeCreateClassificationTemplateRequestBodyFieldsKeyField(
144✔
1455
  val: CreateClassificationTemplateRequestBodyFieldsKeyField,
1456
): SerializedData {
1457
  return val;
×
1458
}
1459
export function deserializeCreateClassificationTemplateRequestBodyFieldsKeyField(
144✔
1460
  val: SerializedData,
1461
): CreateClassificationTemplateRequestBodyFieldsKeyField {
1462
  if (val == 'Box__Security__Classification__Key') {
×
1463
    return val;
×
1464
  }
NEW
1465
  if (sdIsString(val)) {
×
NEW
1466
    return val;
×
1467
  }
1468
  throw new BoxSdkError({
×
1469
    message:
1470
      "Can't deserialize CreateClassificationTemplateRequestBodyFieldsKeyField",
1471
  });
1472
}
1473
export function serializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField(
144✔
1474
  val: CreateClassificationTemplateRequestBodyFieldsDisplayNameField,
1475
): SerializedData {
1476
  return val;
×
1477
}
1478
export function deserializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField(
144✔
1479
  val: SerializedData,
1480
): CreateClassificationTemplateRequestBodyFieldsDisplayNameField {
1481
  if (val == 'Classification') {
×
1482
    return val;
×
1483
  }
NEW
1484
  if (sdIsString(val)) {
×
NEW
1485
    return val;
×
1486
  }
1487
  throw new BoxSdkError({
×
1488
    message:
1489
      "Can't deserialize CreateClassificationTemplateRequestBodyFieldsDisplayNameField",
1490
  });
1491
}
1492
export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField(
144✔
1493
  val: CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField,
1494
): SerializedData {
1495
  return {
×
1496
    ['classificationDefinition']: val.classificationDefinition,
1497
    ['colorID']: val.colorId,
1498
  };
1499
}
1500
export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField(
144✔
1501
  val: SerializedData,
1502
): CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField {
1503
  if (!sdIsMap(val)) {
×
1504
    throw new BoxSdkError({
×
1505
      message:
1506
        'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField"',
1507
    });
1508
  }
1509
  if (
×
1510
    !(val.classificationDefinition == void 0) &&
×
1511
    !sdIsString(val.classificationDefinition)
1512
  ) {
1513
    throw new BoxSdkError({
×
1514
      message:
1515
        'Expecting string for "classificationDefinition" of type "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField"',
1516
    });
1517
  }
1518
  const classificationDefinition: undefined | string =
1519
    val.classificationDefinition == void 0
×
1520
      ? void 0
1521
      : val.classificationDefinition;
1522
  if (!(val.colorID == void 0) && !sdIsNumber(val.colorID)) {
×
1523
    throw new BoxSdkError({
×
1524
      message:
1525
        'Expecting number for "colorID" of type "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField"',
1526
    });
1527
  }
1528
  const colorId: undefined | number =
1529
    val.colorID == void 0 ? void 0 : val.colorID;
×
1530
  return {
×
1531
    classificationDefinition: classificationDefinition,
1532
    colorId: colorId,
1533
  } satisfies CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField;
1534
}
1535
export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField(
144✔
1536
  val: CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField,
1537
): SerializedData {
1538
  return {
×
1539
    ['classification']:
1540
      val.classification == void 0
×
1541
        ? val.classification
1542
        : serializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField(
1543
            val.classification,
1544
          ),
1545
  };
1546
}
1547
export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField(
144✔
1548
  val: SerializedData,
1549
): CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField {
1550
  if (!sdIsMap(val)) {
×
1551
    throw new BoxSdkError({
×
1552
      message:
1553
        'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField"',
1554
    });
1555
  }
1556
  const classification:
1557
    | undefined
1558
    | CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField =
1559
    val.classification == void 0
×
1560
      ? void 0
1561
      : deserializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField(
1562
          val.classification,
1563
        );
1564
  return {
×
1565
    classification: classification,
1566
  } satisfies CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField;
1567
}
1568
export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsField(
144✔
1569
  val: CreateClassificationTemplateRequestBodyFieldsOptionsField,
1570
): SerializedData {
1571
  return {
×
1572
    ['key']: val.key,
1573
    ['staticConfig']:
1574
      val.staticConfig == void 0
×
1575
        ? val.staticConfig
1576
        : serializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField(
1577
            val.staticConfig,
1578
          ),
1579
  };
1580
}
1581
export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsField(
144✔
1582
  val: SerializedData,
1583
): CreateClassificationTemplateRequestBodyFieldsOptionsField {
1584
  if (!sdIsMap(val)) {
×
1585
    throw new BoxSdkError({
×
1586
      message:
1587
        'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsOptionsField"',
1588
    });
1589
  }
1590
  if (val.key == void 0) {
×
1591
    throw new BoxSdkError({
×
1592
      message:
1593
        'Expecting "key" of type "CreateClassificationTemplateRequestBodyFieldsOptionsField" to be defined',
1594
    });
1595
  }
1596
  if (!sdIsString(val.key)) {
×
1597
    throw new BoxSdkError({
×
1598
      message:
1599
        'Expecting string for "key" of type "CreateClassificationTemplateRequestBodyFieldsOptionsField"',
1600
    });
1601
  }
1602
  const key: string = val.key;
×
1603
  const staticConfig:
1604
    | undefined
1605
    | CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField =
1606
    val.staticConfig == void 0
×
1607
      ? void 0
1608
      : deserializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField(
1609
          val.staticConfig,
1610
        );
1611
  return {
×
1612
    key: key,
1613
    staticConfig: staticConfig,
1614
  } satisfies CreateClassificationTemplateRequestBodyFieldsOptionsField;
1615
}
1616
export function serializeCreateClassificationTemplateRequestBodyFieldsField(
144✔
1617
  val: CreateClassificationTemplateRequestBodyFieldsField,
1618
): SerializedData {
1619
  return {
×
1620
    ['type']: serializeCreateClassificationTemplateRequestBodyFieldsTypeField(
1621
      val.type,
1622
    ),
1623
    ['key']: serializeCreateClassificationTemplateRequestBodyFieldsKeyField(
1624
      val.key,
1625
    ),
1626
    ['displayName']:
1627
      serializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField(
1628
        val.displayName,
1629
      ),
1630
    ['hidden']: val.hidden,
1631
    ['options']: val.options.map(function (
1632
      item: CreateClassificationTemplateRequestBodyFieldsOptionsField,
1633
    ): SerializedData {
1634
      return serializeCreateClassificationTemplateRequestBodyFieldsOptionsField(
×
1635
        item,
1636
      );
1637
    }) as readonly any[],
1638
  };
1639
}
1640
export function deserializeCreateClassificationTemplateRequestBodyFieldsField(
144✔
1641
  val: SerializedData,
1642
): CreateClassificationTemplateRequestBodyFieldsField {
1643
  if (!sdIsMap(val)) {
×
1644
    throw new BoxSdkError({
×
1645
      message:
1646
        'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsField"',
1647
    });
1648
  }
1649
  if (val.type == void 0) {
×
1650
    throw new BoxSdkError({
×
1651
      message:
1652
        'Expecting "type" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined',
1653
    });
1654
  }
1655
  const type: CreateClassificationTemplateRequestBodyFieldsTypeField =
1656
    deserializeCreateClassificationTemplateRequestBodyFieldsTypeField(val.type);
×
1657
  if (val.key == void 0) {
×
1658
    throw new BoxSdkError({
×
1659
      message:
1660
        'Expecting "key" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined',
1661
    });
1662
  }
1663
  const key: CreateClassificationTemplateRequestBodyFieldsKeyField =
1664
    deserializeCreateClassificationTemplateRequestBodyFieldsKeyField(val.key);
×
1665
  if (val.displayName == void 0) {
×
1666
    throw new BoxSdkError({
×
1667
      message:
1668
        'Expecting "displayName" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined',
1669
    });
1670
  }
1671
  const displayName: CreateClassificationTemplateRequestBodyFieldsDisplayNameField =
1672
    deserializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField(
×
1673
      val.displayName,
1674
    );
1675
  if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) {
×
1676
    throw new BoxSdkError({
×
1677
      message:
1678
        'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBodyFieldsField"',
1679
    });
1680
  }
1681
  const hidden: undefined | boolean =
1682
    val.hidden == void 0 ? void 0 : val.hidden;
×
1683
  if (val.options == void 0) {
×
1684
    throw new BoxSdkError({
×
1685
      message:
1686
        'Expecting "options" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined',
1687
    });
1688
  }
1689
  if (!sdIsList(val.options)) {
×
1690
    throw new BoxSdkError({
×
1691
      message:
1692
        'Expecting array for "options" of type "CreateClassificationTemplateRequestBodyFieldsField"',
1693
    });
1694
  }
1695
  const options: readonly CreateClassificationTemplateRequestBodyFieldsOptionsField[] =
1696
    sdIsList(val.options)
×
1697
      ? (val.options.map(function (
1698
          itm: SerializedData,
1699
        ): CreateClassificationTemplateRequestBodyFieldsOptionsField {
1700
          return deserializeCreateClassificationTemplateRequestBodyFieldsOptionsField(
×
1701
            itm,
1702
          );
1703
        }) as readonly any[])
1704
      : [];
1705
  return {
×
1706
    type: type,
1707
    key: key,
1708
    displayName: displayName,
1709
    hidden: hidden,
1710
    options: options,
1711
  } satisfies CreateClassificationTemplateRequestBodyFieldsField;
1712
}
1713
export function serializeCreateClassificationTemplateRequestBodyFieldsFieldInput(
144✔
1714
  val: CreateClassificationTemplateRequestBodyFieldsFieldInput,
1715
): SerializedData {
1716
  return {
×
1717
    ['type']:
1718
      val.type == void 0
×
1719
        ? val.type
1720
        : serializeCreateClassificationTemplateRequestBodyFieldsTypeField(
1721
            val.type,
1722
          ),
1723
    ['key']:
1724
      val.key == void 0
×
1725
        ? val.key
1726
        : serializeCreateClassificationTemplateRequestBodyFieldsKeyField(
1727
            val.key,
1728
          ),
1729
    ['displayName']:
1730
      val.displayName == void 0
×
1731
        ? val.displayName
1732
        : serializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField(
1733
            val.displayName,
1734
          ),
1735
    ['hidden']: val.hidden,
1736
    ['options']: val.options.map(function (
1737
      item: CreateClassificationTemplateRequestBodyFieldsOptionsField,
1738
    ): SerializedData {
1739
      return serializeCreateClassificationTemplateRequestBodyFieldsOptionsField(
×
1740
        item,
1741
      );
1742
    }) as readonly any[],
1743
  };
1744
}
1745
export function deserializeCreateClassificationTemplateRequestBodyFieldsFieldInput(
144✔
1746
  val: SerializedData,
1747
): CreateClassificationTemplateRequestBodyFieldsFieldInput {
1748
  if (!sdIsMap(val)) {
×
1749
    throw new BoxSdkError({
×
1750
      message:
1751
        'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsFieldInput"',
1752
    });
1753
  }
1754
  const type:
1755
    | undefined
1756
    | CreateClassificationTemplateRequestBodyFieldsTypeField =
1757
    val.type == void 0
×
1758
      ? void 0
1759
      : deserializeCreateClassificationTemplateRequestBodyFieldsTypeField(
1760
          val.type,
1761
        );
1762
  const key: undefined | CreateClassificationTemplateRequestBodyFieldsKeyField =
1763
    val.key == void 0
×
1764
      ? void 0
1765
      : deserializeCreateClassificationTemplateRequestBodyFieldsKeyField(
1766
          val.key,
1767
        );
1768
  const displayName:
1769
    | undefined
1770
    | CreateClassificationTemplateRequestBodyFieldsDisplayNameField =
1771
    val.displayName == void 0
×
1772
      ? void 0
1773
      : deserializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField(
1774
          val.displayName,
1775
        );
1776
  if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) {
×
1777
    throw new BoxSdkError({
×
1778
      message:
1779
        'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBodyFieldsFieldInput"',
1780
    });
1781
  }
1782
  const hidden: undefined | boolean =
1783
    val.hidden == void 0 ? void 0 : val.hidden;
×
1784
  if (val.options == void 0) {
×
1785
    throw new BoxSdkError({
×
1786
      message:
1787
        'Expecting "options" of type "CreateClassificationTemplateRequestBodyFieldsFieldInput" to be defined',
1788
    });
1789
  }
1790
  if (!sdIsList(val.options)) {
×
1791
    throw new BoxSdkError({
×
1792
      message:
1793
        'Expecting array for "options" of type "CreateClassificationTemplateRequestBodyFieldsFieldInput"',
1794
    });
1795
  }
1796
  const options: readonly CreateClassificationTemplateRequestBodyFieldsOptionsField[] =
1797
    sdIsList(val.options)
×
1798
      ? (val.options.map(function (
1799
          itm: SerializedData,
1800
        ): CreateClassificationTemplateRequestBodyFieldsOptionsField {
1801
          return deserializeCreateClassificationTemplateRequestBodyFieldsOptionsField(
×
1802
            itm,
1803
          );
1804
        }) as readonly any[])
1805
      : [];
1806
  return {
×
1807
    type: type,
1808
    key: key,
1809
    displayName: displayName,
1810
    hidden: hidden,
1811
    options: options,
1812
  } satisfies CreateClassificationTemplateRequestBodyFieldsFieldInput;
1813
}
1814
export function serializeCreateClassificationTemplateRequestBody(
144✔
1815
  val: CreateClassificationTemplateRequestBody,
1816
): SerializedData {
1817
  return {
×
1818
    ['scope']: serializeCreateClassificationTemplateRequestBodyScopeField(
1819
      val.scope,
1820
    ),
1821
    ['templateKey']:
1822
      serializeCreateClassificationTemplateRequestBodyTemplateKeyField(
1823
        val.templateKey,
1824
      ),
1825
    ['displayName']:
1826
      serializeCreateClassificationTemplateRequestBodyDisplayNameField(
1827
        val.displayName,
1828
      ),
1829
    ['hidden']: val.hidden,
1830
    ['copyInstanceOnItemCopy']: val.copyInstanceOnItemCopy,
1831
    ['fields']: val.fields.map(function (
1832
      item: CreateClassificationTemplateRequestBodyFieldsField,
1833
    ): SerializedData {
1834
      return serializeCreateClassificationTemplateRequestBodyFieldsField(item);
×
1835
    }) as readonly any[],
1836
  };
1837
}
1838
export function deserializeCreateClassificationTemplateRequestBody(
144✔
1839
  val: SerializedData,
1840
): CreateClassificationTemplateRequestBody {
1841
  if (!sdIsMap(val)) {
×
1842
    throw new BoxSdkError({
×
1843
      message: 'Expecting a map for "CreateClassificationTemplateRequestBody"',
1844
    });
1845
  }
1846
  if (val.scope == void 0) {
×
1847
    throw new BoxSdkError({
×
1848
      message:
1849
        'Expecting "scope" of type "CreateClassificationTemplateRequestBody" to be defined',
1850
    });
1851
  }
1852
  const scope: CreateClassificationTemplateRequestBodyScopeField =
1853
    deserializeCreateClassificationTemplateRequestBodyScopeField(val.scope);
×
1854
  if (val.templateKey == void 0) {
×
1855
    throw new BoxSdkError({
×
1856
      message:
1857
        'Expecting "templateKey" of type "CreateClassificationTemplateRequestBody" to be defined',
1858
    });
1859
  }
1860
  const templateKey: CreateClassificationTemplateRequestBodyTemplateKeyField =
1861
    deserializeCreateClassificationTemplateRequestBodyTemplateKeyField(
×
1862
      val.templateKey,
1863
    );
1864
  if (val.displayName == void 0) {
×
1865
    throw new BoxSdkError({
×
1866
      message:
1867
        'Expecting "displayName" of type "CreateClassificationTemplateRequestBody" to be defined',
1868
    });
1869
  }
1870
  const displayName: CreateClassificationTemplateRequestBodyDisplayNameField =
1871
    deserializeCreateClassificationTemplateRequestBodyDisplayNameField(
×
1872
      val.displayName,
1873
    );
1874
  if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) {
×
1875
    throw new BoxSdkError({
×
1876
      message:
1877
        'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBody"',
1878
    });
1879
  }
1880
  const hidden: undefined | boolean =
1881
    val.hidden == void 0 ? void 0 : val.hidden;
×
1882
  if (
×
1883
    !(val.copyInstanceOnItemCopy == void 0) &&
×
1884
    !sdIsBoolean(val.copyInstanceOnItemCopy)
1885
  ) {
1886
    throw new BoxSdkError({
×
1887
      message:
1888
        'Expecting boolean for "copyInstanceOnItemCopy" of type "CreateClassificationTemplateRequestBody"',
1889
    });
1890
  }
1891
  const copyInstanceOnItemCopy: undefined | boolean =
1892
    val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy;
×
1893
  if (val.fields == void 0) {
×
1894
    throw new BoxSdkError({
×
1895
      message:
1896
        'Expecting "fields" of type "CreateClassificationTemplateRequestBody" to be defined',
1897
    });
1898
  }
1899
  if (!sdIsList(val.fields)) {
×
1900
    throw new BoxSdkError({
×
1901
      message:
1902
        'Expecting array for "fields" of type "CreateClassificationTemplateRequestBody"',
1903
    });
1904
  }
1905
  const fields: readonly CreateClassificationTemplateRequestBodyFieldsField[] =
1906
    sdIsList(val.fields)
×
1907
      ? (val.fields.map(function (
1908
          itm: SerializedData,
1909
        ): CreateClassificationTemplateRequestBodyFieldsField {
1910
          return deserializeCreateClassificationTemplateRequestBodyFieldsField(
×
1911
            itm,
1912
          );
1913
        }) as readonly any[])
1914
      : [];
1915
  return {
×
1916
    scope: scope,
1917
    templateKey: templateKey,
1918
    displayName: displayName,
1919
    hidden: hidden,
1920
    copyInstanceOnItemCopy: copyInstanceOnItemCopy,
1921
    fields: fields,
1922
  } satisfies CreateClassificationTemplateRequestBody;
1923
}
1924
export function serializeCreateClassificationTemplateRequestBodyInput(
144✔
1925
  val: CreateClassificationTemplateRequestBodyInput,
1926
): SerializedData {
1927
  return {
×
1928
    ['scope']:
1929
      val.scope == void 0
×
1930
        ? val.scope
1931
        : serializeCreateClassificationTemplateRequestBodyScopeField(val.scope),
1932
    ['templateKey']:
1933
      val.templateKey == void 0
×
1934
        ? val.templateKey
1935
        : serializeCreateClassificationTemplateRequestBodyTemplateKeyField(
1936
            val.templateKey,
1937
          ),
1938
    ['displayName']:
1939
      val.displayName == void 0
×
1940
        ? val.displayName
1941
        : serializeCreateClassificationTemplateRequestBodyDisplayNameField(
1942
            val.displayName,
1943
          ),
1944
    ['hidden']: val.hidden,
1945
    ['copyInstanceOnItemCopy']: val.copyInstanceOnItemCopy,
1946
    ['fields']: val.fields.map(function (
1947
      item: CreateClassificationTemplateRequestBodyFieldsField,
1948
    ): SerializedData {
1949
      return serializeCreateClassificationTemplateRequestBodyFieldsField(item);
×
1950
    }) as readonly any[],
1951
  };
1952
}
1953
export function deserializeCreateClassificationTemplateRequestBodyInput(
144✔
1954
  val: SerializedData,
1955
): CreateClassificationTemplateRequestBodyInput {
1956
  if (!sdIsMap(val)) {
×
1957
    throw new BoxSdkError({
×
1958
      message:
1959
        'Expecting a map for "CreateClassificationTemplateRequestBodyInput"',
1960
    });
1961
  }
1962
  const scope: undefined | CreateClassificationTemplateRequestBodyScopeField =
1963
    val.scope == void 0
×
1964
      ? void 0
1965
      : deserializeCreateClassificationTemplateRequestBodyScopeField(val.scope);
1966
  const templateKey:
1967
    | undefined
1968
    | CreateClassificationTemplateRequestBodyTemplateKeyField =
1969
    val.templateKey == void 0
×
1970
      ? void 0
1971
      : deserializeCreateClassificationTemplateRequestBodyTemplateKeyField(
1972
          val.templateKey,
1973
        );
1974
  const displayName:
1975
    | undefined
1976
    | CreateClassificationTemplateRequestBodyDisplayNameField =
1977
    val.displayName == void 0
×
1978
      ? void 0
1979
      : deserializeCreateClassificationTemplateRequestBodyDisplayNameField(
1980
          val.displayName,
1981
        );
1982
  if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) {
×
1983
    throw new BoxSdkError({
×
1984
      message:
1985
        'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBodyInput"',
1986
    });
1987
  }
1988
  const hidden: undefined | boolean =
1989
    val.hidden == void 0 ? void 0 : val.hidden;
×
1990
  if (
×
1991
    !(val.copyInstanceOnItemCopy == void 0) &&
×
1992
    !sdIsBoolean(val.copyInstanceOnItemCopy)
1993
  ) {
1994
    throw new BoxSdkError({
×
1995
      message:
1996
        'Expecting boolean for "copyInstanceOnItemCopy" of type "CreateClassificationTemplateRequestBodyInput"',
1997
    });
1998
  }
1999
  const copyInstanceOnItemCopy: undefined | boolean =
2000
    val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy;
×
2001
  if (val.fields == void 0) {
×
2002
    throw new BoxSdkError({
×
2003
      message:
2004
        'Expecting "fields" of type "CreateClassificationTemplateRequestBodyInput" to be defined',
2005
    });
2006
  }
2007
  if (!sdIsList(val.fields)) {
×
2008
    throw new BoxSdkError({
×
2009
      message:
2010
        'Expecting array for "fields" of type "CreateClassificationTemplateRequestBodyInput"',
2011
    });
2012
  }
2013
  const fields: readonly CreateClassificationTemplateRequestBodyFieldsField[] =
2014
    sdIsList(val.fields)
×
2015
      ? (val.fields.map(function (
2016
          itm: SerializedData,
2017
        ): CreateClassificationTemplateRequestBodyFieldsField {
2018
          return deserializeCreateClassificationTemplateRequestBodyFieldsField(
×
2019
            itm,
2020
          );
2021
        }) as readonly any[])
2022
      : [];
2023
  return {
×
2024
    scope: scope,
2025
    templateKey: templateKey,
2026
    displayName: displayName,
2027
    hidden: hidden,
2028
    copyInstanceOnItemCopy: copyInstanceOnItemCopy,
2029
    fields: fields,
2030
  } satisfies CreateClassificationTemplateRequestBodyInput;
2031
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc