Skip to content

fix(docs): fixes for chunked uploads docs (box/box-codegen#457) #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 29, 2024
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": "fa2d002", "specHash": "d50ab5f", "version": "0.5.2" }
{ "engineHash": "a8e8651", "specHash": "1698c95", "version": "0.5.2" }
86 changes: 54 additions & 32 deletions docs/chunkedUploads.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,19 @@ This operation is performed by calling function `createFileUploadSession`.
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 `createFileUploadSession` in integration tests_
<!-- sample post_files_upload_sessions -->

```ts
await this.createFileUploadSession(
{
fileName: fileName,
fileSize: fileSize,
folderId: parentFolderId,
} satisfies CreateFileUploadSessionRequestBody,
new CreateFileUploadSessionHeaders({}),
cancellationToken
);
```

### Arguments

Expand Down Expand Up @@ -75,7 +86,15 @@ This operation is performed by calling function `getFileUploadSessionById`.
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 `getFileUploadSessionById` in integration tests_
<!-- sample get_files_upload_sessions_id -->

```ts
await this.getFileUploadSessionById(
uploadSessionId,
new GetFileUploadSessionByIdHeaders({}),
cancellationToken
);
```

### Arguments

Expand All @@ -101,7 +120,15 @@ This operation is performed by calling function `uploadFilePart`.
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 `uploadFilePart` in integration tests_
<!-- sample put_files_upload_sessions_id -->

```ts
await this.uploadFilePart(
acc.uploadSessionId,
generateByteStreamFromBuffer(chunkBuffer),
new UploadFilePartHeaders({ digest: digest, contentRange: contentRange })
);
```

### Arguments

Expand Down Expand Up @@ -159,7 +186,16 @@ This operation is performed by calling function `getFileUploadSessionParts`.
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 `getFileUploadSessionParts` in integration tests_
<!-- sample get_files_upload_sessions_id_parts -->

```ts
await this.getFileUploadSessionParts(
uploadSessionId,
{} satisfies GetFileUploadSessionPartsQueryParams,
new GetFileUploadSessionPartsHeaders({}),
cancellationToken
);
```

### Arguments

Expand Down Expand Up @@ -188,7 +224,16 @@ This operation is performed by calling function `createFileUploadSessionCommit`.
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 `createFileUploadSessionCommit` in integration tests_
<!-- sample post_files_upload_sessions_id_commit -->

```ts
await this.createFileUploadSessionCommit(
uploadSessionId,
{ parts: parts } satisfies CreateFileUploadSessionCommitRequestBody,
new CreateFileUploadSessionCommitHeaders({ digest: digest }),
cancellationToken
);
```

### Arguments

Expand All @@ -211,35 +256,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
## Upload big file

This function returns a value of type `PartAccumulator`.

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

This operation is performed by calling function `uploadBigFile`.

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

<!-- sample -->

```ts
await client.chunkedUploads.uploadBigFile(
fileByteStream,
Expand Down
11 changes: 4 additions & 7 deletions docs/zipDownloads.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 @@ -152,14 +152,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 `downloadZip`.

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 `downloadZip`.

```ts
await client.zipDownloads.downloadZip({
Expand Down
2 changes: 1 addition & 1 deletion src/managers/chunkedUploads.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export class ChunkedUploadsManager {
)) as FetchResponse;
return deserializeFiles(response.data);
}
async reducer(
private async reducer(
acc: PartAccumulator,
chunk: ByteStream
): Promise<PartAccumulator> {
Expand Down