Skip to content

Commit

Permalink
docs: Update collaboration resource (box/box-openapi#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Nov 18, 2024
1 parent d396b07 commit 72d6ed9
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "6ae899a", "specHash": "c2c76f3", "version": "1.7.0" }
{ "engineHash": "6ae899a", "specHash": "6d5f53e", "version": "1.7.0" }
6 changes: 3 additions & 3 deletions box_sdk_gen/managers/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from box_sdk_gen.schemas.client_error import ClientError

from box_sdk_gen.schemas.items import Items
from box_sdk_gen.schemas.items_offset_paginated import ItemsOffsetPaginated

from box_sdk_gen.schemas.collection import Collection

Expand Down Expand Up @@ -119,7 +119,7 @@ def get_collection_items(
offset: Optional[int] = None,
limit: Optional[int] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> Items:
) -> ItemsOffsetPaginated:
"""
Retrieves the files and/or folders contained within
Expand Down Expand Up @@ -177,7 +177,7 @@ def get_collection_items(
network_session=self.network_session,
)
)
return deserialize(response.data, Items)
return deserialize(response.data, ItemsOffsetPaginated)

def get_collection_by_id(
self,
Expand Down
29 changes: 24 additions & 5 deletions box_sdk_gen/managers/list_collaborations.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

from box_sdk_gen.schemas.client_error import ClientError

from box_sdk_gen.schemas.collaborations_offset_paginated import (
CollaborationsOffsetPaginated,
)

from box_sdk_gen.networking.auth import Authentication

from box_sdk_gen.networking.network import NetworkSession
Expand Down Expand Up @@ -132,6 +136,8 @@ def get_folder_collaborations(
folder_id: str,
*,
fields: Optional[List[str]] = None,
limit: Optional[int] = None,
marker: Optional[str] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> Collaborations:
"""
Expand Down Expand Up @@ -161,12 +167,25 @@ def get_folder_collaborations(
fields for the mini representation are returned, additional
to the fields requested., defaults to None
:type fields: Optional[List[str]], optional
:param limit: The maximum number of items to return per page., defaults to None
:type limit: Optional[int], optional
:param marker: Defines the position marker at which to begin returning results. This is
used when paginating using marker-based pagination.
This requires `usemarker` to be set to `true`., defaults to None
:type marker: Optional[str], 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({'fields': to_string(fields)})
query_params_map: Dict[str, str] = prepare_params(
{
'fields': to_string(fields),
'limit': to_string(limit),
'marker': to_string(marker),
}
)
headers_map: Dict[str, str] = prepare_params({**extra_headers})
response: FetchResponse = fetch(
FetchOptions(
Expand Down Expand Up @@ -196,7 +215,7 @@ def get_collaborations(
offset: Optional[int] = None,
limit: Optional[int] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> Collaborations:
) -> CollaborationsOffsetPaginated:
"""
Retrieves all pending collaboration invites for this user.
:param status: The status of the collaborations to retrieve
Expand Down Expand Up @@ -246,7 +265,7 @@ def get_collaborations(
network_session=self.network_session,
)
)
return deserialize(response.data, Collaborations)
return deserialize(response.data, CollaborationsOffsetPaginated)

def get_group_collaborations(
self,
Expand All @@ -255,7 +274,7 @@ def get_group_collaborations(
limit: Optional[int] = None,
offset: Optional[int] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> Collaborations:
) -> CollaborationsOffsetPaginated:
"""
Retrieves all the collaborations for a group. The user
Expand Down Expand Up @@ -305,4 +324,4 @@ def get_group_collaborations(
network_session=self.network_session,
)
)
return deserialize(response.data, Collaborations)
return deserialize(response.data, CollaborationsOffsetPaginated)
27 changes: 20 additions & 7 deletions box_sdk_gen/managers/metadata_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,22 +232,35 @@ def get_metadata_templates_by_instance_id(
self,
metadata_instance_id: str,
*,
marker: Optional[str] = None,
limit: Optional[int] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> MetadataTemplates:
"""
Finds a metadata template by searching for the ID of an instance of the
Finds a metadata template by searching for the ID of an instance of the
template.
template.
:param metadata_instance_id: The ID of an instance of the metadata template to find.
:type metadata_instance_id: str
:param marker: Defines the position marker at which to begin returning results. This is
used when paginating using marker-based pagination.
:param metadata_instance_id: The ID of an instance of the metadata template to find.
:type metadata_instance_id: str
: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
This requires `usemarker` to be set to `true`., 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 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(
{'metadata_instance_id': to_string(metadata_instance_id)}
{
'metadata_instance_id': to_string(metadata_instance_id),
'marker': to_string(marker),
'limit': to_string(limit),
}
)
headers_map: Dict[str, str] = prepare_params({**extra_headers})
response: FetchResponse = fetch(
Expand Down
4 changes: 4 additions & 0 deletions box_sdk_gen/schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@

from box_sdk_gen.schemas.web_link import *

from box_sdk_gen.schemas.items_offset_paginated import *

from box_sdk_gen.schemas.items import *

from box_sdk_gen.schemas.folder import *
Expand Down Expand Up @@ -420,6 +422,8 @@

from box_sdk_gen.schemas.collaboration import *

from box_sdk_gen.schemas.collaborations_offset_paginated import *

from box_sdk_gen.schemas.collaborations import *

from box_sdk_gen.schemas.app_item_association import *
Expand Down
9 changes: 5 additions & 4 deletions box_sdk_gen/schemas/collaboration.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ def __init__(
):
"""
:param enterprise_has_strong_password_required_for_external_users: Whether or not the enterprise that owns the content requires
a strong password to collaborate on the content., defaults to None
a strong password to collaborate on the content, or enforces
an exposed password detection for the external collaborators., defaults to None
:type enterprise_has_strong_password_required_for_external_users: Optional[bool], optional
:param user_has_strong_password: Whether or not the user has a strong password set for their
account. The field is `null` when a strong password is not
required., defaults to None
:param user_has_strong_password: Whether or not the user has a strong and not exposed password set
for their account. The field is `null` when a strong password is
not required., defaults to None
:type user_has_strong_password: Optional[bool], optional
"""
super().__init__(**kwargs)
Expand Down
54 changes: 2 additions & 52 deletions box_sdk_gen/schemas/collaborations.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,10 @@
from enum import Enum

from typing import Optional

from box_sdk_gen.internal.base_object import BaseObject

from typing import List

from box_sdk_gen.schemas.collaboration import Collaboration


class CollaborationsOrderDirectionField(str, Enum):
ASC = 'ASC'
DESC = 'DESC'

from box_sdk_gen.internal.base_object import BaseObject

class CollaborationsOrderField(BaseObject):
def __init__(
self,
*,
by: Optional[str] = None,
direction: Optional[CollaborationsOrderDirectionField] = None,
**kwargs
):
"""
:param by: The field to order by, defaults to None
:type by: Optional[str], optional
:param direction: The direction to order by, either ascending or descending, defaults to None
:type direction: Optional[CollaborationsOrderDirectionField], optional
"""
super().__init__(**kwargs)
self.by = by
self.direction = direction
from box_sdk_gen.schemas.collaboration import Collaboration


class Collaborations(BaseObject):
Expand All @@ -40,9 +14,6 @@ def __init__(
limit: Optional[int] = None,
next_marker: Optional[str] = None,
prev_marker: Optional[str] = None,
total_count: Optional[int] = None,
offset: Optional[int] = None,
order: Optional[List[CollaborationsOrderField]] = None,
entries: Optional[List[Collaboration]] = None,
**kwargs
):
Expand All @@ -55,32 +26,11 @@ def __init__(
:type next_marker: Optional[str], optional
:param prev_marker: The marker for the start of the previous page of results., defaults to None
:type prev_marker: Optional[str], optional
:param total_count: One greater than the offset of the last entry in the entire collection.
The total number of entries in the collection may be less than
`total_count`.
This field is only returned for calls that use offset-based pagination.
For marker-based paginated APIs, this field will be omitted., defaults to None
:type total_count: Optional[int], optional
:param offset: The 0-based offset of the first entry in this set. This will be the same
as the `offset` query parameter.
This field is only returned for calls that use offset-based pagination.
For marker-based paginated APIs, this field will be omitted., defaults to None
:type offset: Optional[int], optional
:param order: The order by which items are returned.
This field is only returned for calls that use offset-based pagination.
For marker-based paginated APIs, this field will be omitted., defaults to None
:type order: Optional[List[CollaborationsOrderField]], optional
:param entries: A list of collaborations, defaults to None
:type entries: Optional[List[Collaboration]], optional
"""
super().__init__(**kwargs)
self.limit = limit
self.next_marker = next_marker
self.prev_marker = prev_marker
self.total_count = total_count
self.offset = offset
self.order = order
self.entries = entries
45 changes: 45 additions & 0 deletions box_sdk_gen/schemas/collaborations_offset_paginated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from typing import Optional

from typing import List

from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.schemas.collaboration import Collaboration


class CollaborationsOffsetPaginated(BaseObject):
def __init__(
self,
*,
total_count: Optional[int] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
entries: Optional[List[Collaboration]] = None,
**kwargs
):
"""
:param total_count: One greater than the offset of the last entry in the entire collection.
The total number of entries in the collection may be less than
`total_count`.
This field is only returned for calls that use offset-based pagination.
For marker-based paginated APIs, this field will be omitted., defaults to None
:type total_count: Optional[int], optional
:param limit: The limit that was used for these entries. This will be the same as the
`limit` query parameter unless that value exceeded the maximum value
allowed. The maximum value varies by API., defaults to None
:type limit: Optional[int], optional
:param offset: The 0-based offset of the first entry in this set. This will be the same
as the `offset` query parameter.
This field is only returned for calls that use offset-based pagination.
For marker-based paginated APIs, this field will be omitted., defaults to None
:type offset: Optional[int], optional
:param entries: A list of collaborations, defaults to None
:type entries: Optional[List[Collaboration]], optional
"""
super().__init__(**kwargs)
self.total_count = total_count
self.limit = limit
self.offset = offset
self.entries = entries
Loading

0 comments on commit 72d6ed9

Please sign in to comment.