Skip to content

Commit

Permalink
fix(docs): fixes for chunked uploads docs (box/box-codegen#457) (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Mar 29, 2024
1 parent 22c1907 commit c94dbf5
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
@@ -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
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
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
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

0 comments on commit c94dbf5

Please sign in to comment.