Skip to content

Commit

Permalink
feat: Assign default value to fields and args of type enum with only …
Browse files Browse the repository at this point in the history
…one value (box/box-codegen#465)
  • Loading branch information
box-sdk-build committed Mar 29, 2024
1 parent 2f26fac commit 9e8d00d
Show file tree
Hide file tree
Showing 33 changed files with 571 additions and 566 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "fd9728e", "specHash": "1698c95", "version": "0.6.3" }
{ "engineHash": "7b699f4", "specHash": "1698c95", "version": "0.6.3" }
6 changes: 3 additions & 3 deletions box_sdk_gen/managers/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,23 +336,23 @@ def request_access_token(

def refresh_access_token(
self,
grant_type: RefreshAccessTokenGrantType,
client_id: str,
client_secret: str,
refresh_token: str,
*,
grant_type: RefreshAccessTokenGrantType = RefreshAccessTokenGrantType.REFRESH_TOKEN.value,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> AccessToken:
"""
Refresh an Access Token using its client ID, secret, and refresh token.
:param grant_type: The type of request being made, in this case a refresh request.
:type grant_type: RefreshAccessTokenGrantType
:param client_id: The client ID of the application requesting to refresh the token.
:type client_id: str
:param client_secret: The client secret of the application requesting to refresh the token.
:type client_secret: str
:param refresh_token: The refresh token to refresh.
:type refresh_token: str
:param grant_type: The type of request being made, in this case a refresh request., defaults to RefreshAccessTokenGrantType.REFRESH_TOKEN.value
:type grant_type: RefreshAccessTokenGrantType, optional
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
"""
Expand Down
88 changes: 45 additions & 43 deletions box_sdk_gen/managers/classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,25 +148,26 @@ class AddClassificationRequestBody(BaseObject):

def __init__(
self,
op: AddClassificationRequestBodyOpField,
field_key: AddClassificationRequestBodyFieldKeyField,
data: AddClassificationRequestBodyDataField,
*,
op: AddClassificationRequestBodyOpField = AddClassificationRequestBodyOpField.ADDENUMOPTION.value,
field_key: AddClassificationRequestBodyFieldKeyField = AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value,
**kwargs
):
"""
:param op: The type of change to perform on the classification
object.
:type op: AddClassificationRequestBodyOpField
:param field_key: Defines classifications
available in the enterprise.
:type field_key: AddClassificationRequestBodyFieldKeyField
:param data: The details of the classification to add.
:type data: AddClassificationRequestBodyDataField
:param op: The type of change to perform on the classification
object., defaults to AddClassificationRequestBodyOpField.ADDENUMOPTION.value
:type op: AddClassificationRequestBodyOpField, optional
:param field_key: Defines classifications
available in the enterprise., defaults to AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value
:type field_key: AddClassificationRequestBodyFieldKeyField, optional
"""
super().__init__(**kwargs)
self.data = data
self.op = op
self.field_key = field_key
self.data = data


class UpdateClassificationRequestBodyOpField(str, Enum):
Expand Down Expand Up @@ -283,29 +284,30 @@ class UpdateClassificationRequestBody(BaseObject):

def __init__(
self,
op: UpdateClassificationRequestBodyOpField,
field_key: UpdateClassificationRequestBodyFieldKeyField,
enum_option_key: str,
data: UpdateClassificationRequestBodyDataField,
*,
op: UpdateClassificationRequestBodyOpField = UpdateClassificationRequestBodyOpField.EDITENUMOPTION.value,
field_key: UpdateClassificationRequestBodyFieldKeyField = UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value,
**kwargs
):
"""
:param op: The type of change to perform on the classification
object.
:type op: UpdateClassificationRequestBodyOpField
:param field_key: Defines classifications
available in the enterprise.
:type field_key: UpdateClassificationRequestBodyFieldKeyField
:param enum_option_key: The original label of the classification to change.
:type enum_option_key: str
:param data: The details of the updated classification.
:type data: UpdateClassificationRequestBodyDataField
:param op: The type of change to perform on the classification
object., defaults to UpdateClassificationRequestBodyOpField.EDITENUMOPTION.value
:type op: UpdateClassificationRequestBodyOpField, optional
:param field_key: Defines classifications
available in the enterprise., defaults to UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value
:type field_key: UpdateClassificationRequestBodyFieldKeyField, optional
"""
super().__init__(**kwargs)
self.op = op
self.field_key = field_key
self.enum_option_key = enum_option_key
self.data = data
self.op = op
self.field_key = field_key


class CreateClassificationTemplateScope(str, Enum):
Expand Down Expand Up @@ -439,26 +441,26 @@ class CreateClassificationTemplateFields(BaseObject):

def __init__(
self,
type: CreateClassificationTemplateFieldsTypeField,
key: CreateClassificationTemplateFieldsKeyField,
display_name: CreateClassificationTemplateFieldsDisplayNameField,
options: List[CreateClassificationTemplateFieldsOptionsField],
*,
type: CreateClassificationTemplateFieldsTypeField = CreateClassificationTemplateFieldsTypeField.ENUM.value,
key: CreateClassificationTemplateFieldsKeyField = CreateClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value,
display_name: CreateClassificationTemplateFieldsDisplayNameField = CreateClassificationTemplateFieldsDisplayNameField.CLASSIFICATION.value,
hidden: Optional[bool] = None,
**kwargs
):
"""
:param type: The type of the field
that is always enum.
:type type: CreateClassificationTemplateFieldsTypeField
:param key: Defines classifications
available in the enterprise.
:type key: CreateClassificationTemplateFieldsKeyField
:param display_name: A display name for the classification.
:type display_name: CreateClassificationTemplateFieldsDisplayNameField
:param options: The actual list of classifications that are present on
this template.
:type options: List[CreateClassificationTemplateFieldsOptionsField]
:param type: The type of the field
that is always enum., defaults to CreateClassificationTemplateFieldsTypeField.ENUM.value
:type type: CreateClassificationTemplateFieldsTypeField, optional
:param key: Defines classifications
available in the enterprise., defaults to CreateClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value
:type key: CreateClassificationTemplateFieldsKeyField, optional
:param display_name: A display name for the classification., defaults to CreateClassificationTemplateFieldsDisplayNameField.CLASSIFICATION.value
:type display_name: CreateClassificationTemplateFieldsDisplayNameField, optional
:param hidden: Determines if the classification
template is
hidden or available on
Expand All @@ -467,10 +469,10 @@ def __init__(
:type hidden: Optional[bool], optional
"""
super().__init__(**kwargs)
self.options = options
self.type = type
self.key = key
self.display_name = display_name
self.options = options
self.hidden = hidden


Expand Down Expand Up @@ -622,11 +624,11 @@ def update_classification(

def create_classification_template(
self,
scope: CreateClassificationTemplateScope,
template_key: CreateClassificationTemplateTemplateKey,
display_name: CreateClassificationTemplateDisplayName,
fields: List[CreateClassificationTemplateFields],
*,
scope: CreateClassificationTemplateScope = CreateClassificationTemplateScope.ENTERPRISE.value,
template_key: CreateClassificationTemplateTemplateKey = CreateClassificationTemplateTemplateKey.SECURITYCLASSIFICATION_6VMVOCHWUWO.value,
display_name: CreateClassificationTemplateDisplayName = CreateClassificationTemplateDisplayName.CLASSIFICATION.value,
hidden: Optional[bool] = None,
copy_instance_on_item_copy: Optional[bool] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
Expand All @@ -648,19 +650,19 @@ def create_classification_template(
classifications.
:param scope: The scope in which to create the classifications. This should
be `enterprise` or `enterprise_{id}` where `id` is the unique
ID of the enterprise.
:type scope: CreateClassificationTemplateScope
:param template_key: Defines the list of metadata templates.
:type template_key: CreateClassificationTemplateTemplateKey
:param display_name: The name of the
template as shown in web and mobile interfaces.
:type display_name: CreateClassificationTemplateDisplayName
:param fields: The classification template requires exactly
one field, which holds
all the valid classification values.
:type fields: List[CreateClassificationTemplateFields]
:param scope: The scope in which to create the classifications. This should
be `enterprise` or `enterprise_{id}` where `id` is the unique
ID of the enterprise., defaults to CreateClassificationTemplateScope.ENTERPRISE.value
:type scope: CreateClassificationTemplateScope, optional
:param template_key: Defines the list of metadata templates., defaults to CreateClassificationTemplateTemplateKey.SECURITYCLASSIFICATION_6VMVOCHWUWO.value
:type template_key: CreateClassificationTemplateTemplateKey, optional
:param display_name: The name of the
template as shown in web and mobile interfaces., defaults to CreateClassificationTemplateDisplayName.CLASSIFICATION.value
:type display_name: CreateClassificationTemplateDisplayName, optional
:param hidden: Determines if the classification template is
hidden or available on web and mobile
devices., defaults to None
Expand Down
17 changes: 9 additions & 8 deletions box_sdk_gen/managers/file_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,30 @@ class UpdateClassificationOnFileRequestBodyPathField(str, Enum):
class UpdateClassificationOnFileRequestBody(BaseObject):
def __init__(
self,
op: UpdateClassificationOnFileRequestBodyOpField,
path: UpdateClassificationOnFileRequestBodyPathField,
value: str,
*,
op: UpdateClassificationOnFileRequestBodyOpField = UpdateClassificationOnFileRequestBodyOpField.REPLACE.value,
path: UpdateClassificationOnFileRequestBodyPathField = UpdateClassificationOnFileRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value,
**kwargs
):
"""
:param op: `replace`
:type op: UpdateClassificationOnFileRequestBodyOpField
:param path: Defines classifications
available in the enterprise.
:type path: UpdateClassificationOnFileRequestBodyPathField
:param value: The name of the classification to apply to this file.
To list the available classifications in an enterprise,
use the classification API to retrieve the
[classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema)
which lists all available classification keys.
:type value: str
:param op: `replace`, defaults to UpdateClassificationOnFileRequestBodyOpField.REPLACE.value
:type op: UpdateClassificationOnFileRequestBodyOpField, optional
:param path: Defines classifications
available in the enterprise., defaults to UpdateClassificationOnFileRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value
:type path: UpdateClassificationOnFileRequestBodyPathField, optional
"""
super().__init__(**kwargs)
self.value = value
self.op = op
self.path = path
self.value = value


class FileClassificationsManager:
Expand Down
11 changes: 8 additions & 3 deletions box_sdk_gen/managers/file_watermarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ class UpdateFileWatermarkWatermarkImprintField(str, Enum):


class UpdateFileWatermarkWatermark(BaseObject):
def __init__(self, imprint: UpdateFileWatermarkWatermarkImprintField, **kwargs):
def __init__(
self,
*,
imprint: UpdateFileWatermarkWatermarkImprintField = UpdateFileWatermarkWatermarkImprintField.DEFAULT.value,
**kwargs
):
"""
:param imprint: The type of watermark to apply.
Currently only supports one option.
:type imprint: UpdateFileWatermarkWatermarkImprintField
Currently only supports one option., defaults to UpdateFileWatermarkWatermarkImprintField.DEFAULT.value
:type imprint: UpdateFileWatermarkWatermarkImprintField, optional
"""
super().__init__(**kwargs)
self.imprint = imprint
Expand Down
17 changes: 9 additions & 8 deletions box_sdk_gen/managers/folder_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,30 @@ class UpdateClassificationOnFolderRequestBodyPathField(str, Enum):
class UpdateClassificationOnFolderRequestBody(BaseObject):
def __init__(
self,
op: UpdateClassificationOnFolderRequestBodyOpField,
path: UpdateClassificationOnFolderRequestBodyPathField,
value: str,
*,
op: UpdateClassificationOnFolderRequestBodyOpField = UpdateClassificationOnFolderRequestBodyOpField.REPLACE.value,
path: UpdateClassificationOnFolderRequestBodyPathField = UpdateClassificationOnFolderRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value,
**kwargs
):
"""
:param op: `replace`
:type op: UpdateClassificationOnFolderRequestBodyOpField
:param path: Defines classifications
available in the enterprise.
:type path: UpdateClassificationOnFolderRequestBodyPathField
:param value: The name of the classification to apply to this folder.
To list the available classifications in an enterprise,
use the classification API to retrieve the
[classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema)
which lists all available classification keys.
:type value: str
:param op: `replace`, defaults to UpdateClassificationOnFolderRequestBodyOpField.REPLACE.value
:type op: UpdateClassificationOnFolderRequestBodyOpField, optional
:param path: Defines classifications
available in the enterprise., defaults to UpdateClassificationOnFolderRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value
:type path: UpdateClassificationOnFolderRequestBodyPathField, optional
"""
super().__init__(**kwargs)
self.value = value
self.op = op
self.path = path
self.value = value


class FolderClassificationsManager:
Expand Down
11 changes: 8 additions & 3 deletions box_sdk_gen/managers/folder_watermarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ class UpdateFolderWatermarkWatermarkImprintField(str, Enum):


class UpdateFolderWatermarkWatermark(BaseObject):
def __init__(self, imprint: UpdateFolderWatermarkWatermarkImprintField, **kwargs):
def __init__(
self,
*,
imprint: UpdateFolderWatermarkWatermarkImprintField = UpdateFolderWatermarkWatermarkImprintField.DEFAULT.value,
**kwargs
):
"""
:param imprint: The type of watermark to apply.
Currently only supports one option.
:type imprint: UpdateFolderWatermarkWatermarkImprintField
Currently only supports one option., defaults to UpdateFolderWatermarkWatermarkImprintField.DEFAULT.value
:type imprint: UpdateFolderWatermarkWatermarkImprintField, optional
"""
super().__init__(**kwargs)
self.imprint = imprint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ def get_shield_information_barrier_segment_restrictions(

def create_shield_information_barrier_segment_restriction(
self,
type: CreateShieldInformationBarrierSegmentRestrictionType,
shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment,
restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment,
*,
type: CreateShieldInformationBarrierSegmentRestrictionType = CreateShieldInformationBarrierSegmentRestrictionType.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION.value,
shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> ShieldInformationBarrierSegmentRestriction:
Expand All @@ -267,15 +267,15 @@ def create_shield_information_barrier_segment_restriction(
segment restriction object.
:param type: The type of the shield barrier segment
restriction for this member.
:type type: CreateShieldInformationBarrierSegmentRestrictionType
:param shield_information_barrier_segment: The `type` and `id` of the requested
shield information barrier segment.
:type shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment
:param restricted_segment: The `type` and `id` of the restricted
shield information barrier segment.
:type restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment
:param type: The type of the shield barrier segment
restriction for this member., defaults to CreateShieldInformationBarrierSegmentRestrictionType.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION.value
:type type: CreateShieldInformationBarrierSegmentRestrictionType, optional
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
"""
Expand Down
Loading

0 comments on commit 9e8d00d

Please sign in to comment.