Skip to content

Commit 5c21907

Browse files
fix: Make role parameter of update collaboration optional (box/box-openapi#557) (#1093)
1 parent 384751f commit 5c21907

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "9334953", "specHash": "62fdfd1", "version": "10.0.0" }
1+
{ "engineHash": "9334953", "specHash": "c7acada", "version": "10.0.0" }

box_sdk_gen/managers/user_collaborations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ def get_collaboration_by_id(
195195
def update_collaboration_by_id(
196196
self,
197197
collaboration_id: str,
198-
role: UpdateCollaborationByIdRole,
199198
*,
199+
role: Optional[UpdateCollaborationByIdRole] = None,
200200
status: Optional[UpdateCollaborationByIdStatus] = None,
201201
expires_at: Optional[DateTime] = None,
202202
can_view_path: Optional[bool] = None,
@@ -208,13 +208,13 @@ def update_collaboration_by_id(
208208
Can be used to change the owner of an item, or to
209209
210210
211-
accept collaboration invites.
211+
accept collaboration invites. In case of accepting collaboration invite, role is not required.
212212
213213
:param collaboration_id: The ID of the collaboration.
214214
Example: "1234"
215215
:type collaboration_id: str
216-
:param role: The level of access granted.
217-
:type role: UpdateCollaborationByIdRole
216+
:param role: The level of access granted., defaults to None
217+
:type role: Optional[UpdateCollaborationByIdRole], optional
218218
:param status: Set the status of a `pending` collaboration invitation,
219219
effectively accepting, or rejecting the invite., defaults to None
220220
:type status: Optional[UpdateCollaborationByIdStatus], optional

docs/user_collaborations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Returns a collaboration object.
3939

4040
Updates a collaboration.
4141
Can be used to change the owner of an item, or to
42-
accept collaboration invites.
42+
accept collaboration invites. In case of accepting collaboration invite, role is not required.
4343

4444
This operation is performed by calling function `update_collaboration_by_id`.
4545

@@ -50,15 +50,15 @@ See the endpoint docs at
5050

5151
```python
5252
client.user_collaborations.update_collaboration_by_id(
53-
collaboration_id, UpdateCollaborationByIdRole.VIEWER
53+
collaboration_id, role=UpdateCollaborationByIdRole.VIEWER
5454
)
5555
```
5656

5757
### Arguments
5858

5959
- collaboration_id `str`
6060
- The ID of the collaboration. Example: "1234"
61-
- role `UpdateCollaborationByIdRole`
61+
- role `Optional[UpdateCollaborationByIdRole]`
6262
- The level of access granted.
6363
- status `Optional[UpdateCollaborationByIdStatus]`
6464
- Set the status of a `pending` collaboration invitation, effectively accepting, or rejecting the invite.

test/user_collaborations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def testUserCollaborations():
6464
assert collaboration_from_api.invite_email == None
6565
updated_collaboration: Optional[Collaboration] = (
6666
client.user_collaborations.update_collaboration_by_id(
67-
collaboration_id, UpdateCollaborationByIdRole.VIEWER
67+
collaboration_id, role=UpdateCollaborationByIdRole.VIEWER
6868
)
6969
)
7070
assert to_string(updated_collaboration.role) == 'viewer'
@@ -94,7 +94,7 @@ def testConvertingUserCollaborationToOwnership():
9494
assert to_string(collaboration.role) == 'editor'
9595
owner_collaboration: Optional[Collaboration] = (
9696
client.user_collaborations.update_collaboration_by_id(
97-
collaboration.id, UpdateCollaborationByIdRole.OWNER
97+
collaboration.id, role=UpdateCollaborationByIdRole.OWNER
9898
)
9999
)
100100
assert owner_collaboration == None
@@ -133,7 +133,7 @@ def testExternalUserCollaborations():
133133
assert collaboration_from_api.invite_email == user_login
134134
updated_collaboration: Optional[Collaboration] = (
135135
client.user_collaborations.update_collaboration_by_id(
136-
collaboration_id, UpdateCollaborationByIdRole.VIEWER
136+
collaboration_id, role=UpdateCollaborationByIdRole.VIEWER
137137
)
138138
)
139139
assert to_string(updated_collaboration.role) == 'viewer'

0 commit comments

Comments
 (0)