Skip to content

Commit

Permalink
generated with codegen at box/box-codegen@2f20f12 and spec at box/box…
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Aug 10, 2023
1 parent 34f7b36 commit c166ccf
Show file tree
Hide file tree
Showing 49 changed files with 1,751 additions and 249 deletions.
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
<p align="center">
<img src="https://github.com/box/sdks/blob/master/images/box-dev-logo.png" alt= “box-dev-logo” width="30%" height="50%">
</p>

# Box Python SDK GENERATED

We are excited to introduce the latest generation (currently in Beta) of Box Python SDK, designed to elevate the developer experience and streamline your integration with the Box Content Cloud.

With this SDK, you’ll have access to:

1. Full API Support: The new generation of Box SDKs empowers developers with complete coverage of the Box API ecosystem. You can now access all the latest features and functionalities offered by Box, allowing you to build even more sophisticated and feature-rich applications.
2. Rapid API Updates: Say goodbye to waiting for new Box APIs to be incorporated into the SDK. With our new auto-generation development approach, we can now add new Box APIs to the SDK at a much faster pace (in a matter of days). This means you can leverage the most up-to-date features in your applications without delay.
3. Embedded Documentation: We understand that easy access to information is crucial for developers. With our new approach, we have included comprehensive documentation for all objects and parameters directly in the source code of the SDK. This means you no longer need to look up this information on the developer portal, saving you time and streamlining your development process.
4. Enhanced Convenience Methods: Our commitment to enhancing your development experience continues with the introduction of convenience methods. These methods cover various aspects such as chunk uploads, classification, and much more.
5. Seamless Start: The new SDKs integrate essential functionalities like authentication, automatic retries with exponential backoff, exception handling, request cancellation, and type checking, enabling you to focus solely on your application's business logic.

Embrace the new generation of Box SDKs and unlock the full potential of the Box Content Cloud.

# Table of contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Expand Down Expand Up @@ -92,12 +110,11 @@ To run integration tests locally:
# Questions, Bugs, and Feature Requests?

Need to contact us directly? [Browse the issues
tickets](https://github.com/box/box-python-sdk-generated/issues)! Or, if that
tickets](https://github.com/box/box-python-sdk-gen/issues)! Or, if that
doesn't work, [file a new
one](https://github.com/box/box-python-sdk-generated/issues/new) and we will get
one](https://github.com/box/box-python-sdk-gen/issues/new) and we will get
back to you. If you have general questions about the Box API, you can
post to the [Box Developer
Forum](https://community.box.com/t5/Developer-Forum/bd-p/DeveloperForum).
post to the [Box Developer Forum](https://forum.box.com/).

# Copyright and License

Expand Down
2 changes: 1 addition & 1 deletion box_sdk_gen/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FetchOptions:
body: str = None
multipart_data: List[MultipartItem] = None
content_type: str = ""
response_format: str = None
response_format: Optional[str] = None
auth: Authentication = None
network_session: NetworkSession = None

Expand Down
2 changes: 1 addition & 1 deletion box_sdk_gen/managers/avatars.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create_user_avatar(self, user_id: str, pic: ByteStream, pic_file_name: Optio
extra_headers = {}
request_body: BaseObject = BaseObject(pic=pic, pic_file_name=pic_file_name, pic_content_type=pic_content_type)
headers_map: Dict[str, str] = prepare_params({**extra_headers})
response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), FetchOptions(method='POST', headers=headers_map, multipart_data=[MultipartItem(part_name='pic', file_stream=request_body.pic, content_type=request_body.pic_content_type, file_name=request_body.pic_file_name)], content_type='multipart/form-data', response_format='json', auth=self.auth, network_session=self.network_session))
response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), FetchOptions(method='POST', headers=headers_map, multipart_data=[MultipartItem(part_name='pic', file_stream=request_body.pic, file_name=request_body.pic_file_name, content_type=request_body.pic_content_type)], content_type='multipart/form-data', response_format='json', auth=self.auth, network_session=self.network_session))
return UserAvatar.from_dict(json.loads(response.text))
def delete_user_avatar(self, user_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None:
"""
Expand Down
5 changes: 3 additions & 2 deletions box_sdk_gen/managers/chunked_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ def get_file_upload_session_by_id(self, upload_session_id: str, extra_headers: O
headers_map: Dict[str, str] = prepare_params({**extra_headers})
response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions/', upload_session_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session))
return UploadSession.from_dict(json.loads(response.text))
def upload_file_part(self, upload_session_id: str, digest: str, content_range: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadedPart:
def upload_file_part(self, upload_session_id: str, request_body: ByteStream, digest: str, content_range: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadedPart:
"""
Updates a chunk of an upload session for a file.
:param upload_session_id: The ID of the upload session.
Example: "D5E3F7A"
:type upload_session_id: str
:param request_body: Request body of uploadFilePart method
:type request_body: ByteStream
:param digest: The [RFC3230][1] message digest of the chunk uploaded.
Only SHA1 is supported. The SHA1 digest must be base64
encoded. The format of this header is as
Expand All @@ -127,7 +129,6 @@ def upload_file_part(self, upload_session_id: str, digest: str, content_range: s
"""
if extra_headers is None:
extra_headers = {}
request_body: ByteStream = ByteStream()
headers_map: Dict[str, str] = prepare_params({'digest': to_string(digest), 'content-range': to_string(content_range), **extra_headers})
response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions/', upload_session_id]), FetchOptions(method='PUT', headers=headers_map, body=request_body, content_type='application/octet-stream', response_format='json', auth=self.auth, network_session=self.network_session))
return UploadedPart.from_dict(json.loads(response.text))
Expand Down
Loading

0 comments on commit c166ccf

Please sign in to comment.