From b1b71d5a5a37354a86d18aaaaa2abdde0fbf99e0 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 3 Oct 2025 01:43:42 -0700 Subject: [PATCH 1/3] test: Change ai and events tests to use fields instead of raw json (box/box-codegen#852) --- .codegen.json | 2 +- test/box_sdk_gen/test/ai.py | 40 +++++++++------------------------ test/box_sdk_gen/test/events.py | 1 + 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/.codegen.json b/.codegen.json index 4b37613c..fe7d150e 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "504b5a7", "specHash": "62fdfd1", "version": "0.1.0" } +{ "engineHash": "10c68c7", "specHash": "62fdfd1", "version": "0.1.0" } diff --git a/test/box_sdk_gen/test/ai.py b/test/box_sdk_gen/test/ai.py index 51c153c0..c040411f 100644 --- a/test/box_sdk_gen/test/ai.py +++ b/test/box_sdk_gen/test/ai.py @@ -328,21 +328,11 @@ def testAIExtractStructuredWithFields(): ], ai_agent=agent_ignoring_overriding_embeddings_model, ) - assert to_string( - get_value_from_object_raw_data(response, 'answer.hobby') - ) == to_string(['guitar']) - assert ( - to_string(get_value_from_object_raw_data(response, 'answer.firstName')) - == 'John' - ) - assert ( - to_string(get_value_from_object_raw_data(response, 'answer.lastName')) == 'Doe' - ) - assert ( - to_string(get_value_from_object_raw_data(response, 'answer.dateOfBirth')) - == '1990-07-04' - ) - assert to_string(get_value_from_object_raw_data(response, 'answer.age')) == '34' + assert to_string(response.answer.get('hobby')) == to_string(['guitar']) + assert to_string(response.answer.get('firstName')) == 'John' + assert to_string(response.answer.get('lastName')) == 'Doe' + assert to_string(response.answer.get('dateOfBirth')) == '1990-07-04' + assert to_string(response.answer.get('age')) == '34' assert response.completion_reason == 'done' client.files.delete_file_by_id(file.id) @@ -407,21 +397,11 @@ def testAIExtractStructuredWithMetadataTemplate(): template_key=template_key, scope='enterprise' ), ) - assert ( - to_string(get_value_from_object_raw_data(response, 'answer.firstName')) - == 'John' - ) - assert ( - to_string(get_value_from_object_raw_data(response, 'answer.lastName')) == 'Doe' - ) - assert ( - to_string(get_value_from_object_raw_data(response, 'answer.dateOfBirth')) - == '1990-07-04T00:00:00Z' - ) - assert to_string(get_value_from_object_raw_data(response, 'answer.age')) == '34' - assert to_string( - get_value_from_object_raw_data(response, 'answer.hobby') - ) == to_string(['guitar']) + assert to_string(response.answer.get('firstName')) == 'John' + assert to_string(response.answer.get('lastName')) == 'Doe' + assert to_string(response.answer.get('dateOfBirth')) == '1990-07-04T00:00:00Z' + assert to_string(response.answer.get('age')) == '34' + assert to_string(response.answer.get('hobby')) == to_string(['guitar']) assert response.completion_reason == 'done' client.metadata_templates.delete_metadata_template( DeleteMetadataTemplateScope.ENTERPRISE, template.template_key diff --git a/test/box_sdk_gen/test/events.py b/test/box_sdk_gen/test/events.py index 78c18fc9..4d63203f 100644 --- a/test/box_sdk_gen/test/events.py +++ b/test/box_sdk_gen/test/events.py @@ -53,6 +53,7 @@ def testEventUpload(): assert len(events.entries) > 0 first_event: Event = events.entries[0] assert to_string(first_event.event_type) == 'UPLOAD' + assert to_string(first_event.additional_details.get('hash_type')) == 'sha1' source: EventSource = first_event.source assert ( to_string(source.item_type) == 'file' or to_string(source.item_type) == 'folder' From 450bf3a29a3f59f57097a78e822bef82c03cf67b Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 3 Oct 2025 01:46:01 -0700 Subject: [PATCH 2/3] chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index fe7d150e..6796debb 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "10c68c7", "specHash": "62fdfd1", "version": "0.1.0" } +{ "engineHash": "9334953", "specHash": "62fdfd1", "version": "0.1.0" } From c8a5336b1b2f3206a2972197e999822dd659c0a1 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 3 Oct 2025 02:43:43 -0700 Subject: [PATCH 3/3] fix: Make parameter of update collaboration optional (box/box-openapi#557) --- .codegen.json | 2 +- box_sdk_gen/managers/user_collaborations.py | 8 ++++---- docs/box_sdk_gen/user_collaborations.md | 6 +++--- test/box_sdk_gen/test/user_collaborations.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.codegen.json b/.codegen.json index 6796debb..969671a2 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "9334953", "specHash": "62fdfd1", "version": "0.1.0" } +{ "engineHash": "9334953", "specHash": "c7acada", "version": "0.1.0" } diff --git a/box_sdk_gen/managers/user_collaborations.py b/box_sdk_gen/managers/user_collaborations.py index 10641f06..5b6b0e34 100644 --- a/box_sdk_gen/managers/user_collaborations.py +++ b/box_sdk_gen/managers/user_collaborations.py @@ -195,8 +195,8 @@ def get_collaboration_by_id( def update_collaboration_by_id( self, collaboration_id: str, - role: UpdateCollaborationByIdRole, *, + role: Optional[UpdateCollaborationByIdRole] = None, status: Optional[UpdateCollaborationByIdStatus] = None, expires_at: Optional[DateTime] = None, can_view_path: Optional[bool] = None, @@ -208,13 +208,13 @@ def update_collaboration_by_id( Can be used to change the owner of an item, or to - accept collaboration invites. + accept collaboration invites. In case of accepting collaboration invite, role is not required. :param collaboration_id: The ID of the collaboration. Example: "1234" :type collaboration_id: str - :param role: The level of access granted. - :type role: UpdateCollaborationByIdRole + :param role: The level of access granted., defaults to None + :type role: Optional[UpdateCollaborationByIdRole], optional :param status: Set the status of a `pending` collaboration invitation, effectively accepting, or rejecting the invite., defaults to None :type status: Optional[UpdateCollaborationByIdStatus], optional diff --git a/docs/box_sdk_gen/user_collaborations.md b/docs/box_sdk_gen/user_collaborations.md index bc7dc9f3..a6ea7e60 100644 --- a/docs/box_sdk_gen/user_collaborations.md +++ b/docs/box_sdk_gen/user_collaborations.md @@ -39,7 +39,7 @@ Returns a collaboration object. Updates a collaboration. Can be used to change the owner of an item, or to -accept collaboration invites. +accept collaboration invites. In case of accepting collaboration invite, role is not required. This operation is performed by calling function `update_collaboration_by_id`. @@ -49,14 +49,14 @@ See the endpoint docs at ```python -client.user_collaborations.update_collaboration_by_id(collaboration_id, UpdateCollaborationByIdRole.VIEWER) +client.user_collaborations.update_collaboration_by_id(collaboration_id, role=UpdateCollaborationByIdRole.VIEWER) ``` ### Arguments - collaboration_id `str` - The ID of the collaboration. Example: "1234" -- role `UpdateCollaborationByIdRole` +- role `Optional[UpdateCollaborationByIdRole]` - The level of access granted. - status `Optional[UpdateCollaborationByIdStatus]` - Set the status of a `pending` collaboration invitation, effectively accepting, or rejecting the invite. diff --git a/test/box_sdk_gen/test/user_collaborations.py b/test/box_sdk_gen/test/user_collaborations.py index 498c5089..ed7bde67 100644 --- a/test/box_sdk_gen/test/user_collaborations.py +++ b/test/box_sdk_gen/test/user_collaborations.py @@ -64,7 +64,7 @@ def testUserCollaborations(): assert collaboration_from_api.invite_email == None updated_collaboration: Optional[Collaboration] = ( client.user_collaborations.update_collaboration_by_id( - collaboration_id, UpdateCollaborationByIdRole.VIEWER + collaboration_id, role=UpdateCollaborationByIdRole.VIEWER ) ) assert to_string(updated_collaboration.role) == 'viewer' @@ -94,7 +94,7 @@ def testConvertingUserCollaborationToOwnership(): assert to_string(collaboration.role) == 'editor' owner_collaboration: Optional[Collaboration] = ( client.user_collaborations.update_collaboration_by_id( - collaboration.id, UpdateCollaborationByIdRole.OWNER + collaboration.id, role=UpdateCollaborationByIdRole.OWNER ) ) assert owner_collaboration == None @@ -133,7 +133,7 @@ def testExternalUserCollaborations(): assert collaboration_from_api.invite_email == user_login updated_collaboration: Optional[Collaboration] = ( client.user_collaborations.update_collaboration_by_id( - collaboration_id, UpdateCollaborationByIdRole.VIEWER + collaboration_id, role=UpdateCollaborationByIdRole.VIEWER ) ) assert to_string(updated_collaboration.role) == 'viewer'