Skip to content
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": "ac37b50", "specHash": "eaa9cf0", "version": "1.15.0" }
{ "engineHash": "ac37b50", "specHash": "c27c421", "version": "1.15.0" }
5 changes: 5 additions & 0 deletions box_sdk_gen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@

from box_sdk_gen.managers.shield_lists import ShieldListsManager

from box_sdk_gen.managers.archives import ArchivesManager

from box_sdk_gen.networking.auth import Authentication

from box_sdk_gen.networking.network import NetworkSession
Expand Down Expand Up @@ -435,6 +437,9 @@ def __init__(self, auth: Authentication, *, network_session: NetworkSession = No
self.shield_lists = ShieldListsManager(
auth=self.auth, network_session=self.network_session
)
self.archives = ArchivesManager(
auth=self.auth, network_session=self.network_session
)

def make_request(self, fetch_options: FetchOptions) -> FetchResponse:
"""
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,5 @@
from box_sdk_gen.managers.hub_items import *

from box_sdk_gen.managers.shield_lists import *

from box_sdk_gen.managers.archives import *
171 changes: 171 additions & 0 deletions box_sdk_gen/managers/archives.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
from typing import Optional

from typing import Dict

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.serialization.json import serialize

from box_sdk_gen.networking.fetch_options import ResponseFormat

from box_sdk_gen.schemas.v2025_r0.archives_v2025_r0 import ArchivesV2025R0

from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0

from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
BoxVersionHeaderV2025R0,
)

from box_sdk_gen.schemas.v2025_r0.archive_v2025_r0 import ArchiveV2025R0

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.networking.auth import Authentication

from box_sdk_gen.networking.network import NetworkSession

from box_sdk_gen.networking.fetch_options import FetchOptions

from box_sdk_gen.networking.fetch_response import FetchResponse

from box_sdk_gen.internal.utils import prepare_params

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.internal.utils import ByteStream

from box_sdk_gen.serialization.json import sd_to_json

from box_sdk_gen.serialization.json import SerializedData


class ArchivesManager:
def __init__(
self,
*,
auth: Optional[Authentication] = None,
network_session: NetworkSession = None
):
if network_session is None:
network_session = NetworkSession()
self.auth = auth
self.network_session = network_session

def get_archives_v2025_r0(
self,
*,
limit: Optional[int] = None,
marker: Optional[str] = None,
box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> ArchivesV2025R0:
"""
Retrieves archives for an enterprise.
: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., defaults to None
:type marker: Optional[str], optional
:param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
:type box_version: BoxVersionHeaderV2025R0, 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(
{'limit': to_string(limit), 'marker': to_string(marker)}
)
headers_map: Dict[str, str] = prepare_params(
{'box-version': to_string(box_version), **extra_headers}
)
response: FetchResponse = self.network_session.network_client.fetch(
FetchOptions(
url=''.join([self.network_session.base_urls.base_url, '/2.0/archives']),
method='GET',
params=query_params_map,
headers=headers_map,
response_format=ResponseFormat.JSON,
auth=self.auth,
network_session=self.network_session,
)
)
return deserialize(response.data, ArchivesV2025R0)

def create_archive_v2025_r0(
self,
name: str,
*,
box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> ArchiveV2025R0:
"""
Creates an archive.
:param name: The name of the archive.
:type name: str
:param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
:type box_version: BoxVersionHeaderV2025R0, 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 = {}
request_body: Dict = {'name': name}
headers_map: Dict[str, str] = prepare_params(
{'box-version': to_string(box_version), **extra_headers}
)
response: FetchResponse = self.network_session.network_client.fetch(
FetchOptions(
url=''.join([self.network_session.base_urls.base_url, '/2.0/archives']),
method='POST',
headers=headers_map,
data=serialize(request_body),
content_type='application/json',
response_format=ResponseFormat.JSON,
auth=self.auth,
network_session=self.network_session,
)
)
return deserialize(response.data, ArchiveV2025R0)

def delete_archive_by_id_v2025_r0(
self,
archive_id: str,
*,
box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> None:
"""
Permanently deletes an archive.
:param archive_id: The ID of the archive.
Example: "982312"
:type archive_id: str
:param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
:type box_version: BoxVersionHeaderV2025R0, 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 = {}
headers_map: Dict[str, str] = prepare_params(
{'box-version': to_string(box_version), **extra_headers}
)
response: FetchResponse = self.network_session.network_client.fetch(
FetchOptions(
url=''.join(
[
self.network_session.base_urls.base_url,
'/2.0/archives/',
to_string(archive_id),
]
),
method='DELETE',
headers=headers_map,
response_format=ResponseFormat.NO_CONTENT,
auth=self.auth,
network_session=self.network_session,
)
)
return None
4 changes: 2 additions & 2 deletions box_sdk_gen/schemas/ai_llm_endpoint_params_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def __init__(
:type temperature: Optional[float], optional
:param top_p: `Top-P` changes how the model selects tokens for output. Tokens are selected from the most (see `top-K`) to least probable until the sum of their probabilities equals the `top-P` value., defaults to None
:type top_p: Optional[float], optional
:param top_k: `Top-K` changes how the model selects tokens for output. A `top-K` of 1 means the next selected token is
:param top_k: `Top-K` changes how the model selects tokens for output. A low `top-K` means the next selected token is
the most probable among all tokens in the model's vocabulary (also called greedy decoding),
while a `top-K` of 3 means that the next token is selected from among the three most probable tokens by using temperature., defaults to None
while a high `top-K` means that the next token is selected from among the three most probable tokens by using temperature., defaults to None
:type top_k: Optional[float], optional
"""
super().__init__(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions box_sdk_gen/schemas/ai_llm_endpoint_params_ibm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def __init__(
of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability
mass are considered. We generally recommend altering this or temperature but not both., defaults to None
:type top_p: Optional[float], optional
:param top_k: `Top-K` changes how the model selects tokens for output. A `top-K` of 1 means the next selected token is
:param top_k: `Top-K` changes how the model selects tokens for output. A low `top-K` means the next selected token is
the most probable among all tokens in the model's vocabulary (also called greedy decoding),
while a `top-K` of 3 means that the next token is selected from among the three most probable tokens by using temperature., defaults to None
while a high `top-K` means that the next token is selected from among the three most probable tokens by using temperature., defaults to None
:type top_k: Optional[float], optional
"""
super().__init__(**kwargs)
Expand Down
4 changes: 4 additions & 0 deletions box_sdk_gen/schemas/v2025_r0/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from box_sdk_gen.schemas.v2025_r0.archive_v2025_r0 import *

from box_sdk_gen.schemas.v2025_r0.archives_v2025_r0 import *

from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import *

from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_base_v2025_r0 import *
Expand Down
43 changes: 43 additions & 0 deletions box_sdk_gen/schemas/v2025_r0/archive_v2025_r0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from enum import Enum

from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.box.errors import BoxSDKError


class ArchiveV2025R0TypeField(str, Enum):
ARCHIVE = 'archive'


class ArchiveV2025R0(BaseObject):
_discriminator = 'type', {'archive'}

def __init__(
self,
id: str,
name: str,
size: int,
*,
type: ArchiveV2025R0TypeField = ArchiveV2025R0TypeField.ARCHIVE,
**kwargs
):
r"""
:param id: The unique identifier that represents an archive.
:type id: str
:param name: The name of the archive.

The following restrictions to the archive name apply: names containing
non-printable ASCII characters, forward and backward slashes
(`/`, `\`), names with trailing spaces, and names `.` and `..` are
not allowed.
:type name: str
:param size: The size of the archive in bytes.
:type size: int
:param type: The value will always be `archive`., defaults to ArchiveV2025R0TypeField.ARCHIVE
:type type: ArchiveV2025R0TypeField, optional
"""
super().__init__(**kwargs)
self.id = id
self.name = name
self.size = size
self.type = type
34 changes: 34 additions & 0 deletions box_sdk_gen/schemas/v2025_r0/archives_v2025_r0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from typing import Optional

from typing import List

from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.schemas.v2025_r0.archive_v2025_r0 import ArchiveV2025R0

from box_sdk_gen.box.errors import BoxSDKError


class ArchivesV2025R0(BaseObject):
def __init__(
self,
*,
entries: Optional[List[ArchiveV2025R0]] = None,
limit: Optional[int] = None,
next_marker: Optional[str] = None,
**kwargs
):
"""
:param entries: A list in which each entry represents an archive object., defaults to None
:type entries: Optional[List[ArchiveV2025R0]], 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 next_marker: The marker for the start of the next page of results., defaults to None
:type next_marker: Optional[str], optional
"""
super().__init__(**kwargs)
self.entries = entries
self.limit = limit
self.next_marker = next_marker
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ the SDK are available by topic:
- [Ai](ai.md)
- [Ai studio](ai_studio.md)
- [App item associations](app_item_associations.md)
- [Archives](archives.md)
- [Authorization](authorization.md)
- [Avatars](avatars.md)
- [Chunked uploads](chunked_uploads.md)
Expand Down
Loading