Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.
Merged
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": "fe7a2b2", "specHash": "eaa9cf0", "version": "1.15.0" }
{ "engineHash": "66d6f32", "specHash": "eaa9cf0", "version": "1.15.0" }
2 changes: 1 addition & 1 deletion box_sdk_gen/managers/hub_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_hub_items_v2025_r0(
)
return deserialize(response.data, HubItemsV2025R0)

def create_hub_manage_item_v2025_r0(
def manage_hub_items_v2025_r0(
self,
hub_id: str,
*,
Expand Down
2 changes: 1 addition & 1 deletion box_sdk_gen/managers/hubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def delete_hub_by_id_v2025_r0(
)
return None

def create_hub_copy_v2025_r0(
def copy_hub_v2025_r0(
self,
hub_id: str,
*,
Expand Down
22 changes: 19 additions & 3 deletions docs/hub_items.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ This operation is performed by calling function `get_hub_items_v2025_r0`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/get-hub-items/).

_Currently we don't have an example for calling `get_hub_items_v2025_r0` in integration tests_
<!-- sample get_hub_items_v2025.0 -->

```python
client.hub_items.get_hub_items_v2025_r0(created_hub.id)
```

### Arguments

Expand All @@ -37,12 +41,24 @@ Retrieves the items associated with the specified Hub.

Adds and/or removes Hub items from a Hub.

This operation is performed by calling function `create_hub_manage_item_v2025_r0`.
This operation is performed by calling function `manage_hub_items_v2025_r0`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/post-hubs-id-manage-items/).

_Currently we don't have an example for calling `create_hub_manage_item_v2025_r0` in integration tests_
<!-- sample post_hubs_id_manage_items_v2025.0 -->

```python
client.hub_items.manage_hub_items_v2025_r0(
created_hub.id,
operations=[
HubItemOperationV2025R0(
action=HubItemOperationV2025R0ActionField.ADD,
item=FolderReferenceV2025R0(id=folder.id),
)
],
)
```

### Arguments

Expand Down
28 changes: 22 additions & 6 deletions docs/hubs.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ This operation is performed by calling function `create_hub_v2025_r0`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/post-hubs/).

_Currently we don't have an example for calling `create_hub_v2025_r0` in integration tests_
<!-- sample post_hubs_v2025.0 -->

```python
client.hubs.create_hub_v2025_r0(hub_title, description=hub_description)
```

### Arguments

Expand Down Expand Up @@ -133,7 +137,7 @@ See the endpoint docs at
<!-- sample get_hubs_id_v2025.0 -->

```python
client.hubs.get_hub_by_id_v2025_r0(user_hub.id)
client.hubs.get_hub_by_id_v2025_r0(hub_id)
```

### Arguments
Expand All @@ -160,7 +164,13 @@ This operation is performed by calling function `update_hub_by_id_v2025_r0`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/put-hubs-id/).

_Currently we don't have an example for calling `update_hub_by_id_v2025_r0` in integration tests_
<!-- sample put_hubs_id_v2025.0 -->

```python
client.hubs.update_hub_by_id_v2025_r0(
hub_id, title=new_hub_title, description=new_hub_description
)
```

### Arguments

Expand Down Expand Up @@ -201,7 +211,7 @@ See the endpoint docs at
<!-- sample delete_hubs_id_v2025.0 -->

```python
client.hubs.delete_hub_by_id_v2025_r0(hub.id)
client.hubs.delete_hub_by_id_v2025_r0(hub_id)
```

### Arguments
Expand All @@ -226,12 +236,18 @@ Creates a copy of a Hub.

The original Hub will not be modified.

This operation is performed by calling function `create_hub_copy_v2025_r0`.
This operation is performed by calling function `copy_hub_v2025_r0`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/post-hubs-id-copy/).

_Currently we don't have an example for calling `create_hub_copy_v2025_r0` in integration tests_
<!-- sample post_hubs_id_copy_v2025.0 -->

```python
client.hubs.copy_hub_v2025_r0(
created_hub.id, title=copied_hub_title, description=copied_hub_description
)
```

### Arguments

Expand Down
93 changes: 93 additions & 0 deletions test/hub_items.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.client import BoxClient

from box_sdk_gen.schemas.folder_full import FolderFull

from box_sdk_gen.managers.folders import CreateFolderParent

from box_sdk_gen.schemas.v2025_r0.hub_v2025_r0 import HubV2025R0

from box_sdk_gen.schemas.v2025_r0.hub_items_v2025_r0 import HubItemsV2025R0

from box_sdk_gen.schemas.v2025_r0.hub_items_manage_response_v2025_r0 import (
HubItemsManageResponseV2025R0,
)

from box_sdk_gen.schemas.v2025_r0.hub_item_operation_v2025_r0 import (
HubItemOperationV2025R0,
)

from box_sdk_gen.schemas.v2025_r0.hub_item_operation_v2025_r0 import (
HubItemOperationV2025R0ActionField,
)

from box_sdk_gen.schemas.v2025_r0.hub_item_operation_result_v2025_r0 import (
HubItemOperationResultV2025R0,
)

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

from box_sdk_gen.schemas.v2025_r0.folder_reference_v2025_r0 import (
FolderReferenceV2025R0,
)

client: BoxClient = get_default_client_with_user_subject(get_env_var('USER_ID'))


def testCreateDeleteGetHubItems():
hub_title: str = get_uuid()
folder: FolderFull = client.folders.create_folder(
get_uuid(), CreateFolderParent(id='0')
)
created_hub: HubV2025R0 = client.hubs.create_hub_v2025_r0(hub_title)
hub_items_before_add: HubItemsV2025R0 = client.hub_items.get_hub_items_v2025_r0(
created_hub.id
)
assert len(hub_items_before_add.entries) == 0
added_hub_items: HubItemsManageResponseV2025R0 = (
client.hub_items.manage_hub_items_v2025_r0(
created_hub.id,
operations=[
HubItemOperationV2025R0(
action=HubItemOperationV2025R0ActionField.ADD,
item=FolderReferenceV2025R0(id=folder.id),
)
],
)
)
added_hub_item: HubItemOperationResultV2025R0 = added_hub_items.operations[0]
assert to_string(added_hub_item.action) == 'add'
assert added_hub_item.status == 200
assert added_hub_item.item.id == folder.id
assert added_hub_item.item.type == 'folder'
hub_items_after_add: HubItemsV2025R0 = client.hub_items.get_hub_items_v2025_r0(
created_hub.id
)
assert len(hub_items_after_add.entries) == 1
removed_hub_items: HubItemsManageResponseV2025R0 = (
client.hub_items.manage_hub_items_v2025_r0(
created_hub.id,
operations=[
HubItemOperationV2025R0(
action=HubItemOperationV2025R0ActionField.REMOVE,
item=FolderReferenceV2025R0(id=folder.id),
)
],
)
)
removed_hub_item: HubItemOperationResultV2025R0 = removed_hub_items.operations[0]
assert to_string(removed_hub_item.action) == 'remove'
assert removed_hub_item.status == 200
assert removed_hub_item.item.id == folder.id
assert removed_hub_item.item.type == 'folder'
hub_items_after_remove: HubItemsV2025R0 = client.hub_items.get_hub_items_v2025_r0(
created_hub.id
)
assert len(hub_items_after_remove.entries) == 0
client.hubs.delete_hub_by_id_v2025_r0(created_hub.id)
client.folders.delete_folder_by_id(folder.id)
70 changes: 51 additions & 19 deletions test/hubs.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,74 @@
from box_sdk_gen.internal.utils import to_string

import pytest

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.hubs_v2025_r0 import HubsV2025R0

from box_sdk_gen.managers.hubs import GetHubsV2025R0Direction

from box_sdk_gen.schemas.v2025_r0.hub_v2025_r0 import HubV2025R0

from box_sdk_gen.managers.hubs import GetEnterpriseHubsV2025R0Direction

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 testGetAndDeleteHubs():
user_hubs: HubsV2025R0 = client.hubs.get_hubs_v2025_r0(
def testCreateUpdateGetAndDeleteHubs():
hub_title: str = get_uuid()
hub_description: str = 'new Hub description'
created_hub: HubV2025R0 = client.hubs.create_hub_v2025_r0(
hub_title, description=hub_description
)
assert created_hub.title == hub_title
assert created_hub.description == hub_description
assert to_string(created_hub.type) == 'hubs'
hub_id: str = created_hub.id
users_hubs: HubsV2025R0 = client.hubs.get_hubs_v2025_r0(
scope='all', sort='name', direction=GetHubsV2025R0Direction.ASC
)
assert len(user_hubs.entries) > 0
user_hub: HubV2025R0 = user_hubs.entries[0]
assert not user_hub.title == ''
assert not user_hub.id == ''
assert to_string(user_hub.type) == 'hubs'
assert len(users_hubs.entries) > 0
enterprise_hubs: HubsV2025R0 = client.hubs.get_enterprise_hubs_v2025_r0(
sort='name', direction=GetEnterpriseHubsV2025R0Direction.ASC
)
assert len(enterprise_hubs.entries) > 0
enterprise_hub: HubV2025R0 = enterprise_hubs.entries[0]
assert not enterprise_hub.title == ''
assert not enterprise_hub.id == ''
assert to_string(enterprise_hub.type) == 'hubs'
hub: HubV2025R0 = client.hubs.get_hub_by_id_v2025_r0(user_hub.id)
assert not hub.title == ''
assert not hub.id == ''
assert to_string(hub.type) == 'hubs'
if len(enterprise_hubs.entries) > 10:
client.hubs.delete_hub_by_id_v2025_r0(hub.id)
hub_by_id: HubV2025R0 = client.hubs.get_hub_by_id_v2025_r0(hub_id)
assert hub_by_id.id == hub_id
assert hub_by_id.title == hub_title
assert hub_by_id.description == hub_description
assert to_string(hub_by_id.type) == 'hubs'
new_hub_title: str = get_uuid()
new_hub_description: str = 'updated Hub description'
updated_hub: HubV2025R0 = client.hubs.update_hub_by_id_v2025_r0(
hub_id, title=new_hub_title, description=new_hub_description
)
assert updated_hub.title == new_hub_title
assert updated_hub.description == new_hub_description
client.hubs.delete_hub_by_id_v2025_r0(hub_id)
with pytest.raises(Exception):
client.hubs.delete_hub_by_id_v2025_r0(hub_id)


def copyHub():
hub_title: str = get_uuid()
hub_description: str = 'new Hub description'
created_hub: HubV2025R0 = client.hubs.create_hub_v2025_r0(
hub_title, description=hub_description
)
copied_hub_title: str = get_uuid()
copied_hub_description: str = 'copied Hub description'
copied_hub: HubV2025R0 = client.hubs.copy_hub_v2025_r0(
created_hub.id, title=copied_hub_title, description=copied_hub_description
)
assert not copied_hub.id == created_hub.id
assert copied_hub.title == copied_hub_title
assert copied_hub.description == copied_hub_description
client.hubs.delete_hub_by_id_v2025_r0(created_hub.id)
client.hubs.delete_hub_by_id_v2025_r0(copied_hub.id)
Loading