Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "7c01dda", "specHash": "2bd751f", "version": "4.5.0" }
{ "engineHash": "e77f966", "specHash": "c8e3a85", "version": "4.5.0" }
5 changes: 5 additions & 0 deletions box_sdk_gen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
187 changes: 187 additions & 0 deletions box_sdk_gen/managers/hub_document.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion box_sdk_gen/managers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class SearchForContentContentTypes(str, Enum):
DESCRIPTION = 'description'
FILE_CONTENT = 'file_content'
COMMENTS = 'comments'
TAG = 'tag'
TAGS = 'tags'


class SearchForContentType(str, Enum):
Expand Down
3 changes: 3 additions & 0 deletions box_sdk_gen/managers/trashed_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 10 additions & 10 deletions box_sdk_gen/schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down Expand Up @@ -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 *
Expand Down Expand Up @@ -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 *
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/ai_single_agent_response_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@


class AiSingleAgentResponseFull(AiSingleAgentResponse):
_discriminator = 'type', {'ai_agent'}

def __init__(
self,
id: str,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def __init__(


class Comment(CommentBase):
_discriminator = 'type', {'comment'}

def __init__(
self,
*,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/comment_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@


class CommentFull(Comment):
_discriminator = 'type', {'comment'}

def __init__(
self,
*,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/conflict_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def __init__(self, *, conflicts: Optional[List[FileConflict]] = None, **kwargs):


class ConflictError(ClientError):
_discriminator = 'type', {'error'}

def __init__(
self,
*,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ class FileItemStatusField(str, Enum):


class File(FileMini):
_discriminator = 'type', {'file'}

def __init__(
self,
id: str,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/file_conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@


class FileConflict(FileMini):
_discriminator = 'type', {'file'}

def __init__(
self,
id: str,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/file_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ class FileFullSharedLinkPermissionOptionsField(str, Enum):


class FileFull(File):
_discriminator = 'type', {'file'}

def __init__(
self,
id: str,
Expand Down
1 change: 1 addition & 0 deletions box_sdk_gen/schemas/file_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class FileMini(FileBase):
'sha1': 'sha_1',
**FileBase._json_to_fields_mapping,
}
_discriminator = 'type', {'file'}

def __init__(
self,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/file_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@


class FileVersion(FileVersionMini):
_discriminator = 'type', {'file_version'}

def __init__(
self,
id: str,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/file_version_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@


class FileVersionFull(FileVersion):
_discriminator = 'type', {'file_version'}

def __init__(
self,
id: str,
Expand Down
1 change: 1 addition & 0 deletions box_sdk_gen/schemas/file_version_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FileVersionMini(FileVersionBase):
'sha1': 'sha_1',
**FileVersionBase._json_to_fields_mapping,
}
_discriminator = 'type', {'file_version'}

def __init__(
self,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ class FolderItemStatusField(str, Enum):


class Folder(FolderMini):
_discriminator = 'type', {'folder'}

def __init__(
self,
id: str,
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/folder_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def __init__(


class FolderFull(Folder):
_discriminator = 'type', {'folder'}

def __init__(
self,
id: str,
Expand Down
Loading
Loading