diff --git a/.codegen.json b/.codegen.json index 871c0b89..168441c6 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "7c01dda", "specHash": "2bd751f", "version": "10.5.0" } +{ "engineHash": "e77f966", "specHash": "c8e3a85", "version": "10.5.0" } diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py index f141a130..060a6249 100644 --- a/box_sdk_gen/client.py +++ b/box_sdk_gen/client.py @@ -184,6 +184,8 @@ from box_sdk_gen.managers.hub_items import HubItemsManager +from box_sdk_gen.managers.hub_document import HubDocumentManager + from box_sdk_gen.managers.shield_lists import ShieldListsManager from box_sdk_gen.managers.archives import ArchivesManager @@ -450,6 +452,9 @@ def __init__(self, auth: Authentication, *, network_session: NetworkSession = No self.hub_items = HubItemsManager( auth=self.auth, network_session=self.network_session ) + self.hub_document = HubDocumentManager( + auth=self.auth, network_session=self.network_session + ) self.shield_lists = ShieldListsManager( auth=self.auth, network_session=self.network_session ) diff --git a/box_sdk_gen/managers/__init__.py b/box_sdk_gen/managers/__init__.py index 9ab97dc3..fa6fecc2 100644 --- a/box_sdk_gen/managers/__init__.py +++ b/box_sdk_gen/managers/__init__.py @@ -156,6 +156,8 @@ from box_sdk_gen.managers.hub_items import * +from box_sdk_gen.managers.hub_document import * + from box_sdk_gen.managers.shield_lists import * from box_sdk_gen.managers.archives import * diff --git a/box_sdk_gen/managers/hub_document.py b/box_sdk_gen/managers/hub_document.py new file mode 100644 index 00000000..e5b80191 --- /dev/null +++ b/box_sdk_gen/managers/hub_document.py @@ -0,0 +1,187 @@ +from typing import Optional + +from typing import Dict + +from box_sdk_gen.internal.utils import to_string + +from box_sdk_gen.serialization.json import deserialize + +from box_sdk_gen.networking.fetch_options import ResponseFormat + +from box_sdk_gen.schemas.v2025_r0.hub_document_pages_v2025_r0 import ( + HubDocumentPagesV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0 + +from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import ( + BoxVersionHeaderV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_document_blocks_v2025_r0 import ( + HubDocumentBlocksV2025R0, +) + +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 HubDocumentManager: + def __init__( + self, + *, + auth: Optional[Authentication] = None, + network_session: NetworkSession = None + ): + if network_session is None: + network_session = NetworkSession() + self.auth = auth + self.network_session = network_session + + def get_hub_document_pages_v2025_r0( + self, + hub_id: str, + *, + marker: Optional[str] = None, + limit: Optional[int] = None, + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> HubDocumentPagesV2025R0: + """ + Retrieves a list of Hub Document Pages for the specified hub. + + Includes both root-level pages and sub pages. + + :param hub_id: The unique identifier that represent a hub. + + The ID for any hub can be determined + by visiting this hub in the web application + and copying the ID from the URL. For example, + for the URL `https://*.app.box.com/hubs/123` + the `hub_id` is `123`. + :type hub_id: str + :param marker: Defines the position marker at which to begin returning results. This is + used when paginating using marker-based pagination., 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 BoxVersionHeaderV2025R0._2025_0 + :type box_version: BoxVersionHeaderV2025R0, 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( + { + 'hub_id': to_string(hub_id), + '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/hub_document_pages'] + ), + 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, HubDocumentPagesV2025R0) + + def get_hub_document_blocks_v2025_r0( + self, + hub_id: str, + page_id: str, + *, + marker: Optional[str] = None, + limit: Optional[int] = None, + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> HubDocumentBlocksV2025R0: + """ + Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, excluding items. + + Blocks are hierarchically organized by their `parent_id`. + + + Blocks are sorted in order based on user specification in the user interface. + + + The response will only include content blocks that belong to the specified page. This will not include sub pages or sub page content blocks. + + :param hub_id: The unique identifier that represent a hub. + + The ID for any hub can be determined + by visiting this hub in the web application + and copying the ID from the URL. For example, + for the URL `https://*.app.box.com/hubs/123` + the `hub_id` is `123`. + :type hub_id: str + :param page_id: The unique identifier of a page within the Box Hub. + :type page_id: str + :param marker: Defines the position marker at which to begin returning results. This is + used when paginating using marker-based pagination., 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 BoxVersionHeaderV2025R0._2025_0 + :type box_version: BoxVersionHeaderV2025R0, 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( + { + 'hub_id': to_string(hub_id), + 'page_id': to_string(page_id), + '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/hub_document_blocks', + ] + ), + 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, HubDocumentBlocksV2025R0) diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py index dfb1a16d..cdfc76d8 100644 --- a/box_sdk_gen/managers/search.py +++ b/box_sdk_gen/managers/search.py @@ -93,7 +93,7 @@ class SearchForContentContentTypes(str, Enum): DESCRIPTION = 'description' FILE_CONTENT = 'file_content' COMMENTS = 'comments' - TAG = 'tag' + TAGS = 'tags' class SearchForContentType(str, Enum): diff --git a/box_sdk_gen/managers/trashed_items.py b/box_sdk_gen/managers/trashed_items.py index 242cd2ed..0b255117 100644 --- a/box_sdk_gen/managers/trashed_items.py +++ b/box_sdk_gen/managers/trashed_items.py @@ -92,6 +92,9 @@ def get_trashed_items( marker-based pagination using the `marker` parameter. + + The number of entries returned may be less than `total_count`. For example, if a user deletes items from a shared folder and is later removed as a collaborator, those deleted items will no longer appear in this endpoint’s results, even though they are still included in `total_count`. + :param fields: A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. diff --git a/box_sdk_gen/schemas/__init__.py b/box_sdk_gen/schemas/__init__.py index 5ed9f1f5..d43309f4 100644 --- a/box_sdk_gen/schemas/__init__.py +++ b/box_sdk_gen/schemas/__init__.py @@ -188,6 +188,8 @@ from box_sdk_gen.schemas.legal_hold_policy_mini import * +from box_sdk_gen.schemas.legal_hold_policy_assigned_item import * + from box_sdk_gen.schemas.legal_hold_policy_assignment_base import * from box_sdk_gen.schemas.metadata_base import * @@ -414,6 +416,14 @@ from box_sdk_gen.schemas.retention_policies import * +from box_sdk_gen.schemas.legal_hold_policy_assignment import * + +from box_sdk_gen.schemas.legal_hold_policy_assignments import * + +from box_sdk_gen.schemas.file_version_legal_hold import * + +from box_sdk_gen.schemas.file_version_legal_holds import * + from box_sdk_gen.schemas.legal_hold_policy import * from box_sdk_gen.schemas.legal_hold_policies import * @@ -520,16 +530,6 @@ from box_sdk_gen.schemas.folder import * -from box_sdk_gen.schemas.legal_hold_policy_assigned_item import * - -from box_sdk_gen.schemas.legal_hold_policy_assignment import * - -from box_sdk_gen.schemas.legal_hold_policy_assignments import * - -from box_sdk_gen.schemas.file_version_legal_hold import * - -from box_sdk_gen.schemas.file_version_legal_holds import * - from box_sdk_gen.schemas.folder_full import * from box_sdk_gen.schemas.search_result_with_shared_link_item import * diff --git a/box_sdk_gen/schemas/ai_single_agent_response_full.py b/box_sdk_gen/schemas/ai_single_agent_response_full.py index 1898fd5e..9086422a 100644 --- a/box_sdk_gen/schemas/ai_single_agent_response_full.py +++ b/box_sdk_gen/schemas/ai_single_agent_response_full.py @@ -28,6 +28,8 @@ class AiSingleAgentResponseFull(AiSingleAgentResponse): + _discriminator = 'type', {'ai_agent'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/comment.py b/box_sdk_gen/schemas/comment.py index a67ba328..de123786 100644 --- a/box_sdk_gen/schemas/comment.py +++ b/box_sdk_gen/schemas/comment.py @@ -29,6 +29,8 @@ def __init__( class Comment(CommentBase): + _discriminator = 'type', {'comment'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/comment_full.py b/box_sdk_gen/schemas/comment_full.py index 1b3b7b69..fcd69960 100644 --- a/box_sdk_gen/schemas/comment_full.py +++ b/box_sdk_gen/schemas/comment_full.py @@ -16,6 +16,8 @@ class CommentFull(Comment): + _discriminator = 'type', {'comment'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/conflict_error.py b/box_sdk_gen/schemas/conflict_error.py index 4ac1341c..a35298c4 100644 --- a/box_sdk_gen/schemas/conflict_error.py +++ b/box_sdk_gen/schemas/conflict_error.py @@ -28,6 +28,8 @@ def __init__(self, *, conflicts: Optional[List[FileConflict]] = None, **kwargs): class ConflictError(ClientError): + _discriminator = 'type', {'error'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/file.py b/box_sdk_gen/schemas/file.py index 2e9344e8..5eaacca2 100644 --- a/box_sdk_gen/schemas/file.py +++ b/box_sdk_gen/schemas/file.py @@ -175,6 +175,8 @@ class FileItemStatusField(str, Enum): class File(FileMini): + _discriminator = 'type', {'file'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/file_conflict.py b/box_sdk_gen/schemas/file_conflict.py index 5e88917f..32c99b40 100644 --- a/box_sdk_gen/schemas/file_conflict.py +++ b/box_sdk_gen/schemas/file_conflict.py @@ -12,6 +12,8 @@ class FileConflict(FileMini): + _discriminator = 'type', {'file'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/file_full.py b/box_sdk_gen/schemas/file_full.py index 3396821d..c9535978 100644 --- a/box_sdk_gen/schemas/file_full.py +++ b/box_sdk_gen/schemas/file_full.py @@ -414,6 +414,8 @@ class FileFullSharedLinkPermissionOptionsField(str, Enum): class FileFull(File): + _discriminator = 'type', {'file'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/file_mini.py b/box_sdk_gen/schemas/file_mini.py index c8b72f4e..39f09365 100644 --- a/box_sdk_gen/schemas/file_mini.py +++ b/box_sdk_gen/schemas/file_mini.py @@ -20,6 +20,7 @@ class FileMini(FileBase): 'sha1': 'sha_1', **FileBase._json_to_fields_mapping, } + _discriminator = 'type', {'file'} def __init__( self, diff --git a/box_sdk_gen/schemas/file_version.py b/box_sdk_gen/schemas/file_version.py index 3b213fb0..cb0c31ff 100644 --- a/box_sdk_gen/schemas/file_version.py +++ b/box_sdk_gen/schemas/file_version.py @@ -14,6 +14,8 @@ class FileVersion(FileVersionMini): + _discriminator = 'type', {'file_version'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/file_version_full.py b/box_sdk_gen/schemas/file_version_full.py index 7d778bd3..da5cc447 100644 --- a/box_sdk_gen/schemas/file_version_full.py +++ b/box_sdk_gen/schemas/file_version_full.py @@ -16,6 +16,8 @@ class FileVersionFull(FileVersion): + _discriminator = 'type', {'file_version'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/file_version_mini.py b/box_sdk_gen/schemas/file_version_mini.py index d4c03e4c..6a8fed8e 100644 --- a/box_sdk_gen/schemas/file_version_mini.py +++ b/box_sdk_gen/schemas/file_version_mini.py @@ -18,6 +18,7 @@ class FileVersionMini(FileVersionBase): 'sha1': 'sha_1', **FileVersionBase._json_to_fields_mapping, } + _discriminator = 'type', {'file_version'} def __init__( self, diff --git a/box_sdk_gen/schemas/folder.py b/box_sdk_gen/schemas/folder.py index a0330bec..87118100 100644 --- a/box_sdk_gen/schemas/folder.py +++ b/box_sdk_gen/schemas/folder.py @@ -209,6 +209,8 @@ class FolderItemStatusField(str, Enum): class Folder(FolderMini): + _discriminator = 'type', {'folder'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/folder_full.py b/box_sdk_gen/schemas/folder_full.py index b2594ff1..734d8ef9 100644 --- a/box_sdk_gen/schemas/folder_full.py +++ b/box_sdk_gen/schemas/folder_full.py @@ -157,6 +157,8 @@ def __init__( class FolderFull(Folder): + _discriminator = 'type', {'folder'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/folder_mini.py b/box_sdk_gen/schemas/folder_mini.py index 1e7d71a1..7339ceab 100644 --- a/box_sdk_gen/schemas/folder_mini.py +++ b/box_sdk_gen/schemas/folder_mini.py @@ -8,6 +8,8 @@ class FolderMini(FolderBase): + _discriminator = 'type', {'folder'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/group.py b/box_sdk_gen/schemas/group.py index fbb2fdc8..f2ff7299 100644 --- a/box_sdk_gen/schemas/group.py +++ b/box_sdk_gen/schemas/group.py @@ -14,6 +14,8 @@ class Group(GroupMini): + _discriminator = 'type', {'group'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/group_full.py b/box_sdk_gen/schemas/group_full.py index c0503abf..0dfcf75e 100644 --- a/box_sdk_gen/schemas/group_full.py +++ b/box_sdk_gen/schemas/group_full.py @@ -42,6 +42,8 @@ def __init__(self, *, can_invite_as_collaborator: Optional[bool] = None, **kwarg class GroupFull(Group): + _discriminator = 'type', {'group'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/group_mini.py b/box_sdk_gen/schemas/group_mini.py index a0557186..80b14b32 100644 --- a/box_sdk_gen/schemas/group_mini.py +++ b/box_sdk_gen/schemas/group_mini.py @@ -15,6 +15,8 @@ class GroupMiniGroupTypeField(str, Enum): class GroupMini(GroupBase): + _discriminator = 'type', {'group'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/integration_mapping.py b/box_sdk_gen/schemas/integration_mapping.py index be4efb56..8e38ffce 100644 --- a/box_sdk_gen/schemas/integration_mapping.py +++ b/box_sdk_gen/schemas/integration_mapping.py @@ -28,6 +28,8 @@ class IntegrationMappingIntegrationTypeField(str, Enum): class IntegrationMapping(IntegrationMappingBase): + _discriminator = 'type', {'integration_mapping'} + def __init__( self, partner_item: IntegrationMappingPartnerItemSlack, diff --git a/box_sdk_gen/schemas/integration_mapping_teams.py b/box_sdk_gen/schemas/integration_mapping_teams.py index d4df1faf..3c1dfc4f 100644 --- a/box_sdk_gen/schemas/integration_mapping_teams.py +++ b/box_sdk_gen/schemas/integration_mapping_teams.py @@ -22,6 +22,8 @@ class IntegrationMappingTeamsIntegrationTypeField(str, Enum): class IntegrationMappingTeams(IntegrationMappingBase): + _discriminator = 'type', {'integration_mapping'} + def __init__( self, partner_item: IntegrationMappingPartnerItemTeams, diff --git a/box_sdk_gen/schemas/legal_hold_policy.py b/box_sdk_gen/schemas/legal_hold_policy.py index f3e85921..84763fb3 100644 --- a/box_sdk_gen/schemas/legal_hold_policy.py +++ b/box_sdk_gen/schemas/legal_hold_policy.py @@ -58,6 +58,8 @@ def __init__( class LegalHoldPolicy(LegalHoldPolicyMini): + _discriminator = 'type', {'legal_hold_policy'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/legal_hold_policy_assigned_item.py b/box_sdk_gen/schemas/legal_hold_policy_assigned_item.py index b1c95018..77479f9a 100644 --- a/box_sdk_gen/schemas/legal_hold_policy_assigned_item.py +++ b/box_sdk_gen/schemas/legal_hold_policy_assigned_item.py @@ -1,11 +1,36 @@ -from typing import Union +from enum import Enum -from box_sdk_gen.schemas.file import File +from box_sdk_gen.internal.base_object import BaseObject -from box_sdk_gen.schemas.folder import Folder +from box_sdk_gen.box.errors import BoxSDKError -from box_sdk_gen.schemas.web_link import WebLink -from box_sdk_gen.box.errors import BoxSDKError +class LegalHoldPolicyAssignedItemTypeField(str, Enum): + FILE = 'file' + FILE_VERSION = 'file_version' + FOLDER = 'folder' + USER = 'user' + OWNERSHIP = 'ownership' + INTERACTIONS = 'interactions' + + +class LegalHoldPolicyAssignedItem(BaseObject): + _discriminator = 'type', { + 'file', + 'file_version', + 'folder', + 'user', + 'ownership', + 'interactions', + } -LegalHoldPolicyAssignedItem = Union[File, Folder, WebLink] + def __init__(self, type: LegalHoldPolicyAssignedItemTypeField, id: str, **kwargs): + """ + :param type: The type of item the policy is assigned to. + :type type: LegalHoldPolicyAssignedItemTypeField + :param id: The ID of the item the policy is assigned to. + :type id: str + """ + super().__init__(**kwargs) + self.type = type + self.id = id diff --git a/box_sdk_gen/schemas/legal_hold_policy_assignment.py b/box_sdk_gen/schemas/legal_hold_policy_assignment.py index 3b00d1af..b8221d9c 100644 --- a/box_sdk_gen/schemas/legal_hold_policy_assignment.py +++ b/box_sdk_gen/schemas/legal_hold_policy_assignment.py @@ -4,12 +4,6 @@ LegalHoldPolicyAssignmentBaseTypeField, ) -from box_sdk_gen.schemas.file import File - -from box_sdk_gen.schemas.folder import Folder - -from box_sdk_gen.schemas.web_link import WebLink - from box_sdk_gen.schemas.legal_hold_policy_assignment_base import ( LegalHoldPolicyAssignmentBase, ) @@ -28,6 +22,8 @@ class LegalHoldPolicyAssignment(LegalHoldPolicyAssignmentBase): + _discriminator = 'type', {'legal_hold_policy_assignment'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/retention_policy.py b/box_sdk_gen/schemas/retention_policy.py index 91f88409..0b7b929a 100644 --- a/box_sdk_gen/schemas/retention_policy.py +++ b/box_sdk_gen/schemas/retention_policy.py @@ -62,6 +62,8 @@ def __init__( class RetentionPolicy(RetentionPolicyMini): + _discriminator = 'type', {'retention_policy'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/retention_policy_mini.py b/box_sdk_gen/schemas/retention_policy_mini.py index ff8ad0b2..1980630e 100644 --- a/box_sdk_gen/schemas/retention_policy_mini.py +++ b/box_sdk_gen/schemas/retention_policy_mini.py @@ -15,6 +15,8 @@ class RetentionPolicyMiniDispositionActionField(str, Enum): class RetentionPolicyMini(RetentionPolicyBase): + _discriminator = 'type', {'retention_policy'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/shield_information_barrier_report.py b/box_sdk_gen/schemas/shield_information_barrier_report.py index 4701838e..b45403a8 100644 --- a/box_sdk_gen/schemas/shield_information_barrier_report.py +++ b/box_sdk_gen/schemas/shield_information_barrier_report.py @@ -33,6 +33,8 @@ class ShieldInformationBarrierReportStatusField(str, Enum): class ShieldInformationBarrierReport(ShieldInformationBarrierReportBase): + _discriminator = 'type', {'shield_information_barrier_report'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_member.py b/box_sdk_gen/schemas/shield_information_barrier_segment_member.py index 0a037bc8..74fa40d3 100644 --- a/box_sdk_gen/schemas/shield_information_barrier_segment_member.py +++ b/box_sdk_gen/schemas/shield_information_barrier_segment_member.py @@ -60,6 +60,8 @@ def __init__( class ShieldInformationBarrierSegmentMember(ShieldInformationBarrierSegmentMemberMini): + _discriminator = 'type', {'shield_information_barrier_segment_member'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_member_mini.py b/box_sdk_gen/schemas/shield_information_barrier_segment_member_mini.py index ef416af8..6ea3facc 100644 --- a/box_sdk_gen/schemas/shield_information_barrier_segment_member_mini.py +++ b/box_sdk_gen/schemas/shield_information_barrier_segment_member_mini.py @@ -16,6 +16,8 @@ class ShieldInformationBarrierSegmentMemberMini( ShieldInformationBarrierSegmentMemberBase ): + _discriminator = 'type', {'shield_information_barrier_segment_member'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_restriction.py b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction.py index 2715bcb3..62b91b62 100644 --- a/box_sdk_gen/schemas/shield_information_barrier_segment_restriction.py +++ b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction.py @@ -34,6 +34,8 @@ class ShieldInformationBarrierSegmentRestriction( ShieldInformationBarrierSegmentRestrictionMini ): + _discriminator = 'type', {'shield_information_barrier_segment_restriction'} + def __init__( self, shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField, diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_mini.py b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_mini.py index a84864fe..659d5ff6 100644 --- a/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_mini.py +++ b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_mini.py @@ -80,6 +80,8 @@ def __init__( class ShieldInformationBarrierSegmentRestrictionMini( ShieldInformationBarrierSegmentRestrictionBase ): + _discriminator = 'type', {'shield_information_barrier_segment_restriction'} + def __init__( self, shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField, diff --git a/box_sdk_gen/schemas/sign_request.py b/box_sdk_gen/schemas/sign_request.py index d07c8ec4..d8e052fa 100644 --- a/box_sdk_gen/schemas/sign_request.py +++ b/box_sdk_gen/schemas/sign_request.py @@ -64,6 +64,8 @@ def __init__( class SignRequest(SignRequestBase): + _discriminator = 'type', {'sign-request'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/sign_request_signer_input.py b/box_sdk_gen/schemas/sign_request_signer_input.py index 8218fbca..ffb7b1a1 100644 --- a/box_sdk_gen/schemas/sign_request_signer_input.py +++ b/box_sdk_gen/schemas/sign_request_signer_input.py @@ -85,6 +85,15 @@ class SignRequestSignerInputContentTypeField(str, Enum): class SignRequestSignerInput(SignRequestPrefillTag): + _discriminator = 'type', { + 'signature', + 'date', + 'text', + 'checkbox', + 'radio', + 'dropdown', + } + def __init__( self, page_index: int, diff --git a/box_sdk_gen/schemas/storage_policy.py b/box_sdk_gen/schemas/storage_policy.py index eb5e1cf3..541fb36a 100644 --- a/box_sdk_gen/schemas/storage_policy.py +++ b/box_sdk_gen/schemas/storage_policy.py @@ -8,6 +8,8 @@ class StoragePolicy(StoragePolicyMini): + _discriminator = 'type', {'storage_policy'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/template_signer_input.py b/box_sdk_gen/schemas/template_signer_input.py index 845999bc..fafc085e 100644 --- a/box_sdk_gen/schemas/template_signer_input.py +++ b/box_sdk_gen/schemas/template_signer_input.py @@ -120,6 +120,16 @@ def __init__( class TemplateSignerInput(SignRequestPrefillTag): + _discriminator = 'type', { + 'signature', + 'date', + 'text', + 'checkbox', + 'attachment', + 'radio', + 'dropdown', + } + def __init__( self, page_index: int, diff --git a/box_sdk_gen/schemas/terms_of_service.py b/box_sdk_gen/schemas/terms_of_service.py index f36ac992..55e47b01 100644 --- a/box_sdk_gen/schemas/terms_of_service.py +++ b/box_sdk_gen/schemas/terms_of_service.py @@ -53,6 +53,8 @@ class TermsOfServiceTosTypeField(str, Enum): class TermsOfService(TermsOfServiceBase): + _discriminator = 'type', {'terms_of_service'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/user.py b/box_sdk_gen/schemas/user.py index 8e98fec9..d21d62bb 100644 --- a/box_sdk_gen/schemas/user.py +++ b/box_sdk_gen/schemas/user.py @@ -42,6 +42,8 @@ def __init__( class User(UserMini): + _discriminator = 'type', {'user'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/user_collaborations.py b/box_sdk_gen/schemas/user_collaborations.py index 848ce597..056d1d02 100644 --- a/box_sdk_gen/schemas/user_collaborations.py +++ b/box_sdk_gen/schemas/user_collaborations.py @@ -8,6 +8,8 @@ class UserCollaborations(UserBase): + _discriminator = 'type', {'user'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/user_full.py b/box_sdk_gen/schemas/user_full.py index 6ae220de..e67367c4 100644 --- a/box_sdk_gen/schemas/user_full.py +++ b/box_sdk_gen/schemas/user_full.py @@ -61,6 +61,8 @@ def __init__( class UserFull(User): + _discriminator = 'type', {'user'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/user_integration_mappings.py b/box_sdk_gen/schemas/user_integration_mappings.py index 8e14d80f..326b43fe 100644 --- a/box_sdk_gen/schemas/user_integration_mappings.py +++ b/box_sdk_gen/schemas/user_integration_mappings.py @@ -8,6 +8,8 @@ class UserIntegrationMappings(UserBase): + _discriminator = 'type', {'user'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/user_mini.py b/box_sdk_gen/schemas/user_mini.py index e53d185b..738781fb 100644 --- a/box_sdk_gen/schemas/user_mini.py +++ b/box_sdk_gen/schemas/user_mini.py @@ -8,6 +8,8 @@ class UserMini(UserBase): + _discriminator = 'type', {'user'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/v2025_r0/__init__.py b/box_sdk_gen/schemas/v2025_r0/__init__.py index 64d7b89b..0a3bee19 100644 --- a/box_sdk_gen/schemas/v2025_r0/__init__.py +++ b/box_sdk_gen/schemas/v2025_r0/__init__.py @@ -70,6 +70,26 @@ from box_sdk_gen.schemas.v2025_r0.hub_create_request_v2025_r0 import * +from box_sdk_gen.schemas.v2025_r0.hub_document_block_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_section_title_text_block_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_paragraph_text_block_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_item_list_block_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_divider_block_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_callout_box_text_block_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_entry_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_document_blocks_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_document_page_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.hub_document_pages_v2025_r0 import * + from box_sdk_gen.schemas.v2025_r0.hub_item_v2025_r0 import * from box_sdk_gen.schemas.v2025_r0.hub_items_v2025_r0 import * diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py index 003e192b..59647623 100644 --- a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py @@ -32,6 +32,8 @@ class DocGenJobFullV2025R0(DocGenJobV2025R0): + _discriminator = 'type', {'docgen_job'} + def __init__( self, created_by: UserBaseV2025R0, diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py index dd1134d1..f1fbdadc 100644 --- a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py @@ -30,6 +30,8 @@ class DocGenJobV2025R0StatusField(str, Enum): class DocGenJobV2025R0(DocGenJobBaseV2025R0): + _discriminator = 'type', {'docgen_job'} + def __init__( self, batch: DocGenBatchBaseV2025R0, diff --git a/box_sdk_gen/schemas/v2025_r0/group_mini_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/group_mini_v2025_r0.py index 965e5e51..3e0bf110 100644 --- a/box_sdk_gen/schemas/v2025_r0/group_mini_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/group_mini_v2025_r0.py @@ -15,6 +15,8 @@ class GroupMiniV2025R0GroupTypeField(str, Enum): class GroupMiniV2025R0(GroupBaseV2025R0): + _discriminator = 'type', {'group'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py new file mode 100644 index 00000000..7eb5d872 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py @@ -0,0 +1,40 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_v2025_r0 import ( + HubDocumentBlockV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubCalloutBoxTextBlockV2025R0TypeField(str, Enum): + CALLOUT_BOX = 'callout_box' + + +class HubCalloutBoxTextBlockV2025R0(HubDocumentBlockV2025R0): + _discriminator = 'type', {'callout_box'} + + def __init__( + self, + fragment: str, + id: str, + *, + type: HubCalloutBoxTextBlockV2025R0TypeField = HubCalloutBoxTextBlockV2025R0TypeField.CALLOUT_BOX, + parent_id: Optional[str] = None, + **kwargs + ): + """ + :param fragment: Text content of the block. Includes rich text formatting. + :type fragment: str + :param id: The unique identifier for this block. + :type id: str + :param type: The type of this block. The value is always `callout_box`., defaults to HubCalloutBoxTextBlockV2025R0TypeField.CALLOUT_BOX + :type type: HubCalloutBoxTextBlockV2025R0TypeField, optional + :param parent_id: The unique identifier of the parent block. Null for direct children of the page., defaults to None + :type parent_id: Optional[str], optional + """ + super().__init__(id=id, parent_id=parent_id, **kwargs) + self.fragment = fragment + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/hub_collaboration_user_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_user_v2025_r0.py index cff4046c..f6563c88 100644 --- a/box_sdk_gen/schemas/v2025_r0/hub_collaboration_user_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_user_v2025_r0.py @@ -8,6 +8,8 @@ class HubCollaborationUserV2025R0(UserBaseV2025R0): + _discriminator = 'type', {'user'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py new file mode 100644 index 00000000..e4dad32a --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py @@ -0,0 +1,36 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_v2025_r0 import ( + HubDocumentBlockV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubDividerBlockV2025R0TypeField(str, Enum): + DIVIDER = 'divider' + + +class HubDividerBlockV2025R0(HubDocumentBlockV2025R0): + _discriminator = 'type', {'divider'} + + def __init__( + self, + id: str, + *, + type: HubDividerBlockV2025R0TypeField = HubDividerBlockV2025R0TypeField.DIVIDER, + parent_id: Optional[str] = None, + **kwargs + ): + """ + :param id: The unique identifier for this block. + :type id: str + :param type: The type of this block. The value is always `divider`., defaults to HubDividerBlockV2025R0TypeField.DIVIDER + :type type: HubDividerBlockV2025R0TypeField, optional + :param parent_id: The unique identifier of the parent block. Null for direct children of the page., defaults to None + :type parent_id: Optional[str], optional + """ + super().__init__(id=id, parent_id=parent_id, **kwargs) + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/hub_document_block_entry_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_document_block_entry_v2025_r0.py new file mode 100644 index 00000000..e7ef7e62 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_document_block_entry_v2025_r0.py @@ -0,0 +1,31 @@ +from typing import Union + +from box_sdk_gen.schemas.v2025_r0.hub_paragraph_text_block_v2025_r0 import ( + HubParagraphTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_section_title_text_block_v2025_r0 import ( + HubSectionTitleTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_callout_box_text_block_v2025_r0 import ( + HubCalloutBoxTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_item_list_block_v2025_r0 import ( + HubItemListBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_divider_block_v2025_r0 import ( + HubDividerBlockV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +HubDocumentBlockEntryV2025R0 = Union[ + HubParagraphTextBlockV2025R0, + HubSectionTitleTextBlockV2025R0, + HubCalloutBoxTextBlockV2025R0, + HubItemListBlockV2025R0, + HubDividerBlockV2025R0, +] diff --git a/box_sdk_gen/schemas/v2025_r0/hub_document_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_document_block_v2025_r0.py new file mode 100644 index 00000000..f9f829a7 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_document_block_v2025_r0.py @@ -0,0 +1,18 @@ +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubDocumentBlockV2025R0(BaseObject): + def __init__(self, id: str, *, parent_id: Optional[str] = None, **kwargs): + """ + :param id: The unique identifier for this block. + :type id: str + :param parent_id: The unique identifier of the parent block. Null for direct children of the page., defaults to None + :type parent_id: Optional[str], optional + """ + super().__init__(**kwargs) + self.id = id + self.parent_id = parent_id diff --git a/box_sdk_gen/schemas/v2025_r0/hub_document_blocks_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_document_blocks_v2025_r0.py new file mode 100644 index 00000000..58843acf --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_document_blocks_v2025_r0.py @@ -0,0 +1,68 @@ +from enum import Enum + +from typing import List + +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2025_r0.hub_paragraph_text_block_v2025_r0 import ( + HubParagraphTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_section_title_text_block_v2025_r0 import ( + HubSectionTitleTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_callout_box_text_block_v2025_r0 import ( + HubCalloutBoxTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_item_list_block_v2025_r0 import ( + HubItemListBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_divider_block_v2025_r0 import ( + HubDividerBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_entry_v2025_r0 import ( + HubDocumentBlockEntryV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubDocumentBlocksV2025R0TypeField(str, Enum): + DOCUMENT_BLOCKS = 'document_blocks' + + +class HubDocumentBlocksV2025R0(BaseObject): + _discriminator = 'type', {'document_blocks'} + + def __init__( + self, + entries: List[HubDocumentBlockEntryV2025R0], + *, + type: HubDocumentBlocksV2025R0TypeField = HubDocumentBlocksV2025R0TypeField.DOCUMENT_BLOCKS, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + **kwargs + ): + """ + :param entries: Ordered list of blocks. + :type entries: List[HubDocumentBlockEntryV2025R0] + :param type: The value will always be `document_blocks`., defaults to HubDocumentBlocksV2025R0TypeField.DOCUMENT_BLOCKS + :type type: HubDocumentBlocksV2025R0TypeField, 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.type = type + self.limit = limit + self.next_marker = next_marker diff --git a/box_sdk_gen/schemas/v2025_r0/hub_document_page_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_document_page_v2025_r0.py new file mode 100644 index 00000000..00129ce5 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_document_page_v2025_r0.py @@ -0,0 +1,32 @@ +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubDocumentPageV2025R0(BaseObject): + def __init__( + self, + id: str, + type: str, + title_fragment: str, + *, + parent_id: Optional[str] = None, + **kwargs + ): + """ + :param id: The unique identifier for this page. + :type id: str + :param type: The type of this resource. The value is always `page`. + :type type: str + :param title_fragment: The title text of the page. Includes rich text formatting. + :type title_fragment: str + :param parent_id: The unique identifier of the parent page. Null for root-level pages., defaults to None + :type parent_id: Optional[str], optional + """ + super().__init__(**kwargs) + self.id = id + self.type = type + self.title_fragment = title_fragment + self.parent_id = parent_id diff --git a/box_sdk_gen/schemas/v2025_r0/hub_document_pages_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_document_pages_v2025_r0.py new file mode 100644 index 00000000..210fdfa1 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_document_pages_v2025_r0.py @@ -0,0 +1,48 @@ +from enum import Enum + +from typing import List + +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2025_r0.hub_document_page_v2025_r0 import ( + HubDocumentPageV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubDocumentPagesV2025R0TypeField(str, Enum): + DOCUMENT_PAGES = 'document_pages' + + +class HubDocumentPagesV2025R0(BaseObject): + _discriminator = 'type', {'document_pages'} + + def __init__( + self, + entries: List[HubDocumentPageV2025R0], + *, + type: HubDocumentPagesV2025R0TypeField = HubDocumentPagesV2025R0TypeField.DOCUMENT_PAGES, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + **kwargs + ): + """ + :param entries: Ordered list of pages. + :type entries: List[HubDocumentPageV2025R0] + :param type: The value will always be `document_pages`., defaults to HubDocumentPagesV2025R0TypeField.DOCUMENT_PAGES + :type type: HubDocumentPagesV2025R0TypeField, 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.type = type + self.limit = limit + self.next_marker = next_marker diff --git a/box_sdk_gen/schemas/v2025_r0/hub_item_list_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_item_list_block_v2025_r0.py new file mode 100644 index 00000000..b0157988 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_item_list_block_v2025_r0.py @@ -0,0 +1,38 @@ +from enum import Enum + +from typing import Optional + +from typing import List + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_v2025_r0 import ( + HubDocumentBlockV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubItemListBlockV2025R0TypeField(str, Enum): + ITEM_LIST = 'item_list' + + +class HubItemListBlockV2025R0(HubDocumentBlockV2025R0): + _discriminator = 'type', {'item_list'} + + def __init__( + self, + id: str, + *, + type: HubItemListBlockV2025R0TypeField = HubItemListBlockV2025R0TypeField.ITEM_LIST, + parent_id: Optional[str] = None, + **kwargs + ): + """ + :param id: The unique identifier for this block. + :type id: str + :param type: The type of this block. The value is always `item_list`., defaults to HubItemListBlockV2025R0TypeField.ITEM_LIST + :type type: HubItemListBlockV2025R0TypeField, optional + :param parent_id: The unique identifier of the parent block. Null for direct children of the page., defaults to None + :type parent_id: Optional[str], optional + """ + super().__init__(id=id, parent_id=parent_id, **kwargs) + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/hub_item_operation_result_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_item_operation_result_v2025_r0.py index f1423d2c..7df54508 100644 --- a/box_sdk_gen/schemas/v2025_r0/hub_item_operation_result_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/hub_item_operation_result_v2025_r0.py @@ -25,6 +25,7 @@ def __init__( *, action: Optional[str] = None, item: Optional[HubItemReferenceV2025R0] = None, + parent_id: Optional[str] = None, status: Optional[int] = None, error: Optional[str] = None, **kwargs @@ -32,6 +33,8 @@ def __init__( """ :param action: The action performed on the item., defaults to None :type action: Optional[str], optional + :param parent_id: The ID of the parent block the item was added to., defaults to None + :type parent_id: Optional[str], optional :param status: The HTTP status code of the operation., defaults to None :type status: Optional[int], optional :param error: Error message if the operation failed., defaults to None @@ -40,5 +43,6 @@ def __init__( super().__init__(**kwargs) self.action = action self.item = item + self.parent_id = parent_id self.status = status self.error = error diff --git a/box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py new file mode 100644 index 00000000..215f37d3 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py @@ -0,0 +1,40 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_v2025_r0 import ( + HubDocumentBlockV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubParagraphTextBlockV2025R0TypeField(str, Enum): + PARAGRAPH = 'paragraph' + + +class HubParagraphTextBlockV2025R0(HubDocumentBlockV2025R0): + _discriminator = 'type', {'paragraph'} + + def __init__( + self, + fragment: str, + id: str, + *, + type: HubParagraphTextBlockV2025R0TypeField = HubParagraphTextBlockV2025R0TypeField.PARAGRAPH, + parent_id: Optional[str] = None, + **kwargs + ): + """ + :param fragment: Text content of the block. Includes rich text formatting. + :type fragment: str + :param id: The unique identifier for this block. + :type id: str + :param type: The type of this block. The value is always `paragraph`., defaults to HubParagraphTextBlockV2025R0TypeField.PARAGRAPH + :type type: HubParagraphTextBlockV2025R0TypeField, optional + :param parent_id: The unique identifier of the parent block. Null for direct children of the page., defaults to None + :type parent_id: Optional[str], optional + """ + super().__init__(id=id, parent_id=parent_id, **kwargs) + self.fragment = fragment + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/hub_section_title_text_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_section_title_text_block_v2025_r0.py new file mode 100644 index 00000000..6f6b95ef --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_section_title_text_block_v2025_r0.py @@ -0,0 +1,40 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_v2025_r0 import ( + HubDocumentBlockV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class HubSectionTitleTextBlockV2025R0TypeField(str, Enum): + SECTION_TITLE = 'section_title' + + +class HubSectionTitleTextBlockV2025R0(HubDocumentBlockV2025R0): + _discriminator = 'type', {'section_title'} + + def __init__( + self, + fragment: str, + id: str, + *, + type: HubSectionTitleTextBlockV2025R0TypeField = HubSectionTitleTextBlockV2025R0TypeField.SECTION_TITLE, + parent_id: Optional[str] = None, + **kwargs + ): + """ + :param fragment: Text content of the block. Includes rich text formatting. + :type fragment: str + :param id: The unique identifier for this block. + :type id: str + :param type: The type of this block. The value is always `section_title`., defaults to HubSectionTitleTextBlockV2025R0TypeField.SECTION_TITLE + :type type: HubSectionTitleTextBlockV2025R0TypeField, optional + :param parent_id: The unique identifier of the parent block. Null for direct children of the page., defaults to None + :type parent_id: Optional[str], optional + """ + super().__init__(id=id, parent_id=parent_id, **kwargs) + self.fragment = fragment + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py index e2559bba..3c77dc73 100644 --- a/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py @@ -12,6 +12,8 @@ class HubV2025R0(HubBaseV2025R0): + _discriminator = 'type', {'hubs'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/v2025_r0/user_mini_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/user_mini_v2025_r0.py index f9ef2188..aa2a2b49 100644 --- a/box_sdk_gen/schemas/v2025_r0/user_mini_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/user_mini_v2025_r0.py @@ -8,6 +8,8 @@ class UserMiniV2025R0(UserBaseV2025R0): + _discriminator = 'type', {'user'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/web_link.py b/box_sdk_gen/schemas/web_link.py index c85512f4..744df7c5 100644 --- a/box_sdk_gen/schemas/web_link.py +++ b/box_sdk_gen/schemas/web_link.py @@ -173,6 +173,8 @@ class WebLinkItemStatusField(str, Enum): class WebLink(WebLinkMini): + _discriminator = 'type', {'web_link'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/web_link_mini.py b/box_sdk_gen/schemas/web_link_mini.py index 8beb6585..fd887b10 100644 --- a/box_sdk_gen/schemas/web_link_mini.py +++ b/box_sdk_gen/schemas/web_link_mini.py @@ -8,6 +8,8 @@ class WebLinkMini(WebLinkBase): + _discriminator = 'type', {'web_link'} + def __init__( self, id: str, diff --git a/box_sdk_gen/schemas/webhook.py b/box_sdk_gen/schemas/webhook.py index 8163c7ee..a2fddb15 100644 --- a/box_sdk_gen/schemas/webhook.py +++ b/box_sdk_gen/schemas/webhook.py @@ -64,6 +64,8 @@ class WebhookTriggersField(str, Enum): class Webhook(WebhookMini): + _discriminator = 'type', {'webhook'} + def __init__( self, *, diff --git a/box_sdk_gen/schemas/workflow.py b/box_sdk_gen/schemas/workflow.py index 2d5ecc39..71606c42 100644 --- a/box_sdk_gen/schemas/workflow.py +++ b/box_sdk_gen/schemas/workflow.py @@ -259,6 +259,8 @@ def __init__( class Workflow(WorkflowMini): + _discriminator = 'type', {'workflow'} + def __init__( self, *, diff --git a/docs/README.md b/docs/README.md index c626b611..a97a2ce8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -48,6 +48,7 @@ the SDK are available by topic: - [Folders](folders.md) - [Groups](groups.md) - [Hub collaborations](hub_collaborations.md) +- [Hub document](hub_document.md) - [Hub items](hub_items.md) - [Hubs](hubs.md) - [Integration mappings](integration_mappings.md) diff --git a/docs/hub_document.md b/docs/hub_document.md new file mode 100644 index 00000000..9909ec2b --- /dev/null +++ b/docs/hub_document.md @@ -0,0 +1,79 @@ +# HubDocumentManager + +- [List Hub Document Pages](#list-hub-document-pages) +- [List Hub Document blocks for page](#list-hub-document-blocks-for-page) + +## List Hub Document Pages + +Retrieves a list of Hub Document Pages for the specified hub. +Includes both root-level pages and sub pages. + +This operation is performed by calling function `get_hub_document_pages_v2025_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-hub-document-pages/). + + + +```python +client.hub_document.get_hub_document_pages_v2025_r0(hub_id) +``` + +### Arguments + +- hub_id `str` + - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`. +- marker `Optional[str]` + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. +- limit `Optional[int]` + - The maximum number of items to return per page. +- box_version `BoxVersionHeaderV2025R0` + - 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 `HubDocumentPagesV2025R0`. + +Returns a Hub Document Pages response whose `entries` array contains root-level pages and sub pages. Includes pagination when more results are available. + +## List Hub Document blocks for page + +Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, excluding items. +Blocks are hierarchically organized by their `parent_id`. +Blocks are sorted in order based on user specification in the user interface. +The response will only include content blocks that belong to the specified page. This will not include sub pages or sub page content blocks. + +This operation is performed by calling function `get_hub_document_blocks_v2025_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-hub-document-blocks/). + + + +```python +client.hub_document.get_hub_document_blocks_v2025_r0(hub_id, page_id) +``` + +### Arguments + +- hub_id `str` + - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`. +- page_id `str` + - The unique identifier of a page within the Box Hub. +- marker `Optional[str]` + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. +- limit `Optional[int]` + - The maximum number of items to return per page. +- box_version `BoxVersionHeaderV2025R0` + - 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 `HubDocumentBlocksV2025R0`. + +Returns a Hub Document Blocks response whose `entries` array contains all content blocks of the specified page, except for items. +To retrieve items, use the `GET /hub_items` endpoint. diff --git a/docs/trashed_items.md b/docs/trashed_items.md index 22b41a27..c2ca2e9d 100644 --- a/docs/trashed_items.md +++ b/docs/trashed_items.md @@ -14,6 +14,8 @@ attributes that are not returned by default. This endpoint defaults to use offset-based pagination, yet also supports marker-based pagination using the `marker` parameter. +The number of entries returned may be less than `total_count`. For example, if a user deletes items from a shared folder and is later removed as a collaborator, those deleted items will no longer appear in this endpoint’s results, even though they are still included in `total_count`. + This operation is performed by calling function `get_trashed_items`. See the endpoint docs at diff --git a/test/hub_document.py b/test/hub_document.py new file mode 100644 index 00000000..e1294765 --- /dev/null +++ b/test/hub_document.py @@ -0,0 +1,71 @@ +from box_sdk_gen.internal.utils import to_string + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas.v2025_r0.hub_v2025_r0 import HubV2025R0 + +from box_sdk_gen.schemas.v2025_r0.hub_document_pages_v2025_r0 import ( + HubDocumentPagesV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_document_page_v2025_r0 import ( + HubDocumentPageV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_document_blocks_v2025_r0 import ( + HubDocumentBlocksV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_paragraph_text_block_v2025_r0 import ( + HubParagraphTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_section_title_text_block_v2025_r0 import ( + HubSectionTitleTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_callout_box_text_block_v2025_r0 import ( + HubCalloutBoxTextBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_item_list_block_v2025_r0 import ( + HubItemListBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_divider_block_v2025_r0 import ( + HubDividerBlockV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.hub_document_block_entry_v2025_r0 import ( + HubDocumentBlockEntryV2025R0, +) + +from test.commons import get_default_client_with_user_subject + +from box_sdk_gen.internal.utils import get_env_var + +from box_sdk_gen.internal.utils import get_uuid + +client: BoxClient = get_default_client_with_user_subject(get_env_var('USER_ID')) + + +def testGetHubDocumentPagesAndBlocks(): + hub_title: str = get_uuid() + created_hub: HubV2025R0 = client.hubs.create_hub_v2025_r0(hub_title) + hub_id: str = created_hub.id + pages: HubDocumentPagesV2025R0 = ( + client.hub_document.get_hub_document_pages_v2025_r0(hub_id) + ) + assert len(pages.entries) > 0 + assert to_string(pages.type) == 'document_pages' + first_page: HubDocumentPageV2025R0 = pages.entries[0] + assert to_string(first_page.type) == 'page' + page_id: str = first_page.id + blocks: HubDocumentBlocksV2025R0 = ( + client.hub_document.get_hub_document_blocks_v2025_r0(hub_id, page_id) + ) + assert to_string(blocks.type) == 'document_blocks' + assert len(blocks.entries) > 0 + first_block: HubDocumentBlockEntryV2025R0 = blocks.entries[0] + assert to_string(first_block.type) == 'item_list' + client.hubs.delete_hub_by_id_v2025_r0(hub_id)