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

box / box-python-sdk-gen / 16367730590

18 Jul 2025 09:57AM UTC coverage: 92.564% (+0.3%) from 92.286%
16367730590

Pull #648

github

web-flow
Merge 73d202243 into 49d7f349e
Pull Request #648: test: add tests for new hub endpoints and hub items (box/box-codegen#766)

2 of 2 new or added lines in 2 files covered. (100.0%)

11 existing lines in 1 file now uncovered.

12984 of 14027 relevant lines covered (92.56%)

0.93 hits per line

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

75.0
/box_sdk_gen/managers/classifications.py
1
from enum import Enum
1✔
2

3
from typing import Optional
1✔
4

5
from typing import Dict
1✔
6

7
from box_sdk_gen.internal.base_object import BaseObject
1✔
8

9
from typing import List
1✔
10

11
from box_sdk_gen.serialization.json import deserialize
1✔
12

13
from box_sdk_gen.serialization.json import serialize
1✔
14

15
from box_sdk_gen.networking.fetch_options import ResponseFormat
1✔
16

17
from box_sdk_gen.schemas.classification_template import ClassificationTemplate
1✔
18

19
from box_sdk_gen.schemas.client_error import ClientError
1✔
20

21
from box_sdk_gen.box.errors import BoxSDKError
1✔
22

23
from box_sdk_gen.networking.auth import Authentication
1✔
24

25
from box_sdk_gen.networking.network import NetworkSession
1✔
26

27
from box_sdk_gen.networking.fetch_options import FetchOptions
1✔
28

29
from box_sdk_gen.networking.fetch_response import FetchResponse
1✔
30

31
from box_sdk_gen.internal.utils import prepare_params
1✔
32

33
from box_sdk_gen.internal.utils import to_string
1✔
34

35
from box_sdk_gen.internal.utils import ByteStream
1✔
36

37
from box_sdk_gen.serialization.json import SerializedData
1✔
38

39

40
class AddClassificationRequestBodyOpField(str, Enum):
1✔
41
    ADDENUMOPTION = 'addEnumOption'
1✔
42

43

44
class AddClassificationRequestBodyFieldKeyField(str, Enum):
1✔
45
    BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key'
1✔
46

47

48
class AddClassificationRequestBodyDataStaticConfigClassificationField(BaseObject):
1✔
49
    _fields_to_json_mapping: Dict[str, str] = {
1✔
50
        'classification_definition': 'classificationDefinition',
51
        'color_id': 'colorID',
52
        **BaseObject._fields_to_json_mapping,
53
    }
54
    _json_to_fields_mapping: Dict[str, str] = {
1✔
55
        'classificationDefinition': 'classification_definition',
56
        'colorID': 'color_id',
57
        **BaseObject._json_to_fields_mapping,
58
    }
59

60
    def __init__(
1✔
61
        self,
62
        *,
63
        classification_definition: Optional[str] = None,
64
        color_id: Optional[int] = None,
65
        **kwargs
66
    ):
67
        """
68
                :param classification_definition: A longer description of the classification., defaults to None
69
                :type classification_definition: Optional[str], optional
70
                :param color_id: An internal Box identifier used to assign a color to
71
        a classification label.
72

73
        Mapping between a `colorID` and a color may change
74
        without notice. Currently, the color mappings are as
75
        follows.
76

77
        * `0`: Yellow.
78
        * `1`: Orange.
79
        * `2`: Watermelon red.
80
        * `3`: Purple rain.
81
        * `4`: Light blue.
82
        * `5`: Dark blue.
83
        * `6`: Light green.
84
        * `7`: Gray., defaults to None
85
                :type color_id: Optional[int], optional
86
        """
87
        super().__init__(**kwargs)
×
88
        self.classification_definition = classification_definition
×
89
        self.color_id = color_id
×
90

91

92
class AddClassificationRequestBodyDataStaticConfigField(BaseObject):
1✔
93
    def __init__(
1✔
94
        self,
95
        *,
96
        classification: Optional[
97
            AddClassificationRequestBodyDataStaticConfigClassificationField
98
        ] = None,
99
        **kwargs
100
    ):
101
        """
102
        :param classification: Additional details for the classification., defaults to None
103
        :type classification: Optional[AddClassificationRequestBodyDataStaticConfigClassificationField], optional
104
        """
105
        super().__init__(**kwargs)
×
106
        self.classification = classification
×
107

108

109
class AddClassificationRequestBodyDataField(BaseObject):
1✔
110
    _fields_to_json_mapping: Dict[str, str] = {
1✔
111
        'static_config': 'staticConfig',
112
        **BaseObject._fields_to_json_mapping,
113
    }
114
    _json_to_fields_mapping: Dict[str, str] = {
1✔
115
        'staticConfig': 'static_config',
116
        **BaseObject._json_to_fields_mapping,
117
    }
118

119
    def __init__(
1✔
120
        self,
121
        key: str,
122
        *,
123
        static_config: Optional[
124
            AddClassificationRequestBodyDataStaticConfigField
125
        ] = None,
126
        **kwargs
127
    ):
128
        """
129
                :param key: The label of the classification as shown in the web and
130
        mobile interfaces. This is the only field required to
131
        add a classification.
132
                :type key: str
133
                :param static_config: A static configuration for the classification., defaults to None
134
                :type static_config: Optional[AddClassificationRequestBodyDataStaticConfigField], optional
135
        """
136
        super().__init__(**kwargs)
×
137
        self.key = key
×
138
        self.static_config = static_config
×
139

140

141
class AddClassificationRequestBody(BaseObject):
1✔
142
    _fields_to_json_mapping: Dict[str, str] = {
1✔
143
        'field_key': 'fieldKey',
144
        **BaseObject._fields_to_json_mapping,
145
    }
146
    _json_to_fields_mapping: Dict[str, str] = {
1✔
147
        'fieldKey': 'field_key',
148
        **BaseObject._json_to_fields_mapping,
149
    }
150

151
    def __init__(
1✔
152
        self,
153
        data: AddClassificationRequestBodyDataField,
154
        *,
155
        op: AddClassificationRequestBodyOpField = AddClassificationRequestBodyOpField.ADDENUMOPTION,
156
        field_key: AddClassificationRequestBodyFieldKeyField = AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY,
157
        **kwargs
158
    ):
159
        """
160
                :param data: The details of the classification to add.
161
                :type data: AddClassificationRequestBodyDataField
162
                :param op: The type of change to perform on the classification
163
        object., defaults to AddClassificationRequestBodyOpField.ADDENUMOPTION
164
                :type op: AddClassificationRequestBodyOpField, optional
165
                :param field_key: Defines classifications
166
        available in the enterprise., defaults to AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY
167
                :type field_key: AddClassificationRequestBodyFieldKeyField, optional
168
        """
169
        super().__init__(**kwargs)
×
170
        self.data = data
×
171
        self.op = op
×
172
        self.field_key = field_key
×
173

174

175
class UpdateClassificationRequestBodyOpField(str, Enum):
1✔
176
    EDITENUMOPTION = 'editEnumOption'
1✔
177

178

179
class UpdateClassificationRequestBodyFieldKeyField(str, Enum):
1✔
180
    BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key'
1✔
181

182

183
class UpdateClassificationRequestBodyDataStaticConfigClassificationField(BaseObject):
1✔
184
    _fields_to_json_mapping: Dict[str, str] = {
1✔
185
        'classification_definition': 'classificationDefinition',
186
        'color_id': 'colorID',
187
        **BaseObject._fields_to_json_mapping,
188
    }
189
    _json_to_fields_mapping: Dict[str, str] = {
1✔
190
        'classificationDefinition': 'classification_definition',
191
        'colorID': 'color_id',
192
        **BaseObject._json_to_fields_mapping,
193
    }
194

195
    def __init__(
1✔
196
        self,
197
        *,
198
        classification_definition: Optional[str] = None,
199
        color_id: Optional[int] = None,
200
        **kwargs
201
    ):
202
        """
203
                :param classification_definition: A longer description of the classification., defaults to None
204
                :type classification_definition: Optional[str], optional
205
                :param color_id: An internal Box identifier used to assign a color to
206
        a classification label.
207

208
        Mapping between a `colorID` and a color may change
209
        without notice. Currently, the color mappings are as
210
        follows.
211

212
        * `0`: Yellow.
213
        * `1`: Orange.
214
        * `2`: Watermelon red.
215
        * `3`: Purple rain.
216
        * `4`: Light blue.
217
        * `5`: Dark blue.
218
        * `6`: Light green.
219
        * `7`: Gray., defaults to None
220
                :type color_id: Optional[int], optional
221
        """
222
        super().__init__(**kwargs)
1✔
223
        self.classification_definition = classification_definition
1✔
224
        self.color_id = color_id
1✔
225

226

227
class UpdateClassificationRequestBodyDataStaticConfigField(BaseObject):
1✔
228
    def __init__(
1✔
229
        self,
230
        *,
231
        classification: Optional[
232
            UpdateClassificationRequestBodyDataStaticConfigClassificationField
233
        ] = None,
234
        **kwargs
235
    ):
236
        """
237
        :param classification: Additional details for the classification., defaults to None
238
        :type classification: Optional[UpdateClassificationRequestBodyDataStaticConfigClassificationField], optional
239
        """
240
        super().__init__(**kwargs)
1✔
241
        self.classification = classification
1✔
242

243

244
class UpdateClassificationRequestBodyDataField(BaseObject):
1✔
245
    _fields_to_json_mapping: Dict[str, str] = {
1✔
246
        'static_config': 'staticConfig',
247
        **BaseObject._fields_to_json_mapping,
248
    }
249
    _json_to_fields_mapping: Dict[str, str] = {
1✔
250
        'staticConfig': 'static_config',
251
        **BaseObject._json_to_fields_mapping,
252
    }
253

254
    def __init__(
1✔
255
        self,
256
        key: str,
257
        *,
258
        static_config: Optional[
259
            UpdateClassificationRequestBodyDataStaticConfigField
260
        ] = None,
261
        **kwargs
262
    ):
263
        """
264
                :param key: A new label for the classification, as it will be
265
        shown in the web and mobile interfaces.
266
                :type key: str
267
                :param static_config: A static configuration for the classification., defaults to None
268
                :type static_config: Optional[UpdateClassificationRequestBodyDataStaticConfigField], optional
269
        """
270
        super().__init__(**kwargs)
1✔
271
        self.key = key
1✔
272
        self.static_config = static_config
1✔
273

274

275
class UpdateClassificationRequestBody(BaseObject):
1✔
276
    _fields_to_json_mapping: Dict[str, str] = {
1✔
277
        'field_key': 'fieldKey',
278
        'enum_option_key': 'enumOptionKey',
279
        **BaseObject._fields_to_json_mapping,
280
    }
281
    _json_to_fields_mapping: Dict[str, str] = {
1✔
282
        'fieldKey': 'field_key',
283
        'enumOptionKey': 'enum_option_key',
284
        **BaseObject._json_to_fields_mapping,
285
    }
286

287
    def __init__(
1✔
288
        self,
289
        enum_option_key: str,
290
        data: UpdateClassificationRequestBodyDataField,
291
        *,
292
        op: UpdateClassificationRequestBodyOpField = UpdateClassificationRequestBodyOpField.EDITENUMOPTION,
293
        field_key: UpdateClassificationRequestBodyFieldKeyField = UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY,
294
        **kwargs
295
    ):
296
        """
297
                :param enum_option_key: The original label of the classification to change.
298
                :type enum_option_key: str
299
                :param data: The details of the updated classification.
300
                :type data: UpdateClassificationRequestBodyDataField
301
                :param op: The type of change to perform on the classification
302
        object., defaults to UpdateClassificationRequestBodyOpField.EDITENUMOPTION
303
                :type op: UpdateClassificationRequestBodyOpField, optional
304
                :param field_key: Defines classifications
305
        available in the enterprise., defaults to UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY
306
                :type field_key: UpdateClassificationRequestBodyFieldKeyField, optional
307
        """
308
        super().__init__(**kwargs)
1✔
309
        self.enum_option_key = enum_option_key
1✔
310
        self.data = data
1✔
311
        self.op = op
1✔
312
        self.field_key = field_key
1✔
313

314

315
class CreateClassificationTemplateScope(str, Enum):
1✔
316
    ENTERPRISE = 'enterprise'
1✔
317

318

319
class CreateClassificationTemplateTemplateKey(str, Enum):
1✔
320
    SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo'
1✔
321

322

323
class CreateClassificationTemplateDisplayName(str, Enum):
1✔
324
    CLASSIFICATION = 'Classification'
1✔
325

326

327
class CreateClassificationTemplateFieldsTypeField(str, Enum):
1✔
328
    ENUM = 'enum'
1✔
329

330

331
class CreateClassificationTemplateFieldsKeyField(str, Enum):
1✔
332
    BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key'
1✔
333

334

335
class CreateClassificationTemplateFieldsDisplayNameField(str, Enum):
1✔
336
    CLASSIFICATION = 'Classification'
1✔
337

338

339
class CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField(
1✔
340
    BaseObject
341
):
342
    _fields_to_json_mapping: Dict[str, str] = {
1✔
343
        'classification_definition': 'classificationDefinition',
344
        'color_id': 'colorID',
345
        **BaseObject._fields_to_json_mapping,
346
    }
347
    _json_to_fields_mapping: Dict[str, str] = {
1✔
348
        'classificationDefinition': 'classification_definition',
349
        'colorID': 'color_id',
350
        **BaseObject._json_to_fields_mapping,
351
    }
352

353
    def __init__(
1✔
354
        self,
355
        *,
356
        classification_definition: Optional[str] = None,
357
        color_id: Optional[int] = None,
358
        **kwargs
359
    ):
360
        """
361
                :param classification_definition: A longer description of the classification., defaults to None
362
                :type classification_definition: Optional[str], optional
363
                :param color_id: An identifier used to assign a color to
364
        a classification label.
365

366
        Mapping between a `colorID` and a color may
367
        change without notice. Currently, the color
368
        mappings are as follows.
369

370
        * `0`: Yellow.
371
        * `1`: Orange.
372
        * `2`: Watermelon red.
373
        * `3`: Purple rain.
374
        * `4`: Light blue.
375
        * `5`: Dark blue.
376
        * `6`: Light green.
377
        * `7`: Gray., defaults to None
378
                :type color_id: Optional[int], optional
379
        """
380
        super().__init__(**kwargs)
×
381
        self.classification_definition = classification_definition
×
382
        self.color_id = color_id
×
383

384

385
class CreateClassificationTemplateFieldsOptionsStaticConfigField(BaseObject):
1✔
386
    def __init__(
1✔
387
        self,
388
        *,
389
        classification: Optional[
390
            CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField
391
        ] = None,
392
        **kwargs
393
    ):
394
        """
395
        :param classification: Additional information about the classification., defaults to None
396
        :type classification: Optional[CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField], optional
397
        """
398
        super().__init__(**kwargs)
×
399
        self.classification = classification
×
400

401

402
class CreateClassificationTemplateFieldsOptionsField(BaseObject):
1✔
403
    _fields_to_json_mapping: Dict[str, str] = {
1✔
404
        'static_config': 'staticConfig',
405
        **BaseObject._fields_to_json_mapping,
406
    }
407
    _json_to_fields_mapping: Dict[str, str] = {
1✔
408
        'staticConfig': 'static_config',
409
        **BaseObject._json_to_fields_mapping,
410
    }
411

412
    def __init__(
1✔
413
        self,
414
        key: str,
415
        *,
416
        static_config: Optional[
417
            CreateClassificationTemplateFieldsOptionsStaticConfigField
418
        ] = None,
419
        **kwargs
420
    ):
421
        """
422
                :param key: The display name and key this classification. This
423
        will be show in the Box UI.
424
                :type key: str
425
                :param static_config: Additional information about the classification., defaults to None
426
                :type static_config: Optional[CreateClassificationTemplateFieldsOptionsStaticConfigField], optional
427
        """
428
        super().__init__(**kwargs)
×
429
        self.key = key
×
430
        self.static_config = static_config
×
431

432

433
class CreateClassificationTemplateFields(BaseObject):
1✔
434
    _fields_to_json_mapping: Dict[str, str] = {
1✔
435
        'display_name': 'displayName',
436
        **BaseObject._fields_to_json_mapping,
437
    }
438
    _json_to_fields_mapping: Dict[str, str] = {
1✔
439
        'displayName': 'display_name',
440
        **BaseObject._json_to_fields_mapping,
441
    }
442
    _discriminator = 'type', {'enum'}
1✔
443

444
    def __init__(
1✔
445
        self,
446
        options: List[CreateClassificationTemplateFieldsOptionsField],
447
        *,
448
        type: CreateClassificationTemplateFieldsTypeField = CreateClassificationTemplateFieldsTypeField.ENUM,
449
        key: CreateClassificationTemplateFieldsKeyField = CreateClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY,
450
        display_name: CreateClassificationTemplateFieldsDisplayNameField = CreateClassificationTemplateFieldsDisplayNameField.CLASSIFICATION,
451
        hidden: Optional[bool] = None,
452
        **kwargs
453
    ):
454
        """
455
                :param options: The actual list of classifications that are present on
456
        this template.
457
                :type options: List[CreateClassificationTemplateFieldsOptionsField]
458
                :param type: The type of the field
459
        that is always enum., defaults to CreateClassificationTemplateFieldsTypeField.ENUM
460
                :type type: CreateClassificationTemplateFieldsTypeField, optional
461
                :param key: Defines classifications
462
        available in the enterprise., defaults to CreateClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY
463
                :type key: CreateClassificationTemplateFieldsKeyField, optional
464
                :param display_name: A display name for the classification., defaults to CreateClassificationTemplateFieldsDisplayNameField.CLASSIFICATION
465
                :type display_name: CreateClassificationTemplateFieldsDisplayNameField, optional
466
                :param hidden: Determines if the classification
467
        template is
468
        hidden or available on
469
        web and mobile
470
        devices., defaults to None
471
                :type hidden: Optional[bool], optional
472
        """
UNCOV
473
        super().__init__(**kwargs)
×
UNCOV
474
        self.options = options
×
UNCOV
475
        self.type = type
×
UNCOV
476
        self.key = key
×
UNCOV
477
        self.display_name = display_name
×
UNCOV
478
        self.hidden = hidden
×
479

480

481
class ClassificationsManager:
1✔
482
    def __init__(
1✔
483
        self,
484
        *,
485
        auth: Optional[Authentication] = None,
486
        network_session: NetworkSession = None
487
    ):
488
        if network_session is None:
1✔
489
            network_session = NetworkSession()
×
490
        self.auth = auth
1✔
491
        self.network_session = network_session
1✔
492

493
    def get_classification_template(
1✔
494
        self, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
495
    ) -> ClassificationTemplate:
496
        """
497
        Retrieves the classification metadata template and lists all the
498

499
        classifications available to this enterprise.
500

501

502
        This API can also be called by including the enterprise ID in the
503

504

505
        URL explicitly, for example
506

507

508
        `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
509

510
        :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
511
        :type extra_headers: Optional[Dict[str, Optional[str]]], optional
512
        """
513
        if extra_headers is None:
1✔
514
            extra_headers = {}
1✔
515
        headers_map: Dict[str, str] = prepare_params({**extra_headers})
1✔
516
        response: FetchResponse = self.network_session.network_client.fetch(
1✔
517
            FetchOptions(
518
                url=''.join(
519
                    [
520
                        self.network_session.base_urls.base_url,
521
                        '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema',
522
                    ]
523
                ),
524
                method='GET',
525
                headers=headers_map,
526
                response_format=ResponseFormat.JSON,
527
                auth=self.auth,
528
                network_session=self.network_session,
529
            )
530
        )
531
        return deserialize(response.data, ClassificationTemplate)
1✔
532

533
    def add_classification(
1✔
534
        self,
535
        request_body: List[AddClassificationRequestBody],
536
        *,
537
        extra_headers: Optional[Dict[str, Optional[str]]] = None
538
    ) -> ClassificationTemplate:
539
        """
540
        Adds one or more new classifications to the list of classifications
541

542
        available to the enterprise.
543

544

545
        This API can also be called by including the enterprise ID in the
546

547

548
        URL explicitly, for example
549

550

551
        `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
552

553
        :param request_body: Request body of addClassification method
554
        :type request_body: List[AddClassificationRequestBody]
555
        :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
556
        :type extra_headers: Optional[Dict[str, Optional[str]]], optional
557
        """
558
        if extra_headers is None:
×
559
            extra_headers = {}
×
560
        headers_map: Dict[str, str] = prepare_params({**extra_headers})
×
561
        response: FetchResponse = self.network_session.network_client.fetch(
×
562
            FetchOptions(
563
                url=''.join(
564
                    [
565
                        self.network_session.base_urls.base_url,
566
                        '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#add',
567
                    ]
568
                ),
569
                method='PUT',
570
                headers=headers_map,
571
                data=serialize(request_body),
572
                content_type='application/json',
573
                response_format=ResponseFormat.JSON,
574
                auth=self.auth,
575
                network_session=self.network_session,
576
            )
577
        )
578
        return deserialize(response.data, ClassificationTemplate)
×
579

580
    def update_classification(
1✔
581
        self,
582
        request_body: List[UpdateClassificationRequestBody],
583
        *,
584
        extra_headers: Optional[Dict[str, Optional[str]]] = None
585
    ) -> ClassificationTemplate:
586
        """
587
        Updates the labels and descriptions of one or more classifications
588

589
        available to the enterprise.
590

591

592
        This API can also be called by including the enterprise ID in the
593

594

595
        URL explicitly, for example
596

597

598
        `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
599

600
        :param request_body: Request body of updateClassification method
601
        :type request_body: List[UpdateClassificationRequestBody]
602
        :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
603
        :type extra_headers: Optional[Dict[str, Optional[str]]], optional
604
        """
605
        if extra_headers is None:
1✔
606
            extra_headers = {}
1✔
607
        headers_map: Dict[str, str] = prepare_params({**extra_headers})
1✔
608
        response: FetchResponse = self.network_session.network_client.fetch(
1✔
609
            FetchOptions(
610
                url=''.join(
611
                    [
612
                        self.network_session.base_urls.base_url,
613
                        '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#update',
614
                    ]
615
                ),
616
                method='PUT',
617
                headers=headers_map,
618
                data=serialize(request_body),
619
                content_type='application/json-patch+json',
620
                response_format=ResponseFormat.JSON,
621
                auth=self.auth,
622
                network_session=self.network_session,
623
            )
624
        )
625
        return deserialize(response.data, ClassificationTemplate)
1✔
626

627
    def create_classification_template(
1✔
628
        self,
629
        fields: List[CreateClassificationTemplateFields],
630
        *,
631
        scope: CreateClassificationTemplateScope = CreateClassificationTemplateScope.ENTERPRISE,
632
        template_key: CreateClassificationTemplateTemplateKey = CreateClassificationTemplateTemplateKey.SECURITYCLASSIFICATION_6VMVOCHWUWO,
633
        display_name: CreateClassificationTemplateDisplayName = CreateClassificationTemplateDisplayName.CLASSIFICATION,
634
        hidden: Optional[bool] = None,
635
        copy_instance_on_item_copy: Optional[bool] = None,
636
        extra_headers: Optional[Dict[str, Optional[str]]] = None
637
    ) -> ClassificationTemplate:
638
        """
639
                When an enterprise does not yet have any classifications, this API call
640

641
                initializes the classification template with an initial set of
642

643

644
                classifications.
645

646

647
                If an enterprise already has a classification, the template will already
648

649

650
                exist and instead an API call should be made to add additional
651

652

653
                classifications.
654

655
                :param fields: The classification template requires exactly
656
        one field, which holds
657
        all the valid classification values.
658
                :type fields: List[CreateClassificationTemplateFields]
659
                :param scope: The scope in which to create the classifications. This should
660
        be `enterprise` or `enterprise_{id}` where `id` is the unique
661
        ID of the enterprise., defaults to CreateClassificationTemplateScope.ENTERPRISE
662
                :type scope: CreateClassificationTemplateScope, optional
663
                :param template_key: Defines the list of metadata templates., defaults to CreateClassificationTemplateTemplateKey.SECURITYCLASSIFICATION_6VMVOCHWUWO
664
                :type template_key: CreateClassificationTemplateTemplateKey, optional
665
                :param display_name: The name of the
666
        template as shown in web and mobile interfaces., defaults to CreateClassificationTemplateDisplayName.CLASSIFICATION
667
                :type display_name: CreateClassificationTemplateDisplayName, optional
668
                :param hidden: Determines if the classification template is
669
        hidden or available on web and mobile
670
        devices., defaults to None
671
                :type hidden: Optional[bool], optional
672
                :param copy_instance_on_item_copy: Determines if classifications are
673
        copied along when the file or folder is
674
        copied., defaults to None
675
                :type copy_instance_on_item_copy: Optional[bool], optional
676
                :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
677
                :type extra_headers: Optional[Dict[str, Optional[str]]], optional
678
        """
UNCOV
679
        if extra_headers is None:
×
UNCOV
680
            extra_headers = {}
×
UNCOV
681
        request_body: Dict = {
×
682
            'scope': scope,
683
            'templateKey': template_key,
684
            'displayName': display_name,
685
            'hidden': hidden,
686
            'copyInstanceOnItemCopy': copy_instance_on_item_copy,
687
            'fields': fields,
688
        }
UNCOV
689
        headers_map: Dict[str, str] = prepare_params({**extra_headers})
×
UNCOV
690
        response: FetchResponse = self.network_session.network_client.fetch(
×
691
            FetchOptions(
692
                url=''.join(
693
                    [
694
                        self.network_session.base_urls.base_url,
695
                        '/2.0/metadata_templates/schema#classifications',
696
                    ]
697
                ),
698
                method='POST',
699
                headers=headers_map,
700
                data=serialize(request_body),
701
                content_type='application/json',
702
                response_format=ResponseFormat.JSON,
703
                auth=self.auth,
704
                network_session=self.network_session,
705
            )
706
        )
707
        return deserialize(response.data, ClassificationTemplate)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc