• 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

52.2
/src/managers/fileClassifications.generated.ts
1
import { serializeClassification } from '../schemas/classification.generated.js';
2
import { deserializeClassification } from '../schemas/classification.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 { Classification } from '../schemas/classification.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';
144✔
15
import { ByteStream } from '../internal/utils.js';
16
import { CancellationToken } from '../internal/utils.js';
17
import { sdToJson } from '../serialization/json.js';
18
import { SerializedData } from '../serialization/json.js';
19
import { sdIsEmpty } from '../serialization/json.js';
20
import { sdIsBoolean } from '../serialization/json.js';
21
import { sdIsNumber } from '../serialization/json.js';
22
import { sdIsString } from '../serialization/json.js';
144✔
23
import { sdIsList } from '../serialization/json.js';
24
import { sdIsMap } from '../serialization/json.js';
144✔
25
export class GetClassificationOnFileOptionals {
144✔
26
  readonly headers: GetClassificationOnFileHeaders =
6✔
27
    new GetClassificationOnFileHeaders({});
28
  readonly cancellationToken?: CancellationToken = void 0;
6✔
29
  constructor(
30
    fields: Omit<
31
      GetClassificationOnFileOptionals,
32
      'headers' | 'cancellationToken'
33
    > &
34
      Partial<
35
        Pick<GetClassificationOnFileOptionals, 'headers' | 'cancellationToken'>
36
      >,
37
  ) {
38
    if (fields.headers !== undefined) {
6!
39
      this.headers = fields.headers;
×
40
    }
41
    if (fields.cancellationToken !== undefined) {
6!
42
      this.cancellationToken = fields.cancellationToken;
×
43
    }
44
  }
45
}
46
export interface GetClassificationOnFileOptionalsInput {
47
  readonly headers?: GetClassificationOnFileHeaders;
48
  readonly cancellationToken?: undefined | CancellationToken;
49
}
50
export class AddClassificationToFileOptionals {
144✔
51
  readonly requestBody: AddClassificationToFileRequestBody =
2✔
52
    {} satisfies AddClassificationToFileRequestBody;
53
  readonly headers: AddClassificationToFileHeaders =
2✔
54
    new AddClassificationToFileHeaders({});
55
  readonly cancellationToken?: CancellationToken = void 0;
2✔
56
  constructor(
57
    fields: Omit<
58
      AddClassificationToFileOptionals,
59
      'requestBody' | 'headers' | 'cancellationToken'
60
    > &
61
      Partial<
62
        Pick<
63
          AddClassificationToFileOptionals,
64
          'requestBody' | 'headers' | 'cancellationToken'
65
        >
66
      >,
67
  ) {
68
    if (fields.requestBody !== undefined) {
2✔
69
      this.requestBody = fields.requestBody;
2✔
70
    }
71
    if (fields.headers !== undefined) {
2!
72
      this.headers = fields.headers;
×
73
    }
74
    if (fields.cancellationToken !== undefined) {
2!
75
      this.cancellationToken = fields.cancellationToken;
×
76
    }
77
  }
78
}
79
export interface AddClassificationToFileOptionalsInput {
80
  readonly requestBody?: AddClassificationToFileRequestBody;
81
  readonly headers?: AddClassificationToFileHeaders;
82
  readonly cancellationToken?: undefined | CancellationToken;
83
}
84
export class UpdateClassificationOnFileOptionals {
144✔
85
  readonly headers: UpdateClassificationOnFileHeaders =
2✔
86
    new UpdateClassificationOnFileHeaders({});
87
  readonly cancellationToken?: CancellationToken = void 0;
2✔
88
  constructor(
89
    fields: Omit<
90
      UpdateClassificationOnFileOptionals,
91
      'headers' | 'cancellationToken'
92
    > &
93
      Partial<
94
        Pick<
95
          UpdateClassificationOnFileOptionals,
96
          'headers' | 'cancellationToken'
97
        >
98
      >,
99
  ) {
100
    if (fields.headers !== undefined) {
2!
101
      this.headers = fields.headers;
×
102
    }
103
    if (fields.cancellationToken !== undefined) {
2!
104
      this.cancellationToken = fields.cancellationToken;
×
105
    }
106
  }
107
}
108
export interface UpdateClassificationOnFileOptionalsInput {
109
  readonly headers?: UpdateClassificationOnFileHeaders;
110
  readonly cancellationToken?: undefined | CancellationToken;
111
}
112
export class DeleteClassificationFromFileOptionals {
144✔
113
  readonly headers: DeleteClassificationFromFileHeaders =
2✔
114
    new DeleteClassificationFromFileHeaders({});
115
  readonly cancellationToken?: CancellationToken = void 0;
2✔
116
  constructor(
117
    fields: Omit<
118
      DeleteClassificationFromFileOptionals,
119
      'headers' | 'cancellationToken'
120
    > &
121
      Partial<
122
        Pick<
123
          DeleteClassificationFromFileOptionals,
124
          'headers' | 'cancellationToken'
125
        >
126
      >,
127
  ) {
128
    if (fields.headers !== undefined) {
2!
129
      this.headers = fields.headers;
×
130
    }
131
    if (fields.cancellationToken !== undefined) {
2!
132
      this.cancellationToken = fields.cancellationToken;
×
133
    }
134
  }
135
}
136
export interface DeleteClassificationFromFileOptionalsInput {
137
  readonly headers?: DeleteClassificationFromFileHeaders;
138
  readonly cancellationToken?: undefined | CancellationToken;
139
}
140
export class GetClassificationOnFileHeaders {
144✔
141
  /**
142
   * Extra headers that will be included in the HTTP request. */
143
  readonly extraHeaders?: {
6✔
144
    readonly [key: string]: undefined | string;
145
  } = {};
146
  constructor(
147
    fields: Omit<GetClassificationOnFileHeaders, 'extraHeaders'> &
148
      Partial<Pick<GetClassificationOnFileHeaders, 'extraHeaders'>>,
149
  ) {
150
    if (fields.extraHeaders !== undefined) {
6!
151
      this.extraHeaders = fields.extraHeaders;
×
152
    }
153
  }
154
}
155
export interface GetClassificationOnFileHeadersInput {
156
  /**
157
   * Extra headers that will be included in the HTTP request. */
158
  readonly extraHeaders?:
159
    | undefined
160
    | {
161
        readonly [key: string]: undefined | string;
162
      };
163
}
164
export interface AddClassificationToFileRequestBody {
165
  /**
166
   * The name of the classification to apply to this file.
167
   *
168
   * To list the available classifications in an enterprise,
169
   * use the classification API to retrieve the
170
   * [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema)
171
   * which lists all available classification keys. */
172
  readonly boxSecurityClassificationKey?: string;
173
  readonly rawData?: SerializedData;
174
}
175
export class AddClassificationToFileHeaders {
144✔
176
  /**
177
   * Extra headers that will be included in the HTTP request. */
178
  readonly extraHeaders?: {
2✔
179
    readonly [key: string]: undefined | string;
180
  } = {};
181
  constructor(
182
    fields: Omit<AddClassificationToFileHeaders, 'extraHeaders'> &
183
      Partial<Pick<AddClassificationToFileHeaders, 'extraHeaders'>>,
184
  ) {
185
    if (fields.extraHeaders !== undefined) {
2!
186
      this.extraHeaders = fields.extraHeaders;
×
187
    }
188
  }
189
}
190
export interface AddClassificationToFileHeadersInput {
191
  /**
192
   * Extra headers that will be included in the HTTP request. */
193
  readonly extraHeaders?:
194
    | undefined
195
    | {
196
        readonly [key: string]: undefined | string;
197
      };
198
}
199
export type UpdateClassificationOnFileRequestBodyOpField = 'replace' | string;
200
export type UpdateClassificationOnFileRequestBodyPathField =
201
  | '/Box__Security__Classification__Key'
202
  | string;
203
export class UpdateClassificationOnFileRequestBody {
144✔
204
  /**
205
   * `replace` */
206
  readonly op: UpdateClassificationOnFileRequestBodyOpField =
2✔
207
    'replace' as UpdateClassificationOnFileRequestBodyOpField;
208
  /**
209
   * Defines classifications
210
   * available in the enterprise. */
211
  readonly path: UpdateClassificationOnFileRequestBodyPathField =
2✔
212
    '/Box__Security__Classification__Key' as UpdateClassificationOnFileRequestBodyPathField;
213
  /**
214
   * The name of the classification to apply to this file.
215
   *
216
   * To list the available classifications in an enterprise,
217
   * use the classification API to retrieve the
218
   * [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema)
219
   * which lists all available classification keys. */
220
  readonly value!: string;
221
  readonly rawData?: SerializedData;
222
  constructor(
223
    fields: Omit<UpdateClassificationOnFileRequestBody, 'op' | 'path'> &
224
      Partial<Pick<UpdateClassificationOnFileRequestBody, 'op' | 'path'>>,
225
  ) {
226
    if (fields.op !== undefined) {
2!
227
      this.op = fields.op;
×
228
    }
229
    if (fields.path !== undefined) {
2!
230
      this.path = fields.path;
×
231
    }
232
    if (fields.value !== undefined) {
2✔
233
      this.value = fields.value;
2✔
234
    }
235
    if (fields.rawData !== undefined) {
2!
236
      this.rawData = fields.rawData;
×
237
    }
238
  }
239
}
240
export interface UpdateClassificationOnFileRequestBodyInput {
241
  /**
242
   * `replace` */
243
  readonly op?: UpdateClassificationOnFileRequestBodyOpField;
244
  /**
245
   * Defines classifications
246
   * available in the enterprise. */
247
  readonly path?: UpdateClassificationOnFileRequestBodyPathField;
248
  /**
249
   * The name of the classification to apply to this file.
250
   *
251
   * To list the available classifications in an enterprise,
252
   * use the classification API to retrieve the
253
   * [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema)
254
   * which lists all available classification keys. */
255
  readonly value: string;
256
  readonly rawData?: SerializedData;
257
}
258
export class UpdateClassificationOnFileHeaders {
144✔
259
  /**
260
   * Extra headers that will be included in the HTTP request. */
261
  readonly extraHeaders?: {
2✔
262
    readonly [key: string]: undefined | string;
263
  } = {};
264
  constructor(
265
    fields: Omit<UpdateClassificationOnFileHeaders, 'extraHeaders'> &
266
      Partial<Pick<UpdateClassificationOnFileHeaders, 'extraHeaders'>>,
267
  ) {
268
    if (fields.extraHeaders !== undefined) {
2!
269
      this.extraHeaders = fields.extraHeaders;
×
270
    }
271
  }
272
}
273
export interface UpdateClassificationOnFileHeadersInput {
274
  /**
275
   * Extra headers that will be included in the HTTP request. */
276
  readonly extraHeaders?:
277
    | undefined
278
    | {
279
        readonly [key: string]: undefined | string;
280
      };
281
}
282
export class DeleteClassificationFromFileHeaders {
144✔
283
  /**
284
   * Extra headers that will be included in the HTTP request. */
285
  readonly extraHeaders?: {
2✔
286
    readonly [key: string]: undefined | string;
287
  } = {};
288
  constructor(
289
    fields: Omit<DeleteClassificationFromFileHeaders, 'extraHeaders'> &
290
      Partial<Pick<DeleteClassificationFromFileHeaders, 'extraHeaders'>>,
291
  ) {
292
    if (fields.extraHeaders !== undefined) {
2!
293
      this.extraHeaders = fields.extraHeaders;
×
294
    }
295
  }
296
}
297
export interface DeleteClassificationFromFileHeadersInput {
298
  /**
299
   * Extra headers that will be included in the HTTP request. */
300
  readonly extraHeaders?:
301
    | undefined
302
    | {
303
        readonly [key: string]: undefined | string;
304
      };
305
}
306
export class FileClassificationsManager {
144✔
307
  readonly auth?: Authentication;
308
  readonly networkSession: NetworkSession = new NetworkSession({});
312✔
309
  constructor(
310
    fields: Omit<
311
      FileClassificationsManager,
312
      | 'networkSession'
313
      | 'getClassificationOnFile'
314
      | 'addClassificationToFile'
315
      | 'updateClassificationOnFile'
316
      | 'deleteClassificationFromFile'
317
    > &
318
      Partial<Pick<FileClassificationsManager, 'networkSession'>>,
319
  ) {
320
    if (fields.auth !== undefined) {
312✔
321
      this.auth = fields.auth;
312✔
322
    }
323
    if (fields.networkSession !== undefined) {
312✔
324
      this.networkSession = fields.networkSession;
312✔
325
    }
326
  }
327
  /**
328
     * Retrieves the classification metadata instance that
329
     * has been applied to a file.
330
     *
331
     * This API can also be called by including the enterprise ID in the
332
     * URL explicitly, for example
333
     * `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
334
     * @param {string} fileId The unique identifier that represents a file.
335
    
336
    The ID for any file can be determined
337
    by visiting a file in the web application
338
    and copying the ID from the URL. For example,
339
    for the URL `https://*.app.box.com/files/123`
340
    the `file_id` is `123`.
341
    Example: "12345"
342
     * @param {GetClassificationOnFileOptionalsInput} optionalsInput
343
     * @returns {Promise<Classification>}
344
     */
345
  async getClassificationOnFile(
346
    fileId: string,
6✔
347
    optionalsInput: GetClassificationOnFileOptionalsInput = {},
6✔
348
  ): Promise<Classification> {
349
    const optionals: GetClassificationOnFileOptionals =
350
      new GetClassificationOnFileOptionals({
6✔
351
        headers: optionalsInput.headers,
352
        cancellationToken: optionalsInput.cancellationToken,
353
      });
354
    const headers: any = optionals.headers;
6✔
355
    const cancellationToken: any = optionals.cancellationToken;
6✔
356
    const headersMap: {
357
      readonly [key: string]: string;
358
    } = prepareParams({ ...{}, ...headers.extraHeaders });
6✔
359
    const response: FetchResponse =
360
      await this.networkSession.networkClient.fetch(
6✔
361
        new FetchOptions({
362
          url: ''.concat(
363
            this.networkSession.baseUrls.baseUrl,
364
            '/2.0/files/',
365
            toString(fileId) as string,
366
            '/metadata/enterprise/securityClassification-6VMVochwUWo',
367
          ) as string,
368
          method: 'GET',
369
          headers: headersMap,
370
          responseFormat: 'json' as ResponseFormat,
371
          auth: this.auth,
372
          networkSession: this.networkSession,
373
          cancellationToken: cancellationToken,
374
        }),
375
      );
376
    return {
2✔
377
      ...deserializeClassification(response.data!),
378
      rawData: response.data!,
379
    };
380
  }
381
  /**
382
     * Adds a classification to a file by specifying the label of the
383
     * classification to add.
384
     *
385
     * This API can also be called by including the enterprise ID in the
386
     * URL explicitly, for example
387
     * `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
388
     * @param {string} fileId The unique identifier that represents a file.
389
    
390
    The ID for any file can be determined
391
    by visiting a file in the web application
392
    and copying the ID from the URL. For example,
393
    for the URL `https://*.app.box.com/files/123`
394
    the `file_id` is `123`.
395
    Example: "12345"
396
     * @param {AddClassificationToFileOptionalsInput} optionalsInput
397
     * @returns {Promise<Classification>}
398
     */
399
  async addClassificationToFile(
400
    fileId: string,
2✔
401
    optionalsInput: AddClassificationToFileOptionalsInput = {},
×
402
  ): Promise<Classification> {
403
    const optionals: AddClassificationToFileOptionals =
404
      new AddClassificationToFileOptionals({
2✔
405
        requestBody: optionalsInput.requestBody,
406
        headers: optionalsInput.headers,
407
        cancellationToken: optionalsInput.cancellationToken,
408
      });
409
    const requestBody: any = optionals.requestBody;
2✔
410
    const headers: any = optionals.headers;
2✔
411
    const cancellationToken: any = optionals.cancellationToken;
2✔
412
    const headersMap: {
413
      readonly [key: string]: string;
414
    } = prepareParams({ ...{}, ...headers.extraHeaders });
2✔
415
    const response: FetchResponse =
416
      await this.networkSession.networkClient.fetch(
2✔
417
        new FetchOptions({
418
          url: ''.concat(
419
            this.networkSession.baseUrls.baseUrl,
420
            '/2.0/files/',
421
            toString(fileId) as string,
422
            '/metadata/enterprise/securityClassification-6VMVochwUWo',
423
          ) as string,
424
          method: 'POST',
425
          headers: headersMap,
426
          data: serializeAddClassificationToFileRequestBody(requestBody),
427
          contentType: 'application/json',
428
          responseFormat: 'json' as ResponseFormat,
429
          auth: this.auth,
430
          networkSession: this.networkSession,
431
          cancellationToken: cancellationToken,
432
        }),
433
      );
434
    return {
2✔
435
      ...deserializeClassification(response.data!),
436
      rawData: response.data!,
437
    };
438
  }
439
  /**
440
     * Updates a classification on a file.
441
     *
442
     * The classification can only be updated if a classification has already been
443
     * applied to the file before. When editing classifications, only values are
444
     * defined for the enterprise will be accepted.
445
     * @param {string} fileId The unique identifier that represents a file.
446
    
447
    The ID for any file can be determined
448
    by visiting a file in the web application
449
    and copying the ID from the URL. For example,
450
    for the URL `https://*.app.box.com/files/123`
451
    the `file_id` is `123`.
452
    Example: "12345"
453
     * @param {readonly UpdateClassificationOnFileRequestBody[]} requestBody Request body of updateClassificationOnFile method
454
     * @param {UpdateClassificationOnFileOptionalsInput} optionalsInput
455
     * @returns {Promise<Classification>}
456
     */
457
  async updateClassificationOnFile(
458
    fileId: string,
2✔
459
    requestBody: readonly UpdateClassificationOnFileRequestBody[],
460
    optionalsInput: UpdateClassificationOnFileOptionalsInput = {},
2✔
461
  ): Promise<Classification> {
462
    const optionals: UpdateClassificationOnFileOptionals =
463
      new UpdateClassificationOnFileOptionals({
2✔
464
        headers: optionalsInput.headers,
465
        cancellationToken: optionalsInput.cancellationToken,
466
      });
467
    const headers: any = optionals.headers;
2✔
468
    const cancellationToken: any = optionals.cancellationToken;
2✔
469
    const headersMap: {
470
      readonly [key: string]: string;
471
    } = prepareParams({ ...{}, ...headers.extraHeaders });
2✔
472
    const response: FetchResponse =
473
      await this.networkSession.networkClient.fetch(
2✔
474
        new FetchOptions({
475
          url: ''.concat(
476
            this.networkSession.baseUrls.baseUrl,
477
            '/2.0/files/',
478
            toString(fileId) as string,
479
            '/metadata/enterprise/securityClassification-6VMVochwUWo',
480
          ) as string,
481
          method: 'PUT',
482
          headers: headersMap,
483
          data: requestBody.map(
484
            serializeUpdateClassificationOnFileRequestBody,
485
          ) as readonly any[],
486
          contentType: 'application/json-patch+json',
487
          responseFormat: 'json' as ResponseFormat,
488
          auth: this.auth,
489
          networkSession: this.networkSession,
490
          cancellationToken: cancellationToken,
491
        }),
492
      );
493
    return {
2✔
494
      ...deserializeClassification(response.data!),
495
      rawData: response.data!,
496
    };
497
  }
498
  /**
499
     * Removes any classifications from a file.
500
     *
501
     * This API can also be called by including the enterprise ID in the
502
     * URL explicitly, for example
503
     * `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
504
     * @param {string} fileId The unique identifier that represents a file.
505
    
506
    The ID for any file can be determined
507
    by visiting a file in the web application
508
    and copying the ID from the URL. For example,
509
    for the URL `https://*.app.box.com/files/123`
510
    the `file_id` is `123`.
511
    Example: "12345"
512
     * @param {DeleteClassificationFromFileOptionalsInput} optionalsInput
513
     * @returns {Promise<undefined>}
514
     */
515
  async deleteClassificationFromFile(
516
    fileId: string,
2✔
517
    optionalsInput: DeleteClassificationFromFileOptionalsInput = {},
2✔
518
  ): Promise<undefined> {
519
    const optionals: DeleteClassificationFromFileOptionals =
520
      new DeleteClassificationFromFileOptionals({
2✔
521
        headers: optionalsInput.headers,
522
        cancellationToken: optionalsInput.cancellationToken,
523
      });
524
    const headers: any = optionals.headers;
2✔
525
    const cancellationToken: any = optionals.cancellationToken;
2✔
526
    const headersMap: {
527
      readonly [key: string]: string;
528
    } = prepareParams({ ...{}, ...headers.extraHeaders });
2✔
529
    const response: FetchResponse =
530
      await this.networkSession.networkClient.fetch(
2✔
531
        new FetchOptions({
532
          url: ''.concat(
533
            this.networkSession.baseUrls.baseUrl,
534
            '/2.0/files/',
535
            toString(fileId) as string,
536
            '/metadata/enterprise/securityClassification-6VMVochwUWo',
537
          ) as string,
538
          method: 'DELETE',
539
          headers: headersMap,
540
          responseFormat: 'no_content' as ResponseFormat,
541
          auth: this.auth,
542
          networkSession: this.networkSession,
543
          cancellationToken: cancellationToken,
544
        }),
545
      );
546
    return void 0;
2✔
547
  }
548
}
549
export interface FileClassificationsManagerInput {
550
  readonly auth?: Authentication;
551
  readonly networkSession?: NetworkSession;
552
}
553
export function serializeAddClassificationToFileRequestBody(
144✔
554
  val: AddClassificationToFileRequestBody,
555
): SerializedData {
556
  return {
2✔
557
    ['Box__Security__Classification__Key']: val.boxSecurityClassificationKey,
558
  };
559
}
560
export function deserializeAddClassificationToFileRequestBody(
144✔
561
  val: SerializedData,
562
): AddClassificationToFileRequestBody {
563
  if (!sdIsMap(val)) {
×
564
    throw new BoxSdkError({
×
565
      message: 'Expecting a map for "AddClassificationToFileRequestBody"',
566
    });
567
  }
568
  if (
×
569
    !(val.Box__Security__Classification__Key == void 0) &&
×
570
    !sdIsString(val.Box__Security__Classification__Key)
571
  ) {
572
    throw new BoxSdkError({
×
573
      message:
574
        'Expecting string for "Box__Security__Classification__Key" of type "AddClassificationToFileRequestBody"',
575
    });
576
  }
577
  const boxSecurityClassificationKey: undefined | string =
578
    val.Box__Security__Classification__Key == void 0
×
579
      ? void 0
580
      : val.Box__Security__Classification__Key;
581
  return {
×
582
    boxSecurityClassificationKey: boxSecurityClassificationKey,
583
  } satisfies AddClassificationToFileRequestBody;
584
}
585
export function serializeUpdateClassificationOnFileRequestBodyOpField(
144✔
586
  val: UpdateClassificationOnFileRequestBodyOpField,
587
): SerializedData {
588
  return val;
2✔
589
}
590
export function deserializeUpdateClassificationOnFileRequestBodyOpField(
144✔
591
  val: SerializedData,
592
): UpdateClassificationOnFileRequestBodyOpField {
593
  if (val == 'replace') {
×
594
    return val;
×
595
  }
NEW
596
  if (sdIsString(val)) {
×
NEW
597
    return val;
×
598
  }
599
  throw new BoxSdkError({
×
600
    message: "Can't deserialize UpdateClassificationOnFileRequestBodyOpField",
601
  });
602
}
603
export function serializeUpdateClassificationOnFileRequestBodyPathField(
144✔
604
  val: UpdateClassificationOnFileRequestBodyPathField,
605
): SerializedData {
606
  return val;
2✔
607
}
608
export function deserializeUpdateClassificationOnFileRequestBodyPathField(
144✔
609
  val: SerializedData,
610
): UpdateClassificationOnFileRequestBodyPathField {
611
  if (val == '/Box__Security__Classification__Key') {
×
612
    return val;
×
613
  }
NEW
614
  if (sdIsString(val)) {
×
NEW
615
    return val;
×
616
  }
617
  throw new BoxSdkError({
×
618
    message: "Can't deserialize UpdateClassificationOnFileRequestBodyPathField",
619
  });
620
}
621
export function serializeUpdateClassificationOnFileRequestBody(
144✔
622
  val: UpdateClassificationOnFileRequestBody,
623
): SerializedData {
624
  return {
2✔
625
    ['op']: serializeUpdateClassificationOnFileRequestBodyOpField(val.op),
626
    ['path']: serializeUpdateClassificationOnFileRequestBodyPathField(val.path),
627
    ['value']: val.value,
628
  };
629
}
630
export function deserializeUpdateClassificationOnFileRequestBody(
144✔
631
  val: SerializedData,
632
): UpdateClassificationOnFileRequestBody {
633
  if (!sdIsMap(val)) {
×
634
    throw new BoxSdkError({
×
635
      message: 'Expecting a map for "UpdateClassificationOnFileRequestBody"',
636
    });
637
  }
638
  if (val.op == void 0) {
×
639
    throw new BoxSdkError({
×
640
      message:
641
        'Expecting "op" of type "UpdateClassificationOnFileRequestBody" to be defined',
642
    });
643
  }
644
  const op: UpdateClassificationOnFileRequestBodyOpField =
645
    deserializeUpdateClassificationOnFileRequestBodyOpField(val.op);
×
646
  if (val.path == void 0) {
×
647
    throw new BoxSdkError({
×
648
      message:
649
        'Expecting "path" of type "UpdateClassificationOnFileRequestBody" to be defined',
650
    });
651
  }
652
  const path: UpdateClassificationOnFileRequestBodyPathField =
653
    deserializeUpdateClassificationOnFileRequestBodyPathField(val.path);
×
654
  if (val.value == void 0) {
×
655
    throw new BoxSdkError({
×
656
      message:
657
        'Expecting "value" of type "UpdateClassificationOnFileRequestBody" to be defined',
658
    });
659
  }
660
  if (!sdIsString(val.value)) {
×
661
    throw new BoxSdkError({
×
662
      message:
663
        'Expecting string for "value" of type "UpdateClassificationOnFileRequestBody"',
664
    });
665
  }
666
  const value: string = val.value;
×
667
  return {
×
668
    op: op,
669
    path: path,
670
    value: value,
671
  } satisfies UpdateClassificationOnFileRequestBody;
672
}
673
export function serializeUpdateClassificationOnFileRequestBodyInput(
144✔
674
  val: UpdateClassificationOnFileRequestBodyInput,
675
): SerializedData {
676
  return {
×
677
    ['op']:
678
      val.op == void 0
×
679
        ? val.op
680
        : serializeUpdateClassificationOnFileRequestBodyOpField(val.op),
681
    ['path']:
682
      val.path == void 0
×
683
        ? val.path
684
        : serializeUpdateClassificationOnFileRequestBodyPathField(val.path),
685
    ['value']: val.value,
686
  };
687
}
688
export function deserializeUpdateClassificationOnFileRequestBodyInput(
144✔
689
  val: SerializedData,
690
): UpdateClassificationOnFileRequestBodyInput {
691
  if (!sdIsMap(val)) {
×
692
    throw new BoxSdkError({
×
693
      message:
694
        'Expecting a map for "UpdateClassificationOnFileRequestBodyInput"',
695
    });
696
  }
697
  const op: undefined | UpdateClassificationOnFileRequestBodyOpField =
698
    val.op == void 0
×
699
      ? void 0
700
      : deserializeUpdateClassificationOnFileRequestBodyOpField(val.op);
701
  const path: undefined | UpdateClassificationOnFileRequestBodyPathField =
702
    val.path == void 0
×
703
      ? void 0
704
      : deserializeUpdateClassificationOnFileRequestBodyPathField(val.path);
705
  if (val.value == void 0) {
×
706
    throw new BoxSdkError({
×
707
      message:
708
        'Expecting "value" of type "UpdateClassificationOnFileRequestBodyInput" to be defined',
709
    });
710
  }
711
  if (!sdIsString(val.value)) {
×
712
    throw new BoxSdkError({
×
713
      message:
714
        'Expecting string for "value" of type "UpdateClassificationOnFileRequestBodyInput"',
715
    });
716
  }
717
  const value: string = val.value;
×
718
  return {
×
719
    op: op,
720
    path: path,
721
    value: value,
722
  } satisfies UpdateClassificationOnFileRequestBodyInput;
723
}
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