Skip to content

Commit

Permalink
feat: parametrise chunked uploads endpoint urls (box/box-openapi#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Aug 7, 2024
1 parent 63d94ea commit f8e91bc
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "f42fdb0", "specHash": "e50af18", "version": "1.2.0" }
{ "engineHash": "f42fdb0", "specHash": "9919482", "version": "1.2.0" }
46 changes: 31 additions & 15 deletions box_sdk_gen/managers/chunked_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
]
),
Expand All @@ -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
Expand Down Expand Up @@ -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),
]
),
Expand All @@ -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
Expand All @@ -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),
]
),
Expand All @@ -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"
Expand All @@ -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',
]
Expand All @@ -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"
Expand Down Expand Up @@ -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',
]
Expand Down
22 changes: 17 additions & 5 deletions docs/chunked_uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`.

Expand Down Expand Up @@ -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
Expand All @@ -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`.

Expand Down Expand Up @@ -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`.

Expand Down

0 comments on commit f8e91bc

Please sign in to comment.