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

box / box-node-sdk / 28487081640

30 Jun 2026 12:28PM UTC coverage: 40.775% (-0.06%) from 40.831%
28487081640

push

github

web-flow
chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] (#1530)

Co-authored-by: box-sdk-build <box-sdk-build@box.com>

4956 of 21079 branches covered (23.51%)

Branch coverage included in aggregate %.

18062 of 35372 relevant lines covered (51.06%)

171.36 hits per line

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

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

© 2026 Coveralls, Inc