Skip to content

Commit 0d45fed

Browse files
fix: update collaboration, metadata and collection resources (box/box-openapi#483) (#380)
1 parent 4245a36 commit 0d45fed

14 files changed

+211
-83
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "6ae899a", "specHash": "c2c76f3", "version": "1.7.0" }
1+
{ "engineHash": "6ae899a", "specHash": "6d5f53e", "version": "1.7.0" }

box_sdk_gen/managers/collections.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from box_sdk_gen.schemas.client_error import ClientError
1414

15-
from box_sdk_gen.schemas.items import Items
15+
from box_sdk_gen.schemas.items_offset_paginated import ItemsOffsetPaginated
1616

1717
from box_sdk_gen.schemas.collection import Collection
1818

@@ -119,7 +119,7 @@ def get_collection_items(
119119
offset: Optional[int] = None,
120120
limit: Optional[int] = None,
121121
extra_headers: Optional[Dict[str, Optional[str]]] = None
122-
) -> Items:
122+
) -> ItemsOffsetPaginated:
123123
"""
124124
Retrieves the files and/or folders contained within
125125
@@ -177,7 +177,7 @@ def get_collection_items(
177177
network_session=self.network_session,
178178
)
179179
)
180-
return deserialize(response.data, Items)
180+
return deserialize(response.data, ItemsOffsetPaginated)
181181

182182
def get_collection_by_id(
183183
self,

box_sdk_gen/managers/list_collaborations.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
from box_sdk_gen.schemas.client_error import ClientError
1616

17+
from box_sdk_gen.schemas.collaborations_offset_paginated import (
18+
CollaborationsOffsetPaginated,
19+
)
20+
1721
from box_sdk_gen.networking.auth import Authentication
1822

1923
from box_sdk_gen.networking.network import NetworkSession
@@ -132,6 +136,8 @@ def get_folder_collaborations(
132136
folder_id: str,
133137
*,
134138
fields: Optional[List[str]] = None,
139+
limit: Optional[int] = None,
140+
marker: Optional[str] = None,
135141
extra_headers: Optional[Dict[str, Optional[str]]] = None
136142
) -> Collaborations:
137143
"""
@@ -161,12 +167,25 @@ def get_folder_collaborations(
161167
fields for the mini representation are returned, additional
162168
to the fields requested., defaults to None
163169
:type fields: Optional[List[str]], optional
170+
:param limit: The maximum number of items to return per page., defaults to None
171+
:type limit: Optional[int], optional
172+
:param marker: Defines the position marker at which to begin returning results. This is
173+
used when paginating using marker-based pagination.
174+
175+
This requires `usemarker` to be set to `true`., defaults to None
176+
:type marker: Optional[str], optional
164177
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
165178
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
166179
"""
167180
if extra_headers is None:
168181
extra_headers = {}
169-
query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
182+
query_params_map: Dict[str, str] = prepare_params(
183+
{
184+
'fields': to_string(fields),
185+
'limit': to_string(limit),
186+
'marker': to_string(marker),
187+
}
188+
)
170189
headers_map: Dict[str, str] = prepare_params({**extra_headers})
171190
response: FetchResponse = fetch(
172191
FetchOptions(
@@ -196,7 +215,7 @@ def get_collaborations(
196215
offset: Optional[int] = None,
197216
limit: Optional[int] = None,
198217
extra_headers: Optional[Dict[str, Optional[str]]] = None
199-
) -> Collaborations:
218+
) -> CollaborationsOffsetPaginated:
200219
"""
201220
Retrieves all pending collaboration invites for this user.
202221
:param status: The status of the collaborations to retrieve
@@ -246,7 +265,7 @@ def get_collaborations(
246265
network_session=self.network_session,
247266
)
248267
)
249-
return deserialize(response.data, Collaborations)
268+
return deserialize(response.data, CollaborationsOffsetPaginated)
250269

251270
def get_group_collaborations(
252271
self,
@@ -255,7 +274,7 @@ def get_group_collaborations(
255274
limit: Optional[int] = None,
256275
offset: Optional[int] = None,
257276
extra_headers: Optional[Dict[str, Optional[str]]] = None
258-
) -> Collaborations:
277+
) -> CollaborationsOffsetPaginated:
259278
"""
260279
Retrieves all the collaborations for a group. The user
261280
@@ -305,4 +324,4 @@ def get_group_collaborations(
305324
network_session=self.network_session,
306325
)
307326
)
308-
return deserialize(response.data, Collaborations)
327+
return deserialize(response.data, CollaborationsOffsetPaginated)

box_sdk_gen/managers/metadata_templates.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,22 +232,35 @@ def get_metadata_templates_by_instance_id(
232232
self,
233233
metadata_instance_id: str,
234234
*,
235+
marker: Optional[str] = None,
236+
limit: Optional[int] = None,
235237
extra_headers: Optional[Dict[str, Optional[str]]] = None
236238
) -> MetadataTemplates:
237239
"""
238-
Finds a metadata template by searching for the ID of an instance of the
240+
Finds a metadata template by searching for the ID of an instance of the
241+
242+
template.
239243
240-
template.
244+
:param metadata_instance_id: The ID of an instance of the metadata template to find.
245+
:type metadata_instance_id: str
246+
:param marker: Defines the position marker at which to begin returning results. This is
247+
used when paginating using marker-based pagination.
241248
242-
:param metadata_instance_id: The ID of an instance of the metadata template to find.
243-
:type metadata_instance_id: str
244-
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
245-
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
249+
This requires `usemarker` to be set to `true`., defaults to None
250+
:type marker: Optional[str], optional
251+
:param limit: The maximum number of items to return per page., defaults to None
252+
:type limit: Optional[int], optional
253+
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
254+
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
246255
"""
247256
if extra_headers is None:
248257
extra_headers = {}
249258
query_params_map: Dict[str, str] = prepare_params(
250-
{'metadata_instance_id': to_string(metadata_instance_id)}
259+
{
260+
'metadata_instance_id': to_string(metadata_instance_id),
261+
'marker': to_string(marker),
262+
'limit': to_string(limit),
263+
}
251264
)
252265
headers_map: Dict[str, str] = prepare_params({**extra_headers})
253266
response: FetchResponse = fetch(

box_sdk_gen/schemas/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@
386386

387387
from box_sdk_gen.schemas.web_link import *
388388

389+
from box_sdk_gen.schemas.items_offset_paginated import *
390+
389391
from box_sdk_gen.schemas.items import *
390392

391393
from box_sdk_gen.schemas.folder import *
@@ -420,6 +422,8 @@
420422

421423
from box_sdk_gen.schemas.collaboration import *
422424

425+
from box_sdk_gen.schemas.collaborations_offset_paginated import *
426+
423427
from box_sdk_gen.schemas.collaborations import *
424428

425429
from box_sdk_gen.schemas.app_item_association import *

box_sdk_gen/schemas/collaboration.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ def __init__(
7878
):
7979
"""
8080
:param enterprise_has_strong_password_required_for_external_users: Whether or not the enterprise that owns the content requires
81-
a strong password to collaborate on the content., defaults to None
81+
a strong password to collaborate on the content, or enforces
82+
an exposed password detection for the external collaborators., defaults to None
8283
:type enterprise_has_strong_password_required_for_external_users: Optional[bool], optional
83-
:param user_has_strong_password: Whether or not the user has a strong password set for their
84-
account. The field is `null` when a strong password is not
85-
required., defaults to None
84+
:param user_has_strong_password: Whether or not the user has a strong and not exposed password set
85+
for their account. The field is `null` when a strong password is
86+
not required., defaults to None
8687
:type user_has_strong_password: Optional[bool], optional
8788
"""
8889
super().__init__(**kwargs)
Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,10 @@
1-
from enum import Enum
2-
31
from typing import Optional
42

5-
from box_sdk_gen.internal.base_object import BaseObject
6-
73
from typing import List
84

9-
from box_sdk_gen.schemas.collaboration import Collaboration
10-
11-
12-
class CollaborationsOrderDirectionField(str, Enum):
13-
ASC = 'ASC'
14-
DESC = 'DESC'
15-
5+
from box_sdk_gen.internal.base_object import BaseObject
166

17-
class CollaborationsOrderField(BaseObject):
18-
def __init__(
19-
self,
20-
*,
21-
by: Optional[str] = None,
22-
direction: Optional[CollaborationsOrderDirectionField] = None,
23-
**kwargs
24-
):
25-
"""
26-
:param by: The field to order by, defaults to None
27-
:type by: Optional[str], optional
28-
:param direction: The direction to order by, either ascending or descending, defaults to None
29-
:type direction: Optional[CollaborationsOrderDirectionField], optional
30-
"""
31-
super().__init__(**kwargs)
32-
self.by = by
33-
self.direction = direction
7+
from box_sdk_gen.schemas.collaboration import Collaboration
348

359

3610
class Collaborations(BaseObject):
@@ -40,9 +14,6 @@ def __init__(
4014
limit: Optional[int] = None,
4115
next_marker: Optional[str] = None,
4216
prev_marker: Optional[str] = None,
43-
total_count: Optional[int] = None,
44-
offset: Optional[int] = None,
45-
order: Optional[List[CollaborationsOrderField]] = None,
4617
entries: Optional[List[Collaboration]] = None,
4718
**kwargs
4819
):
@@ -55,32 +26,11 @@ def __init__(
5526
:type next_marker: Optional[str], optional
5627
:param prev_marker: The marker for the start of the previous page of results., defaults to None
5728
:type prev_marker: Optional[str], optional
58-
:param total_count: One greater than the offset of the last entry in the entire collection.
59-
The total number of entries in the collection may be less than
60-
`total_count`.
61-
62-
This field is only returned for calls that use offset-based pagination.
63-
For marker-based paginated APIs, this field will be omitted., defaults to None
64-
:type total_count: Optional[int], optional
65-
:param offset: The 0-based offset of the first entry in this set. This will be the same
66-
as the `offset` query parameter.
67-
68-
This field is only returned for calls that use offset-based pagination.
69-
For marker-based paginated APIs, this field will be omitted., defaults to None
70-
:type offset: Optional[int], optional
71-
:param order: The order by which items are returned.
72-
73-
This field is only returned for calls that use offset-based pagination.
74-
For marker-based paginated APIs, this field will be omitted., defaults to None
75-
:type order: Optional[List[CollaborationsOrderField]], optional
7629
:param entries: A list of collaborations, defaults to None
7730
:type entries: Optional[List[Collaboration]], optional
7831
"""
7932
super().__init__(**kwargs)
8033
self.limit = limit
8134
self.next_marker = next_marker
8235
self.prev_marker = prev_marker
83-
self.total_count = total_count
84-
self.offset = offset
85-
self.order = order
8636
self.entries = entries
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from typing import Optional
2+
3+
from typing import List
4+
5+
from box_sdk_gen.internal.base_object import BaseObject
6+
7+
from box_sdk_gen.schemas.collaboration import Collaboration
8+
9+
10+
class CollaborationsOffsetPaginated(BaseObject):
11+
def __init__(
12+
self,
13+
*,
14+
total_count: Optional[int] = None,
15+
limit: Optional[int] = None,
16+
offset: Optional[int] = None,
17+
entries: Optional[List[Collaboration]] = None,
18+
**kwargs
19+
):
20+
"""
21+
:param total_count: One greater than the offset of the last entry in the entire collection.
22+
The total number of entries in the collection may be less than
23+
`total_count`.
24+
25+
This field is only returned for calls that use offset-based pagination.
26+
For marker-based paginated APIs, this field will be omitted., defaults to None
27+
:type total_count: Optional[int], optional
28+
:param limit: The limit that was used for these entries. This will be the same as the
29+
`limit` query parameter unless that value exceeded the maximum value
30+
allowed. The maximum value varies by API., defaults to None
31+
:type limit: Optional[int], optional
32+
:param offset: The 0-based offset of the first entry in this set. This will be the same
33+
as the `offset` query parameter.
34+
35+
This field is only returned for calls that use offset-based pagination.
36+
For marker-based paginated APIs, this field will be omitted., defaults to None
37+
:type offset: Optional[int], optional
38+
:param entries: A list of collaborations, defaults to None
39+
:type entries: Optional[List[Collaboration]], optional
40+
"""
41+
super().__init__(**kwargs)
42+
self.total_count = total_count
43+
self.limit = limit
44+
self.offset = offset
45+
self.entries = entries

0 commit comments

Comments
 (0)