Skip to content

Commit

Permalink
fix(docs): fixes for chunked uploads docs (box/box-codegen#457) (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Mar 29, 2024
1 parent 33dd44f commit 65f40f5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "e12401a", "specHash": "1698c95", "version": "0.6.3" }
{ "engineHash": "a8e8651", "specHash": "1698c95", "version": "0.6.3" }
4 changes: 2 additions & 2 deletions box_sdk_gen/managers/chunked_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def create_file_upload_session_commit(
)
return deserialize(response.data, Files)

def reducer(self, acc: PartAccumulator, chunk: ByteStream) -> PartAccumulator:
def _reducer(self, acc: PartAccumulator, chunk: ByteStream) -> PartAccumulator:
last_index: int = acc.last_index
parts: List[UploadPart] = acc.parts
chunk_buffer: Buffer = read_byte_stream(chunk)
Expand Down Expand Up @@ -532,7 +532,7 @@ def upload_big_file(
chunks_iterator: Iterator = iterate_chunks(file, part_size)
results: PartAccumulator = reduce_iterator(
chunks_iterator,
self.reducer,
self._reducer,
PartAccumulator(
last_index=-1,
parts=[],
Expand Down
60 changes: 28 additions & 32 deletions docs/chunked_uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ This is a manager for chunked uploads (allowed for files at least 20MB).
- [Remove upload session](#remove-upload-session)
- [List parts](#list-parts)
- [Commit upload session](#commit-upload-session)
- [](#)
- [](#)
- [Upload_big_file](#upload-big-file)

## Create upload session

Expand All @@ -21,7 +20,11 @@ This operation is performed by calling function `create_file_upload_session`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/post-files-upload-sessions/).

_Currently we don't have an example for calling `create_file_upload_session` in integration tests_
<!-- sample post_files_upload_sessions -->

```python
self.create_file_upload_session(parent_folder_id, file_size, file_name)
```

### Arguments

Expand Down Expand Up @@ -77,7 +80,11 @@ This operation is performed by calling function `get_file_upload_session_by_id`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-files-upload-sessions-id/).

_Currently we don't have an example for calling `get_file_upload_session_by_id` in integration tests_
<!-- sample get_files_upload_sessions_id -->

```python
self.get_file_upload_session_by_id(upload_session_id)
```

### Arguments

Expand All @@ -101,7 +108,11 @@ This operation is performed by calling function `upload_file_part`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/put-files-upload-sessions-id/).

_Currently we don't have an example for calling `upload_file_part` in integration tests_
<!-- sample put_files_upload_sessions_id -->

```python
self.upload_file_part(acc.upload_session_id, generate_byte_stream_from_buffer(chunk_buffer), digest, content_range)
```

### Arguments

Expand Down Expand Up @@ -159,7 +170,11 @@ This operation is performed by calling function `get_file_upload_session_parts`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-files-upload-sessions-id-parts/).

_Currently we don't have an example for calling `get_file_upload_session_parts` in integration tests_
<!-- sample get_files_upload_sessions_id_parts -->

```python
self.get_file_upload_session_parts(upload_session_id)
```

### Arguments

Expand Down Expand Up @@ -188,7 +203,11 @@ This operation is performed by calling function `create_file_upload_session_comm
See the endpoint docs at
[API Reference](https://developer.box.com/reference/post-files-upload-sessions-id-commit/).

_Currently we don't have an example for calling `create_file_upload_session_commit` in integration tests_
<!-- sample post_files_upload_sessions_id_commit -->

```python
self.create_file_upload_session_commit(upload_session_id, parts, digest)
```

### Arguments

Expand All @@ -215,35 +234,12 @@ Inspect the upload session to get more information about the
progress of processing the chunks, then retry committing the file
when all chunks have processed.

##

This operation is performed by calling function `reducer`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference//).

_Currently we don't have an example for calling `reducer` in integration tests_

### Arguments

- acc `PartAccumulator`
-
- chunk `ByteStream`
-

### Returns

This function returns a value of type `PartAccumulator`.
## Upload_big_file

##
Starts the process of chunk uploading a big file. Should return a File object representing uploaded file.

This operation is performed by calling function `upload_big_file`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference//).

<!-- sample -->

```python
client.chunked_uploads.upload_big_file(file_byte_stream, file_name, file_size, parent_folder_id)
```
Expand Down
11 changes: 4 additions & 7 deletions docs/zip_downloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- [Create zip download](#create-zip-download)
- [Download zip archive](#download-zip-archive)
- [Get zip download status](#get-zip-download-status)
- [](#)
- [Download ZIP](#download-zip)

## Create zip download

Expand Down Expand Up @@ -132,14 +132,11 @@ This function returns a value of type `ZipDownloadStatus`.

Returns the status of the `zip` archive that is being downloaded.

##
## Download ZIP

This operation is performed by calling function `download_zip`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference//).
Creates a zip and downloads its content

<!-- sample -->
This operation is performed by calling function `download_zip`.

```python
client.zip_downloads.download_zip([DownloadZipItems(id=file_1.id, type=DownloadZipItemsTypeField.FILE.value), DownloadZipItems(id=file_2.id, type=DownloadZipItemsTypeField.FILE.value), DownloadZipItems(id=folder_1.id, type=DownloadZipItemsTypeField.FOLDER.value)], download_file_name='zip')
Expand Down

0 comments on commit 65f40f5

Please sign in to comment.