From f8e91bc37694c1eb30e88a4b0d117b46014a25d3 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Wed, 7 Aug 2024 06:13:20 -0700 Subject: [PATCH] feat: parametrise chunked uploads endpoint urls (box/box-openapi#444) --- .codegen.json | 2 +- box_sdk_gen/managers/chunked_uploads.py | 46 +++++++++++++++++-------- docs/chunked_uploads.md | 22 +++++++++--- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/.codegen.json b/.codegen.json index 54e46fd..7f66eb0 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "f42fdb0", "specHash": "e50af18", "version": "1.2.0" } +{ "engineHash": "f42fdb0", "specHash": "9919482", "version": "1.2.0" } diff --git a/box_sdk_gen/managers/chunked_uploads.py b/box_sdk_gen/managers/chunked_uploads.py index 7f7ac79..e349aa8 100644 --- a/box_sdk_gen/managers/chunked_uploads.py +++ b/box_sdk_gen/managers/chunked_uploads.py @@ -198,6 +198,9 @@ def get_file_upload_session_by_id( ) -> UploadSession: """ Return information about an upload session. + + The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) endpoint. + :param upload_session_id: The ID of the upload session. Example: "D5E3F7A" :type upload_session_id: str @@ -210,8 +213,7 @@ def get_file_upload_session_by_id( response: FetchResponse = fetch( ''.join( [ - self.network_session.base_urls.upload_url, - '/2.0/files/upload_sessions/', + 'https://{box-upload-server}/api/2.0/files/upload_sessions/', to_string(upload_session_id), ] ), @@ -235,7 +237,13 @@ def upload_file_part( extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> UploadedPart: """ - Updates a chunk of an upload session for a file. + Uploads a chunk of a file for an upload session. + + The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) + + + and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. + :param upload_session_id: The ID of the upload session. Example: "D5E3F7A" :type upload_session_id: str @@ -282,8 +290,7 @@ def upload_file_part( response: FetchResponse = fetch( ''.join( [ - self.network_session.base_urls.upload_url, - '/2.0/files/upload_sessions/', + 'https://{box-upload-server}/api/2.0/files/upload_sessions/', to_string(upload_session_id), ] ), @@ -310,6 +317,12 @@ def delete_file_upload_session_by_id( This cannot be reversed. + + The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) + + + and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. + :param upload_session_id: The ID of the upload session. Example: "D5E3F7A" :type upload_session_id: str @@ -322,8 +335,7 @@ def delete_file_upload_session_by_id( response: FetchResponse = fetch( ''.join( [ - self.network_session.base_urls.upload_url, - '/2.0/files/upload_sessions/', + 'https://{box-upload-server}/api/2.0/files/upload_sessions/', to_string(upload_session_id), ] ), @@ -346,9 +358,12 @@ def get_file_upload_session_parts( extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> UploadParts: """ - Return a list of the chunks uploaded to the upload + Return a list of the chunks uploaded to the upload session so far. + + The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) + - session so far. + and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. :param upload_session_id: The ID of the upload session. Example: "D5E3F7A" @@ -373,8 +388,7 @@ def get_file_upload_session_parts( response: FetchResponse = fetch( ''.join( [ - self.network_session.base_urls.upload_url, - '/2.0/files/upload_sessions/', + 'https://{box-upload-server}/api/2.0/files/upload_sessions/', to_string(upload_session_id), '/parts', ] @@ -401,9 +415,12 @@ def create_file_upload_session_commit( extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> Files: """ - Close an upload session and create a file from the + Close an upload session and create a file from the uploaded chunks. + + The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) - uploaded chunks. + + and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. :param upload_session_id: The ID of the upload session. Example: "D5E3F7A" @@ -450,8 +467,7 @@ def create_file_upload_session_commit( response: FetchResponse = fetch( ''.join( [ - self.network_session.base_urls.upload_url, - '/2.0/files/upload_sessions/', + 'https://{box-upload-server}/api/2.0/files/upload_sessions/', to_string(upload_session_id), '/commit', ] diff --git a/docs/chunked_uploads.md b/docs/chunked_uploads.md index decf91b..2c7d6ce 100644 --- a/docs/chunked_uploads.md +++ b/docs/chunked_uploads.md @@ -75,6 +75,8 @@ Returns a new upload session. Return information about an upload session. +The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) endpoint. + This operation is performed by calling function `get_file_upload_session_by_id`. See the endpoint docs at @@ -97,7 +99,10 @@ Returns an upload session object. ## Upload part of file -Updates a chunk of an upload session for a file. +Uploads a chunk of a file for an upload session. + +The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) +and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. This operation is performed by calling function `upload_file_part`. @@ -140,6 +145,9 @@ Abort an upload session and discard all data uploaded. This cannot be reversed. +The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) +and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. + This operation is performed by calling function `delete_file_upload_session_by_id`. See the endpoint docs at @@ -163,8 +171,10 @@ successfully aborted. ## List parts -Return a list of the chunks uploaded to the upload -session so far. +Return a list of the chunks uploaded to the upload session so far. + +The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) +and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. This operation is performed by calling function `get_file_upload_session_parts`. @@ -196,8 +206,10 @@ Returns a list of parts that have been uploaded. ## Commit upload session -Close an upload session and create a file from the -uploaded chunks. +Close an upload session and create a file from the uploaded chunks. + +The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) +and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. This operation is performed by calling function `create_file_upload_session_commit`.