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

box / box-typescript-sdk-gen / 12547398862

30 Dec 2024 01:44PM UTC coverage: 43.462% (+0.06%) from 43.401%
12547398862

push

github

web-flow
feat: Support webhook message validation (box/box-codegen#631) (#455)

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

3928 of 15234 branches covered (25.78%)

Branch coverage included in aggregate %.

43 of 53 new or added lines in 2 files covered. (81.13%)

3697 existing lines in 76 files now uncovered.

13661 of 25236 relevant lines covered (54.13%)

83.7 hits per line

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

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