From ce0949fd751cf774325b09b4067cfa917f114bed Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Wed, 22 Apr 2026 00:49:04 -0700 Subject: [PATCH] feat: add max_extension_length attribute (box/box-openapi#593) --- .codegen.json | 2 +- box_sdk_gen/managers/ai.py | 10 +++++----- box_sdk_gen/managers/retention_policies.py | 12 ++++++++++++ box_sdk_gen/managers/users.py | 5 ++--- box_sdk_gen/schemas/__init__.py | 4 ++++ box_sdk_gen/schemas/ai_extract_structured.py | 10 +++++----- box_sdk_gen/schemas/retention_policy.py | 12 ++++++++++++ ...etention_policy_max_extension_length_request.py | 14 ++++++++++++++ ...tention_policy_max_extension_length_response.py | 14 ++++++++++++++ box_sdk_gen/schemas/retention_policy_mini.py | 12 ++++++++++++ docs/ai.md | 4 ++-- docs/retention_policies.md | 2 ++ docs/users.md | 4 ++-- test/ai.py | 2 +- 14 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 box_sdk_gen/schemas/retention_policy_max_extension_length_request.py create mode 100644 box_sdk_gen/schemas/retention_policy_max_extension_length_response.py diff --git a/.codegen.json b/.codegen.json index 795ea28e..6002d494 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "450fb53", "specHash": "f8e0d99", "version": "10.6.0" } +{ "engineHash": "450fb53", "specHash": "d0976fc", "version": "10.6.0" } diff --git a/box_sdk_gen/managers/ai.py b/box_sdk_gen/managers/ai.py index b50eb57c..6a684a47 100644 --- a/box_sdk_gen/managers/ai.py +++ b/box_sdk_gen/managers/ai.py @@ -159,7 +159,7 @@ def __init__( class CreateAiExtractStructuredFieldsOptionsField(BaseObject): def __init__(self, key: str, **kwargs): """ - :param key: A unique identifier for the field. + :param key: A unique identifier for the option. :type key: str """ super().__init__(**kwargs) @@ -196,9 +196,9 @@ def __init__( :type display_name: Optional[str], optional :param prompt: The context about the key that may include how to find and format it., defaults to None :type prompt: Optional[str], optional - :param type: The type of the field. It include but is not limited to string, float, date, enum, and multiSelect., defaults to None + :param type: The type of the field. It can include but is not limited to `string`, `float`, `date`, `enum`, and `multiSelect`., defaults to None :type type: Optional[str], optional - :param options: A list of options for this field. This is most often used in combination with the enum and multiSelect field types., defaults to None + :param options: A list of options for this field. This is most often used in combination with the `enum` and `multiSelect` field types., defaults to None :type options: Optional[List[CreateAiExtractStructuredFieldsOptionsField]], optional """ super().__init__(**kwargs) @@ -425,9 +425,9 @@ def create_ai_extract_structured( *, metadata_template: Optional[CreateAiExtractStructuredMetadataTemplate] = None, fields: Optional[List[CreateAiExtractStructuredFields]] = None, + ai_agent: Optional[AiExtractStructuredAgent] = None, include_confidence_score: Optional[bool] = None, include_reference: Optional[bool] = None, - ai_agent: Optional[AiExtractStructuredAgent] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> AiExtractStructuredResponse: """ @@ -465,9 +465,9 @@ def create_ai_extract_structured( 'items': items, 'metadata_template': metadata_template, 'fields': fields, + 'ai_agent': ai_agent, 'include_confidence_score': include_confidence_score, 'include_reference': include_reference, - 'ai_agent': ai_agent, } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = self.network_session.network_client.fetch( diff --git a/box_sdk_gen/managers/retention_policies.py b/box_sdk_gen/managers/retention_policies.py index bfd717c1..5b05c1c9 100644 --- a/box_sdk_gen/managers/retention_policies.py +++ b/box_sdk_gen/managers/retention_policies.py @@ -18,12 +18,20 @@ from box_sdk_gen.networking.fetch_options import ResponseFormat +from box_sdk_gen.schemas.retention_policy_max_extension_length_request import ( + RetentionPolicyMaxExtensionLengthRequestEnum, +) + from box_sdk_gen.schemas.retention_policies import RetentionPolicies from box_sdk_gen.schemas.client_error import ClientError from box_sdk_gen.schemas.retention_policy import RetentionPolicy +from box_sdk_gen.schemas.retention_policy_max_extension_length_request import ( + RetentionPolicyMaxExtensionLengthRequest, +) + from box_sdk_gen.schemas.user_mini import UserMini from box_sdk_gen.schemas.user_base import UserBase @@ -157,6 +165,7 @@ def create_retention_policy( retention_length: Optional[Union[str, int]] = None, retention_type: Optional[CreateRetentionPolicyRetentionType] = None, can_owner_extend_retention: Optional[bool] = None, + max_extension_length: Optional[RetentionPolicyMaxExtensionLengthRequest] = None, are_owners_notified: Optional[bool] = None, custom_notification_recipients: Optional[List[UserMini]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None @@ -225,6 +234,7 @@ def create_retention_policy( 'retention_length': retention_length, 'retention_type': retention_type, 'can_owner_extend_retention': can_owner_extend_retention, + 'max_extension_length': max_extension_length, 'are_owners_notified': are_owners_notified, 'custom_notification_recipients': custom_notification_recipients, } @@ -304,6 +314,7 @@ def update_retention_policy_by_id( retention_length: Optional[Union[str, int]] = None, status: Union[Optional[str], NullValue] = None, can_owner_extend_retention: Union[Optional[bool], NullValue] = None, + max_extension_length: Optional[RetentionPolicyMaxExtensionLengthRequest] = None, are_owners_notified: Union[Optional[bool], NullValue] = None, custom_notification_recipients: Union[ Optional[List[UserBase]], NullValue @@ -383,6 +394,7 @@ def update_retention_policy_by_id( 'retention_length': retention_length, 'status': status, 'can_owner_extend_retention': can_owner_extend_retention, + 'max_extension_length': max_extension_length, 'are_owners_notified': are_owners_notified, 'custom_notification_recipients': custom_notification_recipients, } diff --git a/box_sdk_gen/managers/users.py b/box_sdk_gen/managers/users.py index 69549f8c..aa878aab 100644 --- a/box_sdk_gen/managers/users.py +++ b/box_sdk_gen/managers/users.py @@ -655,7 +655,7 @@ def delete_user_by_id( """ Deletes a user. By default, this operation fails if the user - still owns any content, was recently active, or recently joined the enterprise from a free account. + still owns any content. To proceed, move their owned content first, or use the `force` parameter to delete @@ -669,8 +669,7 @@ def delete_user_by_id( :param notify: Whether the user will receive email notification of the deletion., defaults to None :type notify: Optional[bool], optional - :param force: Specifies whether to delete the user even if they still own files, - were recently active, or recently joined the enterprise from a free account., defaults to None + :param force: Specifies whether to delete the user even if they still own files., defaults to None :type force: Optional[bool], 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 diff --git a/box_sdk_gen/schemas/__init__.py b/box_sdk_gen/schemas/__init__.py index d43309f4..e5dfb6bb 100644 --- a/box_sdk_gen/schemas/__init__.py +++ b/box_sdk_gen/schemas/__init__.py @@ -250,6 +250,10 @@ from box_sdk_gen.schemas.retention_policy_base import * +from box_sdk_gen.schemas.retention_policy_max_extension_length_request import * + +from box_sdk_gen.schemas.retention_policy_max_extension_length_response import * + from box_sdk_gen.schemas.retention_policy_mini import * from box_sdk_gen.schemas.file_version_retention import * diff --git a/box_sdk_gen/schemas/ai_extract_structured.py b/box_sdk_gen/schemas/ai_extract_structured.py index a6bafd0c..49f208fc 100644 --- a/box_sdk_gen/schemas/ai_extract_structured.py +++ b/box_sdk_gen/schemas/ai_extract_structured.py @@ -56,7 +56,7 @@ def __init__( class AiExtractStructuredFieldsOptionsField(BaseObject): def __init__(self, key: str, **kwargs): """ - :param key: A unique identifier for the field. + :param key: A unique identifier for the option. :type key: str """ super().__init__(**kwargs) @@ -93,9 +93,9 @@ def __init__( :type display_name: Optional[str], optional :param prompt: The context about the key that may include how to find and format it., defaults to None :type prompt: Optional[str], optional - :param type: The type of the field. It include but is not limited to string, float, date, enum, and multiSelect., defaults to None + :param type: The type of the field. It can include but is not limited to `string`, `float`, `date`, `enum`, and `multiSelect`., defaults to None :type type: Optional[str], optional - :param options: A list of options for this field. This is most often used in combination with the enum and multiSelect field types., defaults to None + :param options: A list of options for this field. This is most often used in combination with the `enum` and `multiSelect` field types., defaults to None :type options: Optional[List[AiExtractStructuredFieldsOptionsField]], optional """ super().__init__(**kwargs) @@ -114,9 +114,9 @@ def __init__( *, metadata_template: Optional[AiExtractStructuredMetadataTemplateField] = None, fields: Optional[List[AiExtractStructuredFieldsField]] = None, + ai_agent: Optional[AiExtractStructuredAgent] = None, include_confidence_score: Optional[bool] = None, include_reference: Optional[bool] = None, - ai_agent: Optional[AiExtractStructuredAgent] = None, **kwargs ): """ @@ -137,6 +137,6 @@ def __init__( self.items = items self.metadata_template = metadata_template self.fields = fields + self.ai_agent = ai_agent self.include_confidence_score = include_confidence_score self.include_reference = include_reference - self.ai_agent = ai_agent diff --git a/box_sdk_gen/schemas/retention_policy.py b/box_sdk_gen/schemas/retention_policy.py index 0b7b929a..9cfba9bd 100644 --- a/box_sdk_gen/schemas/retention_policy.py +++ b/box_sdk_gen/schemas/retention_policy.py @@ -14,6 +14,14 @@ RetentionPolicyMiniDispositionActionField, ) +from box_sdk_gen.schemas.retention_policy_max_extension_length_response import ( + RetentionPolicyMaxExtensionLengthResponseEnum, +) + +from box_sdk_gen.schemas.retention_policy_max_extension_length_response import ( + RetentionPolicyMaxExtensionLengthResponse, +) + from box_sdk_gen.schemas.retention_policy_mini import RetentionPolicyMini from box_sdk_gen.schemas.user_mini import UserMini @@ -82,6 +90,9 @@ def __init__( policy_name: Optional[str] = None, retention_length: Optional[str] = None, disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None, + max_extension_length: Optional[ + RetentionPolicyMaxExtensionLengthResponse + ] = None, type: RetentionPolicyBaseTypeField = RetentionPolicyBaseTypeField.RETENTION_POLICY, **kwargs ): @@ -159,6 +170,7 @@ def __init__( policy_name=policy_name, retention_length=retention_length, disposition_action=disposition_action, + max_extension_length=max_extension_length, type=type, **kwargs ) diff --git a/box_sdk_gen/schemas/retention_policy_max_extension_length_request.py b/box_sdk_gen/schemas/retention_policy_max_extension_length_request.py new file mode 100644 index 00000000..8684de41 --- /dev/null +++ b/box_sdk_gen/schemas/retention_policy_max_extension_length_request.py @@ -0,0 +1,14 @@ +from enum import Enum + +from typing import Union + +from box_sdk_gen.box.errors import BoxSDKError + + +class RetentionPolicyMaxExtensionLengthRequestEnum(str, Enum): + NONE = 'none' + + +RetentionPolicyMaxExtensionLengthRequest = Union[ + RetentionPolicyMaxExtensionLengthRequestEnum, str, int +] diff --git a/box_sdk_gen/schemas/retention_policy_max_extension_length_response.py b/box_sdk_gen/schemas/retention_policy_max_extension_length_response.py new file mode 100644 index 00000000..988d466a --- /dev/null +++ b/box_sdk_gen/schemas/retention_policy_max_extension_length_response.py @@ -0,0 +1,14 @@ +from enum import Enum + +from typing import Union + +from box_sdk_gen.box.errors import BoxSDKError + + +class RetentionPolicyMaxExtensionLengthResponseEnum(str, Enum): + NONE = 'none' + + +RetentionPolicyMaxExtensionLengthResponse = Union[ + RetentionPolicyMaxExtensionLengthResponseEnum, str +] diff --git a/box_sdk_gen/schemas/retention_policy_mini.py b/box_sdk_gen/schemas/retention_policy_mini.py index 1980630e..8a0914fe 100644 --- a/box_sdk_gen/schemas/retention_policy_mini.py +++ b/box_sdk_gen/schemas/retention_policy_mini.py @@ -4,8 +4,16 @@ from box_sdk_gen.schemas.retention_policy_base import RetentionPolicyBaseTypeField +from box_sdk_gen.schemas.retention_policy_max_extension_length_response import ( + RetentionPolicyMaxExtensionLengthResponseEnum, +) + from box_sdk_gen.schemas.retention_policy_base import RetentionPolicyBase +from box_sdk_gen.schemas.retention_policy_max_extension_length_response import ( + RetentionPolicyMaxExtensionLengthResponse, +) + from box_sdk_gen.box.errors import BoxSDKError @@ -24,6 +32,9 @@ def __init__( policy_name: Optional[str] = None, retention_length: Optional[str] = None, disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None, + max_extension_length: Optional[ + RetentionPolicyMaxExtensionLengthResponse + ] = None, type: RetentionPolicyBaseTypeField = RetentionPolicyBaseTypeField.RETENTION_POLICY, **kwargs ): @@ -54,3 +65,4 @@ def __init__( self.policy_name = policy_name self.retention_length = retention_length self.disposition_action = disposition_action + self.max_extension_length = max_extension_length diff --git a/docs/ai.md b/docs/ai.md index 7e0e7b00..aabdf4ac 100644 --- a/docs/ai.md +++ b/docs/ai.md @@ -246,8 +246,8 @@ client.ai.create_ai_extract_structured( ], ), ], - include_confidence_score=True, ai_agent=ai_extract_structured_agent_basic_text_config, + include_confidence_score=True, ) ``` @@ -259,11 +259,11 @@ client.ai.create_ai_extract_structured( - The metadata template containing the fields to extract. For your request to work, you must provide either `metadata_template` or `fields`, but not both. - fields `Optional[List[CreateAiExtractStructuredFields]]` - The fields to be extracted from the provided items. For your request to work, you must provide either `metadata_template` or `fields`, but not both. +- ai_agent `Optional[AiExtractStructuredAgent]` - include_confidence_score `Optional[bool]` - A flag to indicate whether confidence scores for every extracted field should be returned. - include_reference `Optional[bool]` - A flag to indicate whether references for every extracted field should be returned. -- ai_agent `Optional[AiExtractStructuredAgent]` - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/retention_policies.md b/docs/retention_policies.md index aa34cefa..1211508d 100644 --- a/docs/retention_policies.md +++ b/docs/retention_policies.md @@ -84,6 +84,7 @@ client.retention_policies.create_retention_policy( - Specifies the retention type: _ `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. _ `non_modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. - can_owner_extend_retention `Optional[bool]` - Whether the owner of a file will be allowed to extend the retention. +- max_extension_length `Optional[RetentionPolicyMaxExtensionLengthRequest]` - are_owners_notified `Optional[bool]` - Whether owner and co-owners of a file are notified when the policy nears expiration. - custom_notification_recipients `Optional[List[UserMini]]` @@ -162,6 +163,7 @@ client.retention_policies.update_retention_policy_by_id( - Used to retire a retention policy. If not retiring a policy, do not include this parameter or set it to `null`. - can_owner_extend_retention `Optional[bool]` - Determines if the owner of items under the policy can extend the retention when the original retention duration is about to end. +- max_extension_length `Optional[RetentionPolicyMaxExtensionLengthRequest]` - are_owners_notified `Optional[bool]` - Determines if owners and co-owners of items under the policy are notified when the retention duration is about to end. - custom_notification_recipients `Optional[List[UserBase]]` diff --git a/docs/users.md b/docs/users.md index 725d9d91..980e5d87 100644 --- a/docs/users.md +++ b/docs/users.md @@ -279,7 +279,7 @@ Returns the updated user object. ## Delete user Deletes a user. By default, this operation fails if the user -still owns any content, was recently active, or recently joined the enterprise from a free account. +still owns any content. To proceed, move their owned content first, or use the `force` parameter to delete the user and their files. @@ -301,7 +301,7 @@ client.users.delete_user_by_id(user.id) - notify `Optional[bool]` - Whether the user will receive email notification of the deletion. - force `Optional[bool]` - - Specifies whether to delete the user even if they still own files, were recently active, or recently joined the enterprise from a free account. + - Specifies whether to delete the user even if they still own files. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/test/ai.py b/test/ai.py index 00e1100c..43fc0845 100644 --- a/test/ai.py +++ b/test/ai.py @@ -305,8 +305,8 @@ def testAIExtractStructuredWithFields(): ], ), ], - include_confidence_score=True, ai_agent=ai_extract_structured_agent_basic_text_config, + include_confidence_score=True, ) assert not response.confidence_score == None assert to_string(response.answer.get('hobby')) == to_string(['guitar'])