From 9f93f41d47dd7bcc9b5d08fcea9f87ffe2ecbf83 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 16 Oct 2026 07:46:20 -0700 Subject: [PATCH] feat: add one-time passcode documentation (box/box-openapi#621) --- .codegen.json | 2 +- box_sdk_gen/client.py | 5 + box_sdk_gen/managers/__init__.py | 2 + box_sdk_gen/managers/document_split.py | 272 ++++++++++++++++++ box_sdk_gen/managers/files.py | 12 + box_sdk_gen/managers/folders.py | 12 + box_sdk_gen/managers/shared_links_files.py | 14 + box_sdk_gen/managers/shared_links_folders.py | 14 + .../managers/shared_links_web_links.py | 14 + box_sdk_gen/managers/users.py | 23 +- box_sdk_gen/managers/web_links.py | 12 + box_sdk_gen/schemas/__init__.py | 24 +- box_sdk_gen/schemas/file.py | 45 +++ box_sdk_gen/schemas/folder.py | 45 +++ box_sdk_gen/schemas/keyword_skill_card.py | 2 +- .../shared_link_otp_allowlist_entry.py | 47 +++ ...hared_link_otp_allowlist_entry_writable.py | 34 +++ .../schemas/shared_link_otp_writable.py | 15 + .../shared_link_otp_writable_allowlist.py | 40 +++ .../schemas/shared_link_otp_writable_none.py | 24 ++ .../schemas/shared_link_otp_writable_open.py | 25 ++ box_sdk_gen/schemas/transcript_skill_card.py | 2 +- box_sdk_gen/schemas/upload_session.py | 4 +- box_sdk_gen/schemas/v2026_r0/__init__.py | 36 +++ .../v2026_r0/document_failures_v2026_r0.py | 18 ++ ...nt_split_create_request_manual_v2026_r0.py | 46 +++ ..._create_request_page_selection_v2026_r0.py | 41 +++ ...ent_split_create_request_smart_v2026_r0.py | 28 ++ ...ment_split_create_request_type_v2026_r0.py | 21 ++ .../document_split_create_request_v2026_r0.py | 63 ++++ ...document_split_create_response_v2026_r0.py | 30 ++ .../document_split_failures_v2026_r0.py | 18 ++ .../document_split_output_v2026_r0.py | 37 +++ .../document_split_page_range_v2026_r0.py | 16 ++ ...ment_split_page_selection_item_v2026_r0.py | 40 +++ ...plit_page_selection_page_range_v2026_r0.py | 34 +++ ...t_split_page_selection_segment_v2026_r0.py | 16 ++ ...lit_page_selection_single_page_v2026_r0.py | 30 ++ .../v2026_r0/document_split_v2026_r0.py | 124 ++++++++ .../v2026_r0/document_splits_v2026_r0.py | 34 +++ .../v2026_r0/enterprise_reference_v2026_r0.py | 30 ++ .../v2026_r0/file_reference_v2026_r0.py | 30 ++ box_sdk_gen/schemas/web_link.py | 45 +++ docs/box_sdk_gen/README.md | 1 + docs/box_sdk_gen/document_split.md | 109 +++++++ docs/box_sdk_gen/users.md | 8 +- 46 files changed, 1531 insertions(+), 13 deletions(-) create mode 100644 box_sdk_gen/managers/document_split.py create mode 100644 box_sdk_gen/schemas/shared_link_otp_allowlist_entry.py create mode 100644 box_sdk_gen/schemas/shared_link_otp_allowlist_entry_writable.py create mode 100644 box_sdk_gen/schemas/shared_link_otp_writable.py create mode 100644 box_sdk_gen/schemas/shared_link_otp_writable_allowlist.py create mode 100644 box_sdk_gen/schemas/shared_link_otp_writable_none.py create mode 100644 box_sdk_gen/schemas/shared_link_otp_writable_open.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_failures_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_create_request_manual_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_create_request_page_selection_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_create_request_smart_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_create_request_type_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_create_request_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_create_response_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_failures_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_output_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_page_range_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_page_selection_item_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_page_selection_page_range_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_page_selection_segment_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_page_selection_single_page_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_split_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/document_splits_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/enterprise_reference_v2026_r0.py create mode 100644 box_sdk_gen/schemas/v2026_r0/file_reference_v2026_r0.py create mode 100644 docs/box_sdk_gen/document_split.md diff --git a/.codegen.json b/.codegen.json index 0e0c5ce9f..1d920b4b5 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "d55532c", "specHash": "e21eebc", "version": "4.19.0" } +{ "engineHash": "d55532c", "specHash": "fcfcd5d", "version": "4.19.0" } diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py index 055076108..96b011d8c 100644 --- a/box_sdk_gen/client.py +++ b/box_sdk_gen/client.py @@ -198,6 +198,8 @@ from box_sdk_gen.managers.notes import NotesManager +from box_sdk_gen.managers.document_split import DocumentSplitManager + from box_sdk_gen.managers.query import QueryManager from box_sdk_gen.networking.auth import Authentication @@ -478,6 +480,9 @@ def __init__( auth=self.auth, network_session=self.network_session ) self.notes = NotesManager(auth=self.auth, network_session=self.network_session) + self.document_split = DocumentSplitManager( + auth=self.auth, network_session=self.network_session + ) self.query = QueryManager(auth=self.auth, network_session=self.network_session) def make_request(self, fetch_options: FetchOptions) -> FetchResponse: diff --git a/box_sdk_gen/managers/__init__.py b/box_sdk_gen/managers/__init__.py index 7ce34c33f..847996262 100644 --- a/box_sdk_gen/managers/__init__.py +++ b/box_sdk_gen/managers/__init__.py @@ -168,4 +168,6 @@ from box_sdk_gen.managers.notes import * +from box_sdk_gen.managers.document_split import * + from box_sdk_gen.managers.query import * diff --git a/box_sdk_gen/managers/document_split.py b/box_sdk_gen/managers/document_split.py new file mode 100644 index 000000000..dfa836b28 --- /dev/null +++ b/box_sdk_gen/managers/document_split.py @@ -0,0 +1,272 @@ +from enum import Enum + +from typing import Optional + +from typing import Dict + +from box_sdk_gen.internal.utils import to_string + +from box_sdk_gen.serialization.json import serialize + +from box_sdk_gen.serialization.json import deserialize + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_manual_v2026_r0 import ( + DocumentSplitCreateRequestManualV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_page_selection_v2026_r0 import ( + DocumentSplitCreateRequestPageSelectionV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_smart_v2026_r0 import ( + DocumentSplitCreateRequestSmartV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_type_v2026_r0 import ( + DocumentSplitCreateRequestTypeV2026R0, +) + +from box_sdk_gen.networking.fetch_options import ResponseFormat + +from box_sdk_gen.schemas.v2026_r0.document_split_create_response_v2026_r0 import ( + DocumentSplitCreateResponseV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.client_error_v2026_r0 import ClientErrorV2026R0 + +from box_sdk_gen.parameters.v2026_r0.box_version_header_v2026_r0 import ( + BoxVersionHeaderV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_v2026_r0 import ( + DocumentSplitCreateRequestV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_splits_v2026_r0 import DocumentSplitsV2026R0 + +from box_sdk_gen.schemas.v2026_r0.document_split_v2026_r0 import DocumentSplitV2026R0 + +from box_sdk_gen.box.errors import BoxSDKError + +from box_sdk_gen.networking.auth import Authentication + +from box_sdk_gen.networking.network import NetworkSession + +from box_sdk_gen.networking.fetch_options import FetchOptions + +from box_sdk_gen.networking.fetch_response import FetchResponse + +from box_sdk_gen.internal.utils import prepare_params + +from box_sdk_gen.internal.utils import to_string + +from box_sdk_gen.internal.utils import ByteStream + +from box_sdk_gen.serialization.json import sd_to_json + +from box_sdk_gen.serialization.json import SerializedData + + +class CreateDocumentSplitV2026R0InputSource(str, Enum): + API = 'api' + BOX = 'box' + RELAY = 'relay' + SALESFORCE = 'salesforce' + + +class DocumentSplitManager: + def __init__( + self, + *, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None + ): + if network_session is None: + network_session = NetworkSession() + self.auth = auth + self.network_session = network_session + + def create_document_split_v2026_r0( + self, + source_file_id: str, + destination_folder_id: str, + input_source: CreateDocumentSplitV2026R0InputSource, + split_input: DocumentSplitCreateRequestTypeV2026R0, + *, + external_id: Optional[str] = None, + box_version: BoxVersionHeaderV2026R0 = BoxVersionHeaderV2026R0._2026_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> DocumentSplitCreateResponseV2026R0: + """ + Initiates a Document Split job for the supplied source file. The job runs + + asynchronously; clients can poll the returned job ID to track progress. + + + All split-specific input lives under `split_input`. When + + + `split_input.split_type` is `manual`, provide + + + `split_input.split_definition` (continuous page ranges; `version` may be + + + omitted or `v_1`). When `split_input.split_type` is `page_selection`, + + + provide `split_input.page_selection` (non-linear page segments; `version` + + + may be omitted or `v_2`). `split_input.prompt` must not be provided for + + + either of those variants. When `split_input.split_type` is `smart`, + + + `split_input.prompt` is required and neither + + + `split_input.split_definition` nor `split_input.page_selection` must be + + + provided. + + :param source_file_id: The ID of the source file to split. + :type source_file_id: str + :param destination_folder_id: The ID of the folder where the resulting files will be uploaded. + :type destination_folder_id: str + :param input_source: The system that initiated the request, used for analytics and + traceability. + :type input_source: CreateDocumentSplitV2026R0InputSource + :param external_id: An optional identifier supplied by the caller for this Document Split job. + The value is returned on job responses for correlation only. It is not + a Box resource ID, is not required to be unique, and cannot be used to + look up the job., defaults to None + :type external_id: Optional[str], optional + :param box_version: Version header., defaults to BoxVersionHeaderV2026R0._2026_0 + :type box_version: BoxVersionHeaderV2026R0, 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 + """ + if extra_headers is None: + extra_headers = {} + request_body: Dict = { + 'source_file_id': source_file_id, + 'destination_folder_id': destination_folder_id, + 'input_source': input_source, + 'split_input': split_input, + 'external_id': external_id, + } + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [self.network_session.base_urls.base_url, '/2.0/document_splits'] + ), + method='POST', + headers=headers_map, + data=serialize(request_body), + content_type='application/json', + response_format=ResponseFormat.JSON, + auth=self.auth, + network_session=self.network_session, + ) + ) + return deserialize(response.data, DocumentSplitCreateResponseV2026R0) + + def get_document_splits_v2026_r0( + self, + *, + marker: Optional[str] = None, + limit: Optional[int] = None, + box_version: BoxVersionHeaderV2026R0 = BoxVersionHeaderV2026R0._2026_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> DocumentSplitsV2026R0: + """ + Returns a paginated list of Document Split jobs accessible to the + + authenticated user. + + :param marker: Defines the position marker at which to begin returning results. This is + used when paginating using marker-based pagination. + + This requires `usemarker` to be set to `true`., defaults to None + :type marker: Optional[str], optional + :param limit: The maximum number of items to return per page., defaults to None + :type limit: Optional[int], optional + :param box_version: Version header., defaults to BoxVersionHeaderV2026R0._2026_0 + :type box_version: BoxVersionHeaderV2026R0, 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 + """ + if extra_headers is None: + extra_headers = {} + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [self.network_session.base_urls.base_url, '/2.0/document_splits'] + ), + method='GET', + params=query_params_map, + headers=headers_map, + response_format=ResponseFormat.JSON, + auth=self.auth, + network_session=self.network_session, + ) + ) + return deserialize(response.data, DocumentSplitsV2026R0) + + def get_document_split_by_id_v2026_r0( + self, + document_split_id: str, + *, + box_version: BoxVersionHeaderV2026R0 = BoxVersionHeaderV2026R0._2026_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> DocumentSplitV2026R0: + """ + Returns details for a single Document Split job identified by its ID, + + including the current status, the input definition, and any output files + + + produced by the job. + + :param document_split_id: The unique identifier for the Document Split job. + Example: "1748426" + :type document_split_id: str + :param box_version: Version header., defaults to BoxVersionHeaderV2026R0._2026_0 + :type box_version: BoxVersionHeaderV2026R0, 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 + """ + if extra_headers is None: + extra_headers = {} + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [ + self.network_session.base_urls.base_url, + '/2.0/document_splits/', + to_string(document_split_id), + ] + ), + method='GET', + headers=headers_map, + response_format=ResponseFormat.JSON, + auth=self.auth, + network_session=self.network_session, + ) + ) + return deserialize(response.data, DocumentSplitV2026R0) diff --git a/box_sdk_gen/managers/files.py b/box_sdk_gen/managers/files.py index 6bdc09f38..c6fd22e5e 100644 --- a/box_sdk_gen/managers/files.py +++ b/box_sdk_gen/managers/files.py @@ -18,12 +18,22 @@ from box_sdk_gen.serialization.json import serialize +from box_sdk_gen.schemas.shared_link_otp_writable_none import SharedLinkOtpWritableNone + +from box_sdk_gen.schemas.shared_link_otp_writable_open import SharedLinkOtpWritableOpen + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import ( + SharedLinkOtpWritableAllowlist, +) + from box_sdk_gen.networking.fetch_options import ResponseFormat from box_sdk_gen.schemas.file_full import FileFull from box_sdk_gen.schemas.client_error import ClientError +from box_sdk_gen.schemas.shared_link_otp_writable import SharedLinkOtpWritable + from box_sdk_gen.box.errors import BoxSDKError from box_sdk_gen.networking.auth import Authentication @@ -89,6 +99,7 @@ def __init__( vanity_name: Optional[str] = None, unshared_at: Optional[DateTime] = None, permissions: Optional[UpdateFileByIdSharedLinkPermissionsField] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -129,6 +140,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class UpdateFileByIdLockAccessField(str, Enum): diff --git a/box_sdk_gen/managers/folders.py b/box_sdk_gen/managers/folders.py index dd7b809cd..772014c58 100644 --- a/box_sdk_gen/managers/folders.py +++ b/box_sdk_gen/managers/folders.py @@ -18,12 +18,22 @@ from box_sdk_gen.serialization.json import serialize +from box_sdk_gen.schemas.shared_link_otp_writable_none import SharedLinkOtpWritableNone + +from box_sdk_gen.schemas.shared_link_otp_writable_open import SharedLinkOtpWritableOpen + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import ( + SharedLinkOtpWritableAllowlist, +) + from box_sdk_gen.networking.fetch_options import ResponseFormat from box_sdk_gen.schemas.folder_full import FolderFull from box_sdk_gen.schemas.client_error import ClientError +from box_sdk_gen.schemas.shared_link_otp_writable import SharedLinkOtpWritable + from box_sdk_gen.schemas.items import Items from box_sdk_gen.box.errors import BoxSDKError @@ -109,6 +119,7 @@ def __init__( vanity_name: Optional[str] = None, unshared_at: Optional[DateTime] = None, permissions: Optional[UpdateFolderByIdSharedLinkPermissionsField] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -149,6 +160,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class UpdateFolderByIdFolderUploadEmailAccessField(str, Enum): diff --git a/box_sdk_gen/managers/shared_links_files.py b/box_sdk_gen/managers/shared_links_files.py index bda3c2669..ef60352e7 100644 --- a/box_sdk_gen/managers/shared_links_files.py +++ b/box_sdk_gen/managers/shared_links_files.py @@ -18,12 +18,22 @@ from typing import Union +from box_sdk_gen.schemas.shared_link_otp_writable_none import SharedLinkOtpWritableNone + +from box_sdk_gen.schemas.shared_link_otp_writable_open import SharedLinkOtpWritableOpen + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import ( + SharedLinkOtpWritableAllowlist, +) + from box_sdk_gen.networking.fetch_options import ResponseFormat from box_sdk_gen.schemas.file_full import FileFull from box_sdk_gen.schemas.client_error import ClientError +from box_sdk_gen.schemas.shared_link_otp_writable import SharedLinkOtpWritable + from box_sdk_gen.box.errors import BoxSDKError from box_sdk_gen.networking.auth import Authentication @@ -93,6 +103,7 @@ def __init__( vanity_name: Optional[str] = None, unshared_at: Optional[DateTime] = None, permissions: Optional[AddShareLinkToFileSharedLinkPermissionsField] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -135,6 +146,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class UpdateSharedLinkOnFileSharedLinkAccessField(str, Enum): @@ -183,6 +195,7 @@ def __init__( vanity_name: Optional[str] = None, unshared_at: Optional[DateTime] = None, permissions: Optional[UpdateSharedLinkOnFileSharedLinkPermissionsField] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -225,6 +238,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class RemoveSharedLinkFromFileSharedLink(BaseObject): diff --git a/box_sdk_gen/managers/shared_links_folders.py b/box_sdk_gen/managers/shared_links_folders.py index d5c1ae142..5e1fb2e44 100644 --- a/box_sdk_gen/managers/shared_links_folders.py +++ b/box_sdk_gen/managers/shared_links_folders.py @@ -18,12 +18,22 @@ from typing import Union +from box_sdk_gen.schemas.shared_link_otp_writable_none import SharedLinkOtpWritableNone + +from box_sdk_gen.schemas.shared_link_otp_writable_open import SharedLinkOtpWritableOpen + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import ( + SharedLinkOtpWritableAllowlist, +) + from box_sdk_gen.networking.fetch_options import ResponseFormat from box_sdk_gen.schemas.folder_full import FolderFull from box_sdk_gen.schemas.client_error import ClientError +from box_sdk_gen.schemas.shared_link_otp_writable import SharedLinkOtpWritable + from box_sdk_gen.box.errors import BoxSDKError from box_sdk_gen.networking.auth import Authentication @@ -90,6 +100,7 @@ def __init__( vanity_name: Optional[str] = None, unshared_at: Optional[DateTime] = None, permissions: Optional[AddShareLinkToFolderSharedLinkPermissionsField] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -132,6 +143,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class UpdateSharedLinkOnFolderSharedLinkAccessField(str, Enum): @@ -179,6 +191,7 @@ def __init__( permissions: Optional[ UpdateSharedLinkOnFolderSharedLinkPermissionsField ] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -221,6 +234,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class RemoveSharedLinkFromFolderSharedLink(BaseObject): diff --git a/box_sdk_gen/managers/shared_links_web_links.py b/box_sdk_gen/managers/shared_links_web_links.py index 3c2081b76..686c03b6a 100644 --- a/box_sdk_gen/managers/shared_links_web_links.py +++ b/box_sdk_gen/managers/shared_links_web_links.py @@ -18,12 +18,22 @@ from typing import Union +from box_sdk_gen.schemas.shared_link_otp_writable_none import SharedLinkOtpWritableNone + +from box_sdk_gen.schemas.shared_link_otp_writable_open import SharedLinkOtpWritableOpen + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import ( + SharedLinkOtpWritableAllowlist, +) + from box_sdk_gen.networking.fetch_options import ResponseFormat from box_sdk_gen.schemas.web_link import WebLink from box_sdk_gen.schemas.client_error import ClientError +from box_sdk_gen.schemas.shared_link_otp_writable import SharedLinkOtpWritable + from box_sdk_gen.box.errors import BoxSDKError from box_sdk_gen.networking.auth import Authentication @@ -89,6 +99,7 @@ def __init__( vanity_name: Optional[str] = None, unshared_at: Optional[DateTime] = None, permissions: Optional[AddShareLinkToWebLinkSharedLinkPermissionsField] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -131,6 +142,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class UpdateSharedLinkOnWebLinkSharedLinkAccessField(str, Enum): @@ -177,6 +189,7 @@ def __init__( permissions: Optional[ UpdateSharedLinkOnWebLinkSharedLinkPermissionsField ] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -219,6 +232,7 @@ def __init__( self.vanity_name = vanity_name self.unshared_at = unshared_at self.permissions = permissions + self.one_time_passcode = one_time_passcode class RemoveSharedLinkFromWebLinkSharedLink(BaseObject): diff --git a/box_sdk_gen/managers/users.py b/box_sdk_gen/managers/users.py index a59df50c3..8c58ef1b1 100644 --- a/box_sdk_gen/managers/users.py +++ b/box_sdk_gen/managers/users.py @@ -671,13 +671,34 @@ def delete_user_by_id( the user and their files. + + If the enterprise has a retention policy, including a retired one, or a + + + legal hold that is not fully released, you can't delete a user who owns + + + content, even with `force`. Transfer the user's content first by using the + + + [Transfer owned folders](https://developer.box.com/reference/put-users-id-folders-0) + + + endpoint. + :param user_id: The ID of the user. Example: "12345" :type user_id: str :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., defaults to None + :param force: Specifies whether to delete the user even if they still own files. + + If the user owns content and the enterprise has a retention policy, + including a retired one, or a legal hold that is not fully released, + setting `force` to `true` doesn't delete the user. The request returns + a `403` error, and you must transfer the user's content before deleting + the user., 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/managers/web_links.py b/box_sdk_gen/managers/web_links.py index 9b337b76d..59eda0fc9 100644 --- a/box_sdk_gen/managers/web_links.py +++ b/box_sdk_gen/managers/web_links.py @@ -12,12 +12,22 @@ from box_sdk_gen.internal.utils import to_string +from box_sdk_gen.schemas.shared_link_otp_writable_none import SharedLinkOtpWritableNone + +from box_sdk_gen.schemas.shared_link_otp_writable_open import SharedLinkOtpWritableOpen + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import ( + SharedLinkOtpWritableAllowlist, +) + from box_sdk_gen.networking.fetch_options import ResponseFormat from box_sdk_gen.schemas.web_link import WebLink from box_sdk_gen.schemas.client_error import ClientError +from box_sdk_gen.schemas.shared_link_otp_writable import SharedLinkOtpWritable + from box_sdk_gen.box.errors import BoxSDKError from box_sdk_gen.networking.auth import Authentication @@ -80,6 +90,7 @@ def __init__( password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[DateTime] = None, + one_time_passcode: Optional[SharedLinkOtpWritable] = None, **kwargs ): """ @@ -121,6 +132,7 @@ def __init__( self.password = password self.vanity_name = vanity_name self.unshared_at = unshared_at + self.one_time_passcode = one_time_passcode class WebLinksManager: diff --git a/box_sdk_gen/schemas/__init__.py b/box_sdk_gen/schemas/__init__.py index f0b360d70..3763f1d54 100644 --- a/box_sdk_gen/schemas/__init__.py +++ b/box_sdk_gen/schemas/__init__.py @@ -278,6 +278,16 @@ from box_sdk_gen.schemas.session_termination_message import * +from box_sdk_gen.schemas.shared_link_otp_allowlist_entry_writable import * + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import * + +from box_sdk_gen.schemas.shared_link_otp_writable_none import * + +from box_sdk_gen.schemas.shared_link_otp_writable_open import * + +from box_sdk_gen.schemas.shared_link_otp_writable import * + from box_sdk_gen.schemas.shield_information_barrier_base import * from box_sdk_gen.schemas.shield_information_barrier_reference import * @@ -468,12 +478,6 @@ from box_sdk_gen.schemas.file_request import * -from box_sdk_gen.schemas.file import * - -from box_sdk_gen.schemas.file_full import * - -from box_sdk_gen.schemas.files import * - from box_sdk_gen.schemas.event_source import * from box_sdk_gen.schemas.device_pinner import * @@ -518,6 +522,14 @@ from box_sdk_gen.schemas.shield_information_barriers import * +from box_sdk_gen.schemas.shared_link_otp_allowlist_entry import * + +from box_sdk_gen.schemas.file import * + +from box_sdk_gen.schemas.file_full import * + +from box_sdk_gen.schemas.files import * + from box_sdk_gen.schemas.folder_lock import * from box_sdk_gen.schemas.folder_locks import * diff --git a/box_sdk_gen/schemas/file.py b/box_sdk_gen/schemas/file.py index 5eaacca29..fc0e636fe 100644 --- a/box_sdk_gen/schemas/file.py +++ b/box_sdk_gen/schemas/file.py @@ -18,6 +18,10 @@ from box_sdk_gen.schemas.user_mini import UserMini +from box_sdk_gen.schemas.shared_link_otp_allowlist_entry import ( + SharedLinkOtpAllowlistEntry, +) + from box_sdk_gen.box.errors import BoxSDKError from box_sdk_gen.internal.utils import DateTime @@ -81,6 +85,45 @@ def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwar self.can_edit = can_edit +class FileSharedLinkOneTimePasscodeField(BaseObject): + def __init__( + self, + mode: str, + *, + allowlist: Optional[List[SharedLinkOtpAllowlistEntry]] = None, + **kwargs + ): + """ + :param mode: The current OTP enforcement mode for the shared link. + + * `none` - OTP enforcement is turned off. The shared link is accessible + without any one-time-passcode verification. + * `open` - Any anonymous recipient can request a one-time-passcode to + any email address and access the shared link after verifying it. + Collaborators and registered Box users access the link without + being prompted. + * `allowlist` - Anonymous recipients can request a one-time-passcode + only when they enter an email that matches an entry on the + `allowlist`. + :type mode: str + :param allowlist: The list of email and domain entries that are permitted to access the + shared link when `mode` is `allowlist`. Anonymous users whose + email matches an entry can request and verify a one-time-passcode. + + Because the entries carry recipient email addresses and the identity + of the user who added them, this field is only returned to users + with owner, co-owner, or editor access on the item. For viewer + collaborators and below the field is omitted. + + An allowlist contains at most 1000 entries, matching the limit + enforced when setting the allowlist on a shared link., defaults to None + :type allowlist: Optional[List[SharedLinkOtpAllowlistEntry]], optional + """ + super().__init__(**kwargs) + self.mode = mode + self.allowlist = allowlist + + class FileSharedLinkField(BaseObject): def __init__( self, @@ -90,6 +133,7 @@ def __init__( is_password_enabled: bool, download_count: int, preview_count: int, + one_time_passcode: FileSharedLinkOneTimePasscodeField, *, download_url: Optional[str] = None, vanity_url: Optional[str] = None, @@ -160,6 +204,7 @@ def __init__( self.is_password_enabled = is_password_enabled self.download_count = download_count self.preview_count = preview_count + self.one_time_passcode = one_time_passcode self.download_url = download_url self.vanity_url = vanity_url self.vanity_name = vanity_name diff --git a/box_sdk_gen/schemas/folder.py b/box_sdk_gen/schemas/folder.py index 87118100d..0871a2e5d 100644 --- a/box_sdk_gen/schemas/folder.py +++ b/box_sdk_gen/schemas/folder.py @@ -14,6 +14,10 @@ from box_sdk_gen.schemas.user_mini import UserMini +from box_sdk_gen.schemas.shared_link_otp_allowlist_entry import ( + SharedLinkOtpAllowlistEntry, +) + from box_sdk_gen.schemas.items import Items from box_sdk_gen.box.errors import BoxSDKError @@ -79,6 +83,45 @@ def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwar self.can_edit = can_edit +class FolderSharedLinkOneTimePasscodeField(BaseObject): + def __init__( + self, + mode: str, + *, + allowlist: Optional[List[SharedLinkOtpAllowlistEntry]] = None, + **kwargs + ): + """ + :param mode: The current OTP enforcement mode for the shared link. + + * `none` - OTP enforcement is turned off. The shared link is accessible + without any one-time-passcode verification. + * `open` - Any anonymous recipient can request a one-time-passcode to + any email address and access the shared link after verifying it. + Collaborators and registered Box users access the link without + being prompted. + * `allowlist` - Anonymous recipients can request a one-time-passcode + only when they enter an email that matches an entry on the + `allowlist`. + :type mode: str + :param allowlist: The list of email and domain entries that are permitted to access the + shared link when `mode` is `allowlist`. Anonymous users whose + email matches an entry can request and verify a one-time-passcode. + + Because the entries carry recipient email addresses and the identity + of the user who added them, this field is only returned to users + with owner, co-owner, or editor access on the item. For viewer + collaborators and below the field is omitted. + + An allowlist contains at most 1000 entries, matching the limit + enforced when setting the allowlist on a shared link., defaults to None + :type allowlist: Optional[List[SharedLinkOtpAllowlistEntry]], optional + """ + super().__init__(**kwargs) + self.mode = mode + self.allowlist = allowlist + + class FolderSharedLinkField(BaseObject): def __init__( self, @@ -88,6 +131,7 @@ def __init__( is_password_enabled: bool, download_count: int, preview_count: int, + one_time_passcode: FolderSharedLinkOneTimePasscodeField, *, download_url: Optional[str] = None, vanity_url: Optional[str] = None, @@ -158,6 +202,7 @@ def __init__( self.is_password_enabled = is_password_enabled self.download_count = download_count self.preview_count = preview_count + self.one_time_passcode = one_time_passcode self.download_url = download_url self.vanity_url = vanity_url self.vanity_name = vanity_name diff --git a/box_sdk_gen/schemas/keyword_skill_card.py b/box_sdk_gen/schemas/keyword_skill_card.py index ba6cf2cc7..aa6f0117c 100644 --- a/box_sdk_gen/schemas/keyword_skill_card.py +++ b/box_sdk_gen/schemas/keyword_skill_card.py @@ -118,7 +118,7 @@ def __init__( :param invocation: The invocation of this service, used to track which instance of a service applied the metadata. :type invocation: KeywordSkillCardInvocationField - :param entries: An list of entries in the metadata card. + :param entries: A list of entries in the metadata card. :type entries: List[KeywordSkillCardEntriesField] :param created_at: The optional date and time this card was created at., defaults to None :type created_at: Optional[DateTime], optional diff --git a/box_sdk_gen/schemas/shared_link_otp_allowlist_entry.py b/box_sdk_gen/schemas/shared_link_otp_allowlist_entry.py new file mode 100644 index 000000000..ac6d86fce --- /dev/null +++ b/box_sdk_gen/schemas/shared_link_otp_allowlist_entry.py @@ -0,0 +1,47 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.user_base import UserBase + +from box_sdk_gen.box.errors import BoxSDKError + +from box_sdk_gen.internal.utils import DateTime + + +class SharedLinkOtpAllowlistEntryTypeField(str, Enum): + EMAIL = 'email' + DOMAIN = 'domain' + + +class SharedLinkOtpAllowlistEntry(BaseObject): + _discriminator = 'type', {'email', 'domain'} + + def __init__( + self, + type: SharedLinkOtpAllowlistEntryTypeField, + value: str, + created_at: DateTime, + created_by: UserBase, + **kwargs + ): + """ + :param type: The kind of allowlist entry. + + * `email` - The entry matches a single email address. + * `domain` - The entry matches every email address under the + given domain. + :type type: SharedLinkOtpAllowlistEntryTypeField + :param value: The value of the allowlist entry. + + * For `email` entries, the full email address (must contain `@`). + * For `domain` entries, the bare domain (e.g. `example.com`). + :type value: str + :param created_at: The date and time when the allowlist entry was added. + :type created_at: DateTime + """ + super().__init__(**kwargs) + self.type = type + self.value = value + self.created_at = created_at + self.created_by = created_by diff --git a/box_sdk_gen/schemas/shared_link_otp_allowlist_entry_writable.py b/box_sdk_gen/schemas/shared_link_otp_allowlist_entry_writable.py new file mode 100644 index 000000000..0b0de1b47 --- /dev/null +++ b/box_sdk_gen/schemas/shared_link_otp_allowlist_entry_writable.py @@ -0,0 +1,34 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class SharedLinkOtpAllowlistEntryWritableTypeField(str, Enum): + EMAIL = 'email' + DOMAIN = 'domain' + + +class SharedLinkOtpAllowlistEntryWritable(BaseObject): + _discriminator = 'type', {'email', 'domain'} + + def __init__( + self, type: SharedLinkOtpAllowlistEntryWritableTypeField, value: str, **kwargs + ): + """ + :param type: The kind of allowlist entry. + + * `email` - The entry matches a single email address. + * `domain` - The entry matches every email address under the + given domain. + :type type: SharedLinkOtpAllowlistEntryWritableTypeField + :param value: The value of the allowlist entry. + + * For `email` entries, the full email address (must contain `@`). + * For `domain` entries, the bare domain (e.g. `example.com`). + :type value: str + """ + super().__init__(**kwargs) + self.type = type + self.value = value diff --git a/box_sdk_gen/schemas/shared_link_otp_writable.py b/box_sdk_gen/schemas/shared_link_otp_writable.py new file mode 100644 index 000000000..85f93b352 --- /dev/null +++ b/box_sdk_gen/schemas/shared_link_otp_writable.py @@ -0,0 +1,15 @@ +from typing import Union + +from box_sdk_gen.schemas.shared_link_otp_writable_none import SharedLinkOtpWritableNone + +from box_sdk_gen.schemas.shared_link_otp_writable_open import SharedLinkOtpWritableOpen + +from box_sdk_gen.schemas.shared_link_otp_writable_allowlist import ( + SharedLinkOtpWritableAllowlist, +) + +from box_sdk_gen.box.errors import BoxSDKError + +SharedLinkOtpWritable = Union[ + SharedLinkOtpWritableNone, SharedLinkOtpWritableOpen, SharedLinkOtpWritableAllowlist +] diff --git a/box_sdk_gen/schemas/shared_link_otp_writable_allowlist.py b/box_sdk_gen/schemas/shared_link_otp_writable_allowlist.py new file mode 100644 index 000000000..1389e69b5 --- /dev/null +++ b/box_sdk_gen/schemas/shared_link_otp_writable_allowlist.py @@ -0,0 +1,40 @@ +from enum import Enum + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.shared_link_otp_allowlist_entry_writable import ( + SharedLinkOtpAllowlistEntryWritable, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class SharedLinkOtpWritableAllowlistModeField(str, Enum): + ALLOWLIST = 'allowlist' + + +class SharedLinkOtpWritableAllowlist(BaseObject): + def __init__( + self, + allowlist: List[SharedLinkOtpAllowlistEntryWritable], + *, + mode: SharedLinkOtpWritableAllowlistModeField = SharedLinkOtpWritableAllowlistModeField.ALLOWLIST, + **kwargs + ): + """ + :param allowlist: The list of email and domain entries that are permitted to access the + shared link when `mode` is `allowlist`. Anonymous users whose + email matches an entry can request and verify a one-time-passcode. + + Providing this field replaces the entire existing allowlist; passing + an empty array clears all entries. Required when `mode` is `allowlist`. + :type allowlist: List[SharedLinkOtpAllowlistEntryWritable] + :param mode: Set to `allowlist` to restrict OTP requests to emails matching an + entry on the `allowlist`., defaults to SharedLinkOtpWritableAllowlistModeField.ALLOWLIST + :type mode: SharedLinkOtpWritableAllowlistModeField, optional + """ + super().__init__(**kwargs) + self.allowlist = allowlist + self.mode = mode diff --git a/box_sdk_gen/schemas/shared_link_otp_writable_none.py b/box_sdk_gen/schemas/shared_link_otp_writable_none.py new file mode 100644 index 000000000..b706b564c --- /dev/null +++ b/box_sdk_gen/schemas/shared_link_otp_writable_none.py @@ -0,0 +1,24 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class SharedLinkOtpWritableNoneModeField(str, Enum): + NONE = 'none' + + +class SharedLinkOtpWritableNone(BaseObject): + def __init__( + self, + *, + mode: SharedLinkOtpWritableNoneModeField = SharedLinkOtpWritableNoneModeField.NONE, + **kwargs + ): + """ + :param mode: Set to `none` to disable OTP enforcement for the shared link., defaults to SharedLinkOtpWritableNoneModeField.NONE + :type mode: SharedLinkOtpWritableNoneModeField, optional + """ + super().__init__(**kwargs) + self.mode = mode diff --git a/box_sdk_gen/schemas/shared_link_otp_writable_open.py b/box_sdk_gen/schemas/shared_link_otp_writable_open.py new file mode 100644 index 000000000..2b8c3814b --- /dev/null +++ b/box_sdk_gen/schemas/shared_link_otp_writable_open.py @@ -0,0 +1,25 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class SharedLinkOtpWritableOpenModeField(str, Enum): + OPEN = 'open' + + +class SharedLinkOtpWritableOpen(BaseObject): + def __init__( + self, + *, + mode: SharedLinkOtpWritableOpenModeField = SharedLinkOtpWritableOpenModeField.OPEN, + **kwargs + ): + """ + :param mode: Set to `open` to allow any anonymous recipient to request a + one-time-passcode to any email address., defaults to SharedLinkOtpWritableOpenModeField.OPEN + :type mode: SharedLinkOtpWritableOpenModeField, optional + """ + super().__init__(**kwargs) + self.mode = mode diff --git a/box_sdk_gen/schemas/transcript_skill_card.py b/box_sdk_gen/schemas/transcript_skill_card.py index 43c8742e5..b93cef2fd 100644 --- a/box_sdk_gen/schemas/transcript_skill_card.py +++ b/box_sdk_gen/schemas/transcript_skill_card.py @@ -141,7 +141,7 @@ def __init__( :param invocation: The invocation of this service, used to track which instance of a service applied the metadata. :type invocation: TranscriptSkillCardInvocationField - :param entries: An list of entries for the card. This represents the individual entries of + :param entries: A list of entries for the card. This represents the individual entries of the transcription. :type entries: List[TranscriptSkillCardEntriesField] :param created_at: The optional date and time this card was created at., defaults to None diff --git a/box_sdk_gen/schemas/upload_session.py b/box_sdk_gen/schemas/upload_session.py index 495284b4d..ec26813cf 100644 --- a/box_sdk_gen/schemas/upload_session.py +++ b/box_sdk_gen/schemas/upload_session.py @@ -75,7 +75,7 @@ def __init__( :type type: Optional[UploadSessionTypeField], optional :param session_expires_at: The date and time when this session expires., defaults to None :type session_expires_at: Optional[DateTime], optional - :param part_size: The size in bytes that must be used for all parts of of the + :param part_size: The size in bytes that must be used for all parts of the upload. Only the last part is allowed to be of a smaller size., defaults to None @@ -86,7 +86,7 @@ def __init__( :param num_parts_processed: The number of parts that have been uploaded and processed by the server. This starts at `0`. - When committing a file files, inspecting this property can + When committing a file, inspecting this property can provide insight if all parts have been uploaded correctly., defaults to None :type num_parts_processed: Optional[int], optional """ diff --git a/box_sdk_gen/schemas/v2026_r0/__init__.py b/box_sdk_gen/schemas/v2026_r0/__init__.py index 95e2bce5d..7aafddb8a 100644 --- a/box_sdk_gen/schemas/v2026_r0/__init__.py +++ b/box_sdk_gen/schemas/v2026_r0/__init__.py @@ -4,6 +4,38 @@ from box_sdk_gen.schemas.v2026_r0.client_error_v2026_r0 import * +from box_sdk_gen.schemas.v2026_r0.document_failures_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_failures_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_smart_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_create_response_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_page_range_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_manual_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_page_range_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_single_page_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_segment_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_item_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_page_selection_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_type_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.enterprise_reference_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.file_reference_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_split_output_v2026_r0 import * + from box_sdk_gen.schemas.v2026_r0.folder_reference_v2026_r0 import * from box_sdk_gen.schemas.v2026_r0.notes_convert_request_body_v2026_r0 import * @@ -36,6 +68,10 @@ from box_sdk_gen.schemas.v2026_r0.user_mini_v2026_r0 import * +from box_sdk_gen.schemas.v2026_r0.document_split_v2026_r0 import * + +from box_sdk_gen.schemas.v2026_r0.document_splits_v2026_r0 import * + from box_sdk_gen.schemas.v2026_r0.automate_workflow_action_v2026_r0 import * from box_sdk_gen.schemas.v2026_r0.automate_workflows_v2026_r0 import * diff --git a/box_sdk_gen/schemas/v2026_r0/document_failures_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_failures_v2026_r0.py new file mode 100644 index 000000000..a0c6d4966 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_failures_v2026_r0.py @@ -0,0 +1,18 @@ +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentFailuresV2026R0(BaseObject): + def __init__(self, errors: List[str], warnings: List[str], **kwargs): + """ + :param errors: A list of errors that occurred during the document job. + :type errors: List[str] + :param warnings: A list of warnings that occurred during the document job. + :type warnings: List[str] + """ + super().__init__(**kwargs) + self.errors = errors + self.warnings = warnings diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_create_request_manual_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_manual_v2026_r0.py new file mode 100644 index 000000000..f94c664ab --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_manual_v2026_r0.py @@ -0,0 +1,46 @@ +from enum import Enum + +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2026_r0.document_split_page_range_v2026_r0 import ( + DocumentSplitPageRangeV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitCreateRequestManualV2026R0SplitTypeField(str, Enum): + MANUAL = 'manual' + + +class DocumentSplitCreateRequestManualV2026R0VersionField(str, Enum): + V_1 = 'v_1' + + +class DocumentSplitCreateRequestManualV2026R0(BaseObject): + def __init__( + self, + split_definition: List[DocumentSplitPageRangeV2026R0], + *, + split_type: DocumentSplitCreateRequestManualV2026R0SplitTypeField = DocumentSplitCreateRequestManualV2026R0SplitTypeField.MANUAL, + version: Optional[DocumentSplitCreateRequestManualV2026R0VersionField] = None, + **kwargs + ): + """ + :param split_definition: Page ranges that define the split. Each entry produces one output file + containing the inclusive page range `[start, end]`. + :type split_definition: List[DocumentSplitPageRangeV2026R0] + :param split_type: Discriminator. Must be `manual` for this variant., defaults to DocumentSplitCreateRequestManualV2026R0SplitTypeField.MANUAL + :type split_type: DocumentSplitCreateRequestManualV2026R0SplitTypeField, optional + :param version: The version of the manual split input format. Omitted or `v_1` is the + legacy `split_definition` format. Existing clients may omit this field., defaults to None + :type version: Optional[DocumentSplitCreateRequestManualV2026R0VersionField], optional + """ + super().__init__(**kwargs) + self.split_definition = split_definition + self.split_type = split_type + self.version = version diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_create_request_page_selection_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_page_selection_v2026_r0.py new file mode 100644 index 000000000..b0939ceca --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_page_selection_v2026_r0.py @@ -0,0 +1,41 @@ +from enum import Enum + +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField(str, Enum): + PAGE_SELECTION = 'page_selection' + + +class DocumentSplitCreateRequestPageSelectionV2026R0VersionField(str, Enum): + V_2 = 'v_2' + + +class DocumentSplitCreateRequestPageSelectionV2026R0(BaseObject): + def __init__( + self, + page_selection: List[DocumentSplitPageSelectionItemV2026R0], + *, + split_type: DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField = DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField.PAGE_SELECTION, + version: Optional[ + DocumentSplitCreateRequestPageSelectionV2026R0VersionField + ] = None, + **kwargs + ): + """ + :param split_type: Discriminator. Must be `page_selection` for this variant., defaults to DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField.PAGE_SELECTION + :type split_type: DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField, optional + :param version: The version of the page selection input format. Optional. When provided + must be `v_2`., defaults to None + :type version: Optional[DocumentSplitCreateRequestPageSelectionV2026R0VersionField], optional + """ + super().__init__(**kwargs) + self.page_selection = page_selection + self.split_type = split_type + self.version = version diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_create_request_smart_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_smart_v2026_r0.py new file mode 100644 index 000000000..2eba97c60 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_smart_v2026_r0.py @@ -0,0 +1,28 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitCreateRequestSmartV2026R0SplitTypeField(str, Enum): + SMART = 'smart' + + +class DocumentSplitCreateRequestSmartV2026R0(BaseObject): + def __init__( + self, + prompt: str, + *, + split_type: DocumentSplitCreateRequestSmartV2026R0SplitTypeField = DocumentSplitCreateRequestSmartV2026R0SplitTypeField.SMART, + **kwargs + ): + """ + :param prompt: A natural language prompt that guides automatic page range detection. + :type prompt: str + :param split_type: Discriminator. Must be `smart` for this variant., defaults to DocumentSplitCreateRequestSmartV2026R0SplitTypeField.SMART + :type split_type: DocumentSplitCreateRequestSmartV2026R0SplitTypeField, optional + """ + super().__init__(**kwargs) + self.prompt = prompt + self.split_type = split_type diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_create_request_type_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_type_v2026_r0.py new file mode 100644 index 000000000..a3e625c68 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_type_v2026_r0.py @@ -0,0 +1,21 @@ +from typing import Union + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_manual_v2026_r0 import ( + DocumentSplitCreateRequestManualV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_page_selection_v2026_r0 import ( + DocumentSplitCreateRequestPageSelectionV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_smart_v2026_r0 import ( + DocumentSplitCreateRequestSmartV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +DocumentSplitCreateRequestTypeV2026R0 = Union[ + DocumentSplitCreateRequestManualV2026R0, + DocumentSplitCreateRequestPageSelectionV2026R0, + DocumentSplitCreateRequestSmartV2026R0, +] diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_create_request_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_v2026_r0.py new file mode 100644 index 000000000..beb7b4ca9 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_create_request_v2026_r0.py @@ -0,0 +1,63 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_manual_v2026_r0 import ( + DocumentSplitCreateRequestManualV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_page_selection_v2026_r0 import ( + DocumentSplitCreateRequestPageSelectionV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_smart_v2026_r0 import ( + DocumentSplitCreateRequestSmartV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_type_v2026_r0 import ( + DocumentSplitCreateRequestTypeV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitCreateRequestV2026R0InputSourceField(str, Enum): + API = 'api' + BOX = 'box' + RELAY = 'relay' + SALESFORCE = 'salesforce' + + +class DocumentSplitCreateRequestV2026R0(BaseObject): + def __init__( + self, + source_file_id: str, + destination_folder_id: str, + input_source: DocumentSplitCreateRequestV2026R0InputSourceField, + split_input: DocumentSplitCreateRequestTypeV2026R0, + *, + external_id: Optional[str] = None, + **kwargs + ): + """ + :param source_file_id: The ID of the source file to split. + :type source_file_id: str + :param destination_folder_id: The ID of the folder where the resulting files will be uploaded. + :type destination_folder_id: str + :param input_source: The system that initiated the request, used for analytics and + traceability. + :type input_source: DocumentSplitCreateRequestV2026R0InputSourceField + :param external_id: An optional identifier supplied by the caller for this Document Split job. + The value is returned on job responses for correlation only. It is not + a Box resource ID, is not required to be unique, and cannot be used to + look up the job., defaults to None + :type external_id: Optional[str], optional + """ + super().__init__(**kwargs) + self.source_file_id = source_file_id + self.destination_folder_id = destination_folder_id + self.input_source = input_source + self.split_input = split_input + self.external_id = external_id diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_create_response_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_create_response_v2026_r0.py new file mode 100644 index 000000000..a108bc993 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_create_response_v2026_r0.py @@ -0,0 +1,30 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitCreateResponseV2026R0TypeField(str, Enum): + DOCUMENT_SPLIT = 'document_split' + + +class DocumentSplitCreateResponseV2026R0(BaseObject): + _discriminator = 'type', {'document_split'} + + def __init__( + self, + id: str, + *, + type: DocumentSplitCreateResponseV2026R0TypeField = DocumentSplitCreateResponseV2026R0TypeField.DOCUMENT_SPLIT, + **kwargs + ): + """ + :param id: The unique identifier of the created Document Split job. + :type id: str + :param type: The value will always be `document_split`., defaults to DocumentSplitCreateResponseV2026R0TypeField.DOCUMENT_SPLIT + :type type: DocumentSplitCreateResponseV2026R0TypeField, optional + """ + super().__init__(**kwargs) + self.id = id + self.type = type diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_failures_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_failures_v2026_r0.py new file mode 100644 index 000000000..7250a1eb5 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_failures_v2026_r0.py @@ -0,0 +1,18 @@ +from typing import List + +from box_sdk_gen.schemas.v2026_r0.document_failures_v2026_r0 import ( + DocumentFailuresV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitFailuresV2026R0(DocumentFailuresV2026R0): + def __init__(self, errors: List[str], warnings: List[str], **kwargs): + """ + :param errors: A list of errors that occurred during the document job. + :type errors: List[str] + :param warnings: A list of warnings that occurred during the document job. + :type warnings: List[str] + """ + super().__init__(errors=errors, warnings=warnings, **kwargs) diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_output_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_output_v2026_r0.py new file mode 100644 index 000000000..f3c374c91 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_output_v2026_r0.py @@ -0,0 +1,37 @@ +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2026_r0.file_reference_v2026_r0 import FileReferenceV2026R0 + +from box_sdk_gen.schemas.v2026_r0.document_split_page_range_v2026_r0 import ( + DocumentSplitPageRangeV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitOutputV2026R0(BaseObject): + def __init__( + self, + *, + generated_files: Optional[List[FileReferenceV2026R0]] = None, + split_definition: Optional[List[DocumentSplitPageRangeV2026R0]] = None, + **kwargs + ): + """ + :param generated_files: References to the files that were created by the split., defaults to None + :type generated_files: Optional[List[FileReferenceV2026R0]], optional + :param split_definition: The page ranges that Box produced for a `smart` split. Each entry + corresponds to one generated file with the inclusive page range + `[start, end]`. Omitted or `null` for `manual` splits, where the + caller-supplied ranges are available in `split_input.split_definition`. + Omitted for `page_selection` splits, where the caller-supplied page + layout is available in `split_input.page_selection`., defaults to None + :type split_definition: Optional[List[DocumentSplitPageRangeV2026R0]], optional + """ + super().__init__(**kwargs) + self.generated_files = generated_files + self.split_definition = split_definition diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_page_range_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_page_range_v2026_r0.py new file mode 100644 index 000000000..0c7818e4e --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_page_range_v2026_r0.py @@ -0,0 +1,16 @@ +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitPageRangeV2026R0(BaseObject): + def __init__(self, start: int, end: int, **kwargs): + """ + :param start: The first page (inclusive) included in this slice. + :type start: int + :param end: The last page (inclusive) included in this slice. + :type end: int + """ + super().__init__(**kwargs) + self.start = start + self.end = end diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_item_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_item_v2026_r0.py new file mode 100644 index 000000000..3d6fb955b --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_item_v2026_r0.py @@ -0,0 +1,40 @@ +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_single_page_v2026_r0 import ( + DocumentSplitPageSelectionSinglePageV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_page_range_v2026_r0 import ( + DocumentSplitPageSelectionPageRangeV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_segment_v2026_r0 import ( + DocumentSplitPageSelectionSegmentV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitPageSelectionItemV2026R0(BaseObject): + def __init__( + self, + segments: List[DocumentSplitPageSelectionSegmentV2026R0], + *, + name: Optional[str] = None, + **kwargs + ): + """ + :param segments: An ordered list of page segments to include in this output file. Each + segment specifies either a single page or a contiguous page range. + :type segments: List[DocumentSplitPageSelectionSegmentV2026R0] + :param name: Optional name for the output file (without extension). When omitted the + system generates a sequential name based on the source file name., defaults to None + :type name: Optional[str], optional + """ + super().__init__(**kwargs) + self.segments = segments + self.name = name diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_page_range_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_page_range_v2026_r0.py new file mode 100644 index 000000000..d7b33e845 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_page_range_v2026_r0.py @@ -0,0 +1,34 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitPageSelectionPageRangeV2026R0TypeField(str, Enum): + PAGE_RANGE = 'page_range' + + +class DocumentSplitPageSelectionPageRangeV2026R0(BaseObject): + _discriminator = 'type', {'page_range'} + + def __init__( + self, + start: int, + end: int, + *, + type: DocumentSplitPageSelectionPageRangeV2026R0TypeField = DocumentSplitPageSelectionPageRangeV2026R0TypeField.PAGE_RANGE, + **kwargs + ): + """ + :param start: The first page (inclusive) included in this segment. + :type start: int + :param end: The last page (inclusive) included in this segment. + :type end: int + :param type: Discriminator. Must be `page_range` for this variant., defaults to DocumentSplitPageSelectionPageRangeV2026R0TypeField.PAGE_RANGE + :type type: DocumentSplitPageSelectionPageRangeV2026R0TypeField, optional + """ + super().__init__(**kwargs) + self.start = start + self.end = end + self.type = type diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_segment_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_segment_v2026_r0.py new file mode 100644 index 000000000..177922f7c --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_segment_v2026_r0.py @@ -0,0 +1,16 @@ +from typing import Union + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_single_page_v2026_r0 import ( + DocumentSplitPageSelectionSinglePageV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_page_selection_page_range_v2026_r0 import ( + DocumentSplitPageSelectionPageRangeV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +DocumentSplitPageSelectionSegmentV2026R0 = Union[ + DocumentSplitPageSelectionSinglePageV2026R0, + DocumentSplitPageSelectionPageRangeV2026R0, +] diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_single_page_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_single_page_v2026_r0.py new file mode 100644 index 000000000..e2fd2e21b --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_page_selection_single_page_v2026_r0.py @@ -0,0 +1,30 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitPageSelectionSinglePageV2026R0TypeField(str, Enum): + SINGLE_PAGE = 'single_page' + + +class DocumentSplitPageSelectionSinglePageV2026R0(BaseObject): + _discriminator = 'type', {'single_page'} + + def __init__( + self, + page: int, + *, + type: DocumentSplitPageSelectionSinglePageV2026R0TypeField = DocumentSplitPageSelectionSinglePageV2026R0TypeField.SINGLE_PAGE, + **kwargs + ): + """ + :param page: A single page number to include. + :type page: int + :param type: Discriminator. Must be `single_page` for this variant., defaults to DocumentSplitPageSelectionSinglePageV2026R0TypeField.SINGLE_PAGE + :type type: DocumentSplitPageSelectionSinglePageV2026R0TypeField, optional + """ + super().__init__(**kwargs) + self.page = page + self.type = type diff --git a/box_sdk_gen/schemas/v2026_r0/document_split_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_split_v2026_r0.py new file mode 100644 index 000000000..83667b8c6 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_split_v2026_r0.py @@ -0,0 +1,124 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_manual_v2026_r0 import ( + DocumentSplitCreateRequestManualV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_page_selection_v2026_r0 import ( + DocumentSplitCreateRequestPageSelectionV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_smart_v2026_r0 import ( + DocumentSplitCreateRequestSmartV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.file_reference_v2026_r0 import FileReferenceV2026R0 + +from box_sdk_gen.schemas.v2026_r0.document_split_create_request_type_v2026_r0 import ( + DocumentSplitCreateRequestTypeV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_output_v2026_r0 import ( + DocumentSplitOutputV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.folder_reference_v2026_r0 import ( + FolderReferenceV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.user_mini_v2026_r0 import UserMiniV2026R0 + +from box_sdk_gen.schemas.v2026_r0.enterprise_reference_v2026_r0 import ( + EnterpriseReferenceV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.document_split_failures_v2026_r0 import ( + DocumentSplitFailuresV2026R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +from box_sdk_gen.internal.utils import DateTime + + +class DocumentSplitV2026R0TypeField(str, Enum): + DOCUMENT_SPLIT = 'document_split' + + +class DocumentSplitV2026R0StatusField(str, Enum): + SUBMITTED = 'submitted' + COMPLETED = 'completed' + FAILED = 'failed' + COMPLETED_WITH_ERROR = 'completed_with_error' + + +class DocumentSplitV2026R0InputSourceField(str, Enum): + API = 'api' + BOX = 'box' + RELAY = 'relay' + SALESFORCE = 'salesforce' + + +class DocumentSplitV2026R0(BaseObject): + _discriminator = 'type', {'document_split'} + + def __init__( + self, + id: str, + source_file: FileReferenceV2026R0, + status: DocumentSplitV2026R0StatusField, + split_input: DocumentSplitCreateRequestTypeV2026R0, + destination_folder: FolderReferenceV2026R0, + input_source: DocumentSplitV2026R0InputSourceField, + *, + type: DocumentSplitV2026R0TypeField = DocumentSplitV2026R0TypeField.DOCUMENT_SPLIT, + output: Optional[DocumentSplitOutputV2026R0] = None, + created_at: Optional[DateTime] = None, + created_by: Optional[UserMiniV2026R0] = None, + enterprise: Optional[EnterpriseReferenceV2026R0] = None, + failures: Optional[DocumentSplitFailuresV2026R0] = None, + external_id: Optional[str] = None, + **kwargs + ): + """ + :param id: The unique identifier for the Document Split job. + :type id: str + :param status: The current state of the Document Split job. + :type status: DocumentSplitV2026R0StatusField + :param input_source: The system that initiated the request, used for analytics and + traceability. + :type input_source: DocumentSplitV2026R0InputSourceField + :param type: The value will always be `document_split`., defaults to DocumentSplitV2026R0TypeField.DOCUMENT_SPLIT + :type type: DocumentSplitV2026R0TypeField, optional + :param output: The result of the Document Split job. `null` until the job has produced + output., defaults to None + :type output: Optional[DocumentSplitOutputV2026R0], optional + :param created_at: When the Document Split job was created., defaults to None + :type created_at: Optional[DateTime], optional + :param failures: Errors and warnings that occurred during the document split. `null` when + no failures were recorded., defaults to None + :type failures: Optional[DocumentSplitFailuresV2026R0], optional + :param external_id: An optional identifier supplied by the caller when the Document Split + job was created. Returned for correlation only. It is not a Box + resource ID, is not required to be unique, and cannot be used to + look up the job., defaults to None + :type external_id: Optional[str], optional + """ + super().__init__(**kwargs) + self.id = id + self.source_file = source_file + self.status = status + self.split_input = split_input + self.destination_folder = destination_folder + self.input_source = input_source + self.type = type + self.output = output + self.created_at = created_at + self.created_by = created_by + self.enterprise = enterprise + self.failures = failures + self.external_id = external_id diff --git a/box_sdk_gen/schemas/v2026_r0/document_splits_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/document_splits_v2026_r0.py new file mode 100644 index 000000000..53e4018e0 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/document_splits_v2026_r0.py @@ -0,0 +1,34 @@ +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2026_r0.document_split_v2026_r0 import DocumentSplitV2026R0 + +from box_sdk_gen.box.errors import BoxSDKError + + +class DocumentSplitsV2026R0(BaseObject): + def __init__( + self, + *, + entries: Optional[List[DocumentSplitV2026R0]] = None, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + **kwargs + ): + """ + :param entries: A list of Document Split jobs., defaults to None + :type entries: Optional[List[DocumentSplitV2026R0]], optional + :param limit: The limit that was used for these entries. This will be the same as the + `limit` query parameter unless that value exceeded the maximum value + allowed. The maximum value varies by API., defaults to None + :type limit: Optional[int], optional + :param next_marker: The marker for the start of the next page of results., defaults to None + :type next_marker: Optional[str], optional + """ + super().__init__(**kwargs) + self.entries = entries + self.limit = limit + self.next_marker = next_marker diff --git a/box_sdk_gen/schemas/v2026_r0/enterprise_reference_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/enterprise_reference_v2026_r0.py new file mode 100644 index 000000000..bbf5bf89b --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/enterprise_reference_v2026_r0.py @@ -0,0 +1,30 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class EnterpriseReferenceV2026R0TypeField(str, Enum): + ENTERPRISE = 'enterprise' + + +class EnterpriseReferenceV2026R0(BaseObject): + _discriminator = 'type', {'enterprise'} + + def __init__( + self, + id: str, + *, + type: EnterpriseReferenceV2026R0TypeField = EnterpriseReferenceV2026R0TypeField.ENTERPRISE, + **kwargs + ): + """ + :param id: The unique identifier for this enterprise. + :type id: str + :param type: The value will always be `enterprise`., defaults to EnterpriseReferenceV2026R0TypeField.ENTERPRISE + :type type: EnterpriseReferenceV2026R0TypeField, optional + """ + super().__init__(**kwargs) + self.id = id + self.type = type diff --git a/box_sdk_gen/schemas/v2026_r0/file_reference_v2026_r0.py b/box_sdk_gen/schemas/v2026_r0/file_reference_v2026_r0.py new file mode 100644 index 000000000..4e85c2373 --- /dev/null +++ b/box_sdk_gen/schemas/v2026_r0/file_reference_v2026_r0.py @@ -0,0 +1,30 @@ +from enum import Enum + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class FileReferenceV2026R0TypeField(str, Enum): + FILE = 'file' + + +class FileReferenceV2026R0(BaseObject): + _discriminator = 'type', {'file'} + + def __init__( + self, + id: str, + *, + type: FileReferenceV2026R0TypeField = FileReferenceV2026R0TypeField.FILE, + **kwargs + ): + """ + :param id: ID of the file. + :type id: str + :param type: The value will always be `file`., defaults to FileReferenceV2026R0TypeField.FILE + :type type: FileReferenceV2026R0TypeField, optional + """ + super().__init__(**kwargs) + self.id = id + self.type = type diff --git a/box_sdk_gen/schemas/web_link.py b/box_sdk_gen/schemas/web_link.py index facbdf6a4..c165908e0 100644 --- a/box_sdk_gen/schemas/web_link.py +++ b/box_sdk_gen/schemas/web_link.py @@ -16,6 +16,10 @@ from box_sdk_gen.schemas.user_mini import UserMini +from box_sdk_gen.schemas.shared_link_otp_allowlist_entry import ( + SharedLinkOtpAllowlistEntry, +) + from box_sdk_gen.schemas.collection import Collection from box_sdk_gen.box.errors import BoxSDKError @@ -81,6 +85,45 @@ def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwar self.can_edit = can_edit +class WebLinkSharedLinkOneTimePasscodeField(BaseObject): + def __init__( + self, + mode: str, + *, + allowlist: Optional[List[SharedLinkOtpAllowlistEntry]] = None, + **kwargs + ): + """ + :param mode: The current OTP enforcement mode for the shared link. + + * `none` - OTP enforcement is turned off. The shared link is accessible + without any one-time-passcode verification. + * `open` - Any anonymous recipient can request a one-time-passcode to + any email address and access the shared link after verifying it. + Collaborators and registered Box users access the link without + being prompted. + * `allowlist` - Anonymous recipients can request a one-time-passcode + only when they enter an email that matches an entry on the + `allowlist`. + :type mode: str + :param allowlist: The list of email and domain entries that are permitted to access the + shared link when `mode` is `allowlist`. Anonymous users whose + email matches an entry can request and verify a one-time-passcode. + + Because the entries carry recipient email addresses and the identity + of the user who added them, this field is only returned to users + with owner, co-owner, or editor access on the item. For viewer + collaborators and below the field is omitted. + + An allowlist contains at most 1000 entries, matching the limit + enforced when setting the allowlist on a shared link., defaults to None + :type allowlist: Optional[List[SharedLinkOtpAllowlistEntry]], optional + """ + super().__init__(**kwargs) + self.mode = mode + self.allowlist = allowlist + + class WebLinkSharedLinkField(BaseObject): def __init__( self, @@ -90,6 +133,7 @@ def __init__( is_password_enabled: bool, download_count: int, preview_count: int, + one_time_passcode: WebLinkSharedLinkOneTimePasscodeField, *, download_url: Optional[str] = None, vanity_url: Optional[str] = None, @@ -160,6 +204,7 @@ def __init__( self.is_password_enabled = is_password_enabled self.download_count = download_count self.preview_count = preview_count + self.one_time_passcode = one_time_passcode self.download_url = download_url self.vanity_url = vanity_url self.vanity_name = vanity_name diff --git a/docs/box_sdk_gen/README.md b/docs/box_sdk_gen/README.md index 271ddc117..44b951b15 100644 --- a/docs/box_sdk_gen/README.md +++ b/docs/box_sdk_gen/README.md @@ -29,6 +29,7 @@ the SDK are available by topic: - [Device pinners](device_pinners.md) - [Docgen](docgen.md) - [Docgen template](docgen_template.md) +- [Document split](document_split.md) - [Downloads](downloads.md) - [Email aliases](email_aliases.md) - [Enterprise configurations](enterprise_configurations.md) diff --git a/docs/box_sdk_gen/document_split.md b/docs/box_sdk_gen/document_split.md new file mode 100644 index 000000000..b3cbaf4a0 --- /dev/null +++ b/docs/box_sdk_gen/document_split.md @@ -0,0 +1,109 @@ +# DocumentSplitManager + +- [Create Document Split job](#create-document-split-job) +- [List Document Split jobs](#list-document-split-jobs) +- [Get Document Split job by ID](#get-document-split-job-by-id) + +## Create Document Split job + +Initiates a Document Split job for the supplied source file. The job runs +asynchronously; clients can poll the returned job ID to track progress. + +All split-specific input lives under `split_input`. When +`split_input.split_type` is `manual`, provide +`split_input.split_definition` (continuous page ranges; `version` may be +omitted or `v_1`). When `split_input.split_type` is `page_selection`, +provide `split_input.page_selection` (non-linear page segments; `version` +may be omitted or `v_2`). `split_input.prompt` must not be provided for +either of those variants. When `split_input.split_type` is `smart`, +`split_input.prompt` is required and neither +`split_input.split_definition` nor `split_input.page_selection` must be +provided. + +This operation is performed by calling function `create_document_split_v2026_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/post-document-splits/). + +_Currently we don't have an example for calling `create_document_split_v2026_r0` in integration tests_ + +### Arguments + +- source_file_id `str` + - The ID of the source file to split. +- destination_folder_id `str` + - The ID of the folder where the resulting files will be uploaded. +- input_source `CreateDocumentSplitV2026R0InputSource` + - The system that initiated the request, used for analytics and traceability. +- split_input `DocumentSplitCreateRequestTypeV2026R0` + +- external_id `Optional[str]` + - An optional identifier supplied by the caller for this Document Split job. The value is returned on job responses for correlation only. It is not a Box resource ID, is not required to be unique, and cannot be used to look up the job. +- box_version `BoxVersionHeaderV2026R0` + - Version header. +- extra_headers `Optional[Dict[str, Optional[str]]]` + - Extra headers that will be included in the HTTP request. + +### Returns + +This function returns a value of type `DocumentSplitCreateResponseV2026R0`. + +The Document Split job was accepted for processing. Returns a reference +to the newly created job. + +## List Document Split jobs + +Returns a paginated list of Document Split jobs accessible to the +authenticated user. + +This operation is performed by calling function `get_document_splits_v2026_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/get-document-splits/). + +_Currently we don't have an example for calling `get_document_splits_v2026_r0` in integration tests_ + +### Arguments + +- marker `Optional[str]` + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. +- limit `Optional[int]` + - The maximum number of items to return per page. +- box_version `BoxVersionHeaderV2026R0` + - Version header. +- extra_headers `Optional[Dict[str, Optional[str]]]` + - Extra headers that will be included in the HTTP request. + +### Returns + +This function returns a value of type `DocumentSplitsV2026R0`. + +Returns a paginated list of Document Split jobs. + +## Get Document Split job by ID + +Returns details for a single Document Split job identified by its ID, +including the current status, the input definition, and any output files +produced by the job. + +This operation is performed by calling function `get_document_split_by_id_v2026_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/get-document-splits-id/). + +_Currently we don't have an example for calling `get_document_split_by_id_v2026_r0` in integration tests_ + +### Arguments + +- document_split_id `str` + - The unique identifier for the Document Split job. Example: "1748426" +- box_version `BoxVersionHeaderV2026R0` + - Version header. +- extra_headers `Optional[Dict[str, Optional[str]]]` + - Extra headers that will be included in the HTTP request. + +### Returns + +This function returns a value of type `DocumentSplitV2026R0`. + +Returns the Document Split job. diff --git a/docs/box_sdk_gen/users.md b/docs/box_sdk_gen/users.md index 530b636c6..70ff76ad1 100644 --- a/docs/box_sdk_gen/users.md +++ b/docs/box_sdk_gen/users.md @@ -285,6 +285,12 @@ still owns any content. To proceed, move their owned content first, or use the `force` parameter to delete the user and their files. +If the enterprise has a retention policy, including a retired one, or a +legal hold that is not fully released, you can't delete a user who owns +content, even with `force`. Transfer the user's content first by using the +[Transfer owned folders](https://developer.box.com/reference/put-users-id-folders-0) +endpoint. + This operation is performed by calling function `delete_user_by_id`. See the endpoint docs at @@ -303,7 +309,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. + - Specifies whether to delete the user even if they still own files. If the user owns content and the enterprise has a retention policy, including a retired one, or a legal hold that is not fully released, setting `force` to `true` doesn't delete the user. The request returns a `403` error, and you must transfer the user's content before deleting the user. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request.