From 612fd33d07f0805ae5d5889ad6536f44876aaae6 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 17 Mar 2026 05:40:58 -0700 Subject: [PATCH 1/2] feat: Add Hub Document API (box/box-openapi#587) --- .codegen.json | 2 +- box_sdk_gen/client.py | 5 + box_sdk_gen/managers/__init__.py | 2 + box_sdk_gen/managers/hub_document.py | 187 ++++++++++++++++++ box_sdk_gen/managers/hubs.py | 4 + box_sdk_gen/schemas/v2025_r0/__init__.py | 20 ++ .../hub_callout_box_text_block_v2025_r0.py | 38 ++++ .../v2025_r0/hub_divider_block_v2025_r0.py | 34 ++++ .../hub_document_block_entry_v2025_r0.py | 31 +++ .../v2025_r0/hub_document_block_v2025_r0.py | 18 ++ .../v2025_r0/hub_document_blocks_v2025_r0.py | 68 +++++++ .../v2025_r0/hub_document_page_v2025_r0.py | 32 +++ .../v2025_r0/hub_document_pages_v2025_r0.py | 48 +++++ .../v2025_r0/hub_item_list_block_v2025_r0.py | 36 ++++ .../hub_paragraph_text_block_v2025_r0.py | 38 ++++ .../hub_section_title_text_block_v2025_r0.py | 38 ++++ .../v2025_r0/hub_update_request_v2025_r0.py | 4 + box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py | 4 + docs/box_sdk_gen/README.md | 1 + docs/box_sdk_gen/hub_document.md | 71 +++++++ docs/box_sdk_gen/hubs.md | 2 + 21 files changed, 682 insertions(+), 1 deletion(-) create mode 100644 box_sdk_gen/managers/hub_document.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_block_entry_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_block_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_blocks_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_page_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_pages_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_item_list_block_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/hub_section_title_text_block_v2025_r0.py create mode 100644 docs/box_sdk_gen/hub_document.md diff --git a/.codegen.json b/.codegen.json index 0a1f67b1d..f7f81b96f 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "bc04b80", "specHash": "f2523d5", "version": "4.4.0" } +{ "engineHash": "bc04b80", "specHash": "57b3004", "version": "4.4.0" } diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py index f141a1306..060a6249b 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 9ab97dc30..fa6fecc26 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 000000000..e5b80191b --- /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/hubs.py b/box_sdk_gen/managers/hubs.py index 47669e810..26e34bca1 100644 --- a/box_sdk_gen/managers/hubs.py +++ b/box_sdk_gen/managers/hubs.py @@ -303,6 +303,7 @@ def update_hub_by_id_v2025_r0( is_collaboration_restricted_to_enterprise: Optional[bool] = None, can_non_owners_invite: Optional[bool] = None, can_shared_link_be_created: Optional[bool] = None, + can_public_shared_link_be_created: Optional[bool] = None, box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> HubV2025R0: @@ -329,6 +330,8 @@ def update_hub_by_id_v2025_r0( :type can_non_owners_invite: Optional[bool], optional :param can_shared_link_be_created: Indicates if a shared link can be created for the Box Hub., defaults to None :type can_shared_link_be_created: Optional[bool], optional + :param can_public_shared_link_be_created: Indicates if a public shared link can be created for the Box Hub., defaults to None + :type can_public_shared_link_be_created: Optional[bool], 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 @@ -345,6 +348,7 @@ def update_hub_by_id_v2025_r0( ), 'can_non_owners_invite': can_non_owners_invite, 'can_shared_link_be_created': can_shared_link_be_created, + 'can_public_shared_link_be_created': can_public_shared_link_be_created, } headers_map: Dict[str, str] = prepare_params( {'box-version': to_string(box_version), **extra_headers} diff --git a/box_sdk_gen/schemas/v2025_r0/__init__.py b/box_sdk_gen/schemas/v2025_r0/__init__.py index 64d7b89b1..0a3bee194 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/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 000000000..e48e7eac2 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py @@ -0,0 +1,38 @@ +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): + 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_divider_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py new file mode 100644 index 000000000..e0bd8470a --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py @@ -0,0 +1,34 @@ +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): + 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 000000000..e7ef7e628 --- /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 000000000..f9f829a7a --- /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 000000000..58843acfb --- /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 000000000..00129ce5e --- /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 000000000..210fdfa1e --- /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 000000000..d9328832c --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_item_list_block_v2025_r0.py @@ -0,0 +1,36 @@ +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): + 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_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 000000000..6da8f0a64 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py @@ -0,0 +1,38 @@ +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): + 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 000000000..93f931c9e --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/hub_section_title_text_block_v2025_r0.py @@ -0,0 +1,38 @@ +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): + 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_update_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_update_request_v2025_r0.py index 67a29953d..cf120b7cd 100644 --- a/box_sdk_gen/schemas/v2025_r0/hub_update_request_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/hub_update_request_v2025_r0.py @@ -15,6 +15,7 @@ def __init__( is_collaboration_restricted_to_enterprise: Optional[bool] = None, can_non_owners_invite: Optional[bool] = None, can_shared_link_be_created: Optional[bool] = None, + can_public_shared_link_be_created: Optional[bool] = None, **kwargs ): """ @@ -30,6 +31,8 @@ def __init__( :type can_non_owners_invite: Optional[bool], optional :param can_shared_link_be_created: Indicates if a shared link can be created for the Box Hub., defaults to None :type can_shared_link_be_created: Optional[bool], optional + :param can_public_shared_link_be_created: Indicates if a public shared link can be created for the Box Hub., defaults to None + :type can_public_shared_link_be_created: Optional[bool], optional """ super().__init__(**kwargs) self.title = title @@ -40,3 +43,4 @@ def __init__( ) self.can_non_owners_invite = can_non_owners_invite self.can_shared_link_be_created = can_shared_link_be_created + self.can_public_shared_link_be_created = can_public_shared_link_be_created 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 51ed529aa..e2559bba4 100644 --- a/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py @@ -27,6 +27,7 @@ def __init__( is_collaboration_restricted_to_enterprise: Optional[bool] = None, can_non_owners_invite: Optional[bool] = None, can_shared_link_be_created: Optional[bool] = None, + can_public_shared_link_be_created: Optional[bool] = None, type: HubBaseV2025R0TypeField = HubBaseV2025R0TypeField.HUBS, **kwargs ): @@ -59,6 +60,8 @@ def __init__( :type can_non_owners_invite: Optional[bool], optional :param can_shared_link_be_created: Indicates if a shared link can be created for the Box Hub., defaults to None :type can_shared_link_be_created: Optional[bool], optional + :param can_public_shared_link_be_created: Indicates if a public shared link can be created for the Box Hub., defaults to None + :type can_public_shared_link_be_created: Optional[bool], optional :param type: The value will always be `hubs`., defaults to HubBaseV2025R0TypeField.HUBS :type type: HubBaseV2025R0TypeField, optional """ @@ -76,3 +79,4 @@ def __init__( ) self.can_non_owners_invite = can_non_owners_invite self.can_shared_link_be_created = can_shared_link_be_created + self.can_public_shared_link_be_created = can_public_shared_link_be_created diff --git a/docs/box_sdk_gen/README.md b/docs/box_sdk_gen/README.md index c626b6118..a97a2ce83 100644 --- a/docs/box_sdk_gen/README.md +++ b/docs/box_sdk_gen/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/box_sdk_gen/hub_document.md b/docs/box_sdk_gen/hub_document.md new file mode 100644 index 000000000..f6cb42c03 --- /dev/null +++ b/docs/box_sdk_gen/hub_document.md @@ -0,0 +1,71 @@ +# 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/). + +_Currently we don't have an example for calling `get_hub_document_pages_v2025_r0` in integration tests_ + +### 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/). + +_Currently we don't have an example for calling `get_hub_document_blocks_v2025_r0` in integration tests_ + +### 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/box_sdk_gen/hubs.md b/docs/box_sdk_gen/hubs.md index 2c492a2bb..77a9a10d0 100644 --- a/docs/box_sdk_gen/hubs.md +++ b/docs/box_sdk_gen/hubs.md @@ -182,6 +182,8 @@ client.hubs.update_hub_by_id_v2025_r0(hub_id, title=new_hub_title, description=n - Indicates if non-owners can invite others to the Box Hub. - can_shared_link_be_created `Optional[bool]` - Indicates if a shared link can be created for the Box Hub. +- can_public_shared_link_be_created `Optional[bool]` + - Indicates if a public shared link can be created for the Box Hub. - box_version `BoxVersionHeaderV2025R0` - Version header. - extra_headers `Optional[Dict[str, Optional[str]]]` From a479e5c74e918de697eb96e89bcdb431f6292139 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Wed, 18 Mar 2026 06:44:17 -0700 Subject: [PATCH 2/2] test: temporarily remove new hubs endpoints (box/box-codegen#928) --- .codegen.json | 2 +- box_sdk_gen/client.py | 5 - box_sdk_gen/managers/__init__.py | 2 - box_sdk_gen/managers/hub_document.py | 187 ------------------ box_sdk_gen/schemas/v2025_r0/__init__.py | 20 -- .../hub_callout_box_text_block_v2025_r0.py | 38 ---- .../v2025_r0/hub_divider_block_v2025_r0.py | 34 ---- .../hub_document_block_entry_v2025_r0.py | 31 --- .../v2025_r0/hub_document_block_v2025_r0.py | 18 -- .../v2025_r0/hub_document_blocks_v2025_r0.py | 68 ------- .../v2025_r0/hub_document_page_v2025_r0.py | 32 --- .../v2025_r0/hub_document_pages_v2025_r0.py | 48 ----- .../v2025_r0/hub_item_list_block_v2025_r0.py | 36 ---- .../hub_paragraph_text_block_v2025_r0.py | 38 ---- .../hub_section_title_text_block_v2025_r0.py | 38 ---- docs/box_sdk_gen/README.md | 1 - docs/box_sdk_gen/hub_document.md | 71 ------- 17 files changed, 1 insertion(+), 668 deletions(-) delete mode 100644 box_sdk_gen/managers/hub_document.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_block_entry_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_block_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_blocks_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_page_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_document_pages_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_item_list_block_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py delete mode 100644 box_sdk_gen/schemas/v2025_r0/hub_section_title_text_block_v2025_r0.py delete mode 100644 docs/box_sdk_gen/hub_document.md diff --git a/.codegen.json b/.codegen.json index f7f81b96f..4d1ad5dab 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "bc04b80", "specHash": "57b3004", "version": "4.4.0" } +{ "engineHash": "65f6eab", "specHash": "57b3004", "version": "4.4.0" } diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py index 060a6249b..f141a1306 100644 --- a/box_sdk_gen/client.py +++ b/box_sdk_gen/client.py @@ -184,8 +184,6 @@ 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 @@ -452,9 +450,6 @@ 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 fa6fecc26..9ab97dc30 100644 --- a/box_sdk_gen/managers/__init__.py +++ b/box_sdk_gen/managers/__init__.py @@ -156,8 +156,6 @@ 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 deleted file mode 100644 index e5b80191b..000000000 --- a/box_sdk_gen/managers/hub_document.py +++ /dev/null @@ -1,187 +0,0 @@ -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/schemas/v2025_r0/__init__.py b/box_sdk_gen/schemas/v2025_r0/__init__.py index 0a3bee194..64d7b89b1 100644 --- a/box_sdk_gen/schemas/v2025_r0/__init__.py +++ b/box_sdk_gen/schemas/v2025_r0/__init__.py @@ -70,26 +70,6 @@ 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/hub_callout_box_text_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py deleted file mode 100644 index e48e7eac2..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_callout_box_text_block_v2025_r0.py +++ /dev/null @@ -1,38 +0,0 @@ -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): - 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_divider_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py deleted file mode 100644 index e0bd8470a..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_divider_block_v2025_r0.py +++ /dev/null @@ -1,34 +0,0 @@ -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): - 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 deleted file mode 100644 index e7ef7e628..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_document_block_entry_v2025_r0.py +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index f9f829a7a..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_document_block_v2025_r0.py +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 58843acfb..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_document_blocks_v2025_r0.py +++ /dev/null @@ -1,68 +0,0 @@ -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 deleted file mode 100644 index 00129ce5e..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_document_page_v2025_r0.py +++ /dev/null @@ -1,32 +0,0 @@ -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 deleted file mode 100644 index 210fdfa1e..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_document_pages_v2025_r0.py +++ /dev/null @@ -1,48 +0,0 @@ -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 deleted file mode 100644 index d9328832c..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_item_list_block_v2025_r0.py +++ /dev/null @@ -1,36 +0,0 @@ -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): - 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_paragraph_text_block_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py deleted file mode 100644 index 6da8f0a64..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_paragraph_text_block_v2025_r0.py +++ /dev/null @@ -1,38 +0,0 @@ -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): - 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 deleted file mode 100644 index 93f931c9e..000000000 --- a/box_sdk_gen/schemas/v2025_r0/hub_section_title_text_block_v2025_r0.py +++ /dev/null @@ -1,38 +0,0 @@ -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): - 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/docs/box_sdk_gen/README.md b/docs/box_sdk_gen/README.md index a97a2ce83..c626b6118 100644 --- a/docs/box_sdk_gen/README.md +++ b/docs/box_sdk_gen/README.md @@ -48,7 +48,6 @@ 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/box_sdk_gen/hub_document.md b/docs/box_sdk_gen/hub_document.md deleted file mode 100644 index f6cb42c03..000000000 --- a/docs/box_sdk_gen/hub_document.md +++ /dev/null @@ -1,71 +0,0 @@ -# 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/). - -_Currently we don't have an example for calling `get_hub_document_pages_v2025_r0` in integration tests_ - -### 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/). - -_Currently we don't have an example for calling `get_hub_document_blocks_v2025_r0` in integration tests_ - -### 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.