Skip to content
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
31 changes: 31 additions & 0 deletions docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,34 @@ You need to provide the auth code to the SDK to obtain an access token, then you
```js
await oauth.getTokensAuthorizationCodeGrant('code');
```

# Token storage

## In-memory token storage

By default, the SDK stores the access token in volatile memory. When rerunning your application,
the access token won't be reused from the previous run; a new token has to be obtained again.
To use in-memory token storage, you don't need to do anything more than
create an Auth class using AuthConfig, for example, for OAuth:

```js
const config = {
clientId: 'OAUTH_CLIENT_ID',
clientSecret: 'OAUTH_CLIENT_SECRET',
};
const oauth = new OAuth({ config: config });
```

## Custom storage

You can also provide a custom token storage class. All you need to do is create a class that implements `TokenStorage`
interface and pass an instance of your class to the AuthConfig constructor.

```js
const config = {
clientId: 'OAUTH_CLIENT_ID',
clientSecret: 'OAUTH_CLIENT_SECRET',
tokenStorage: new MyCustomTokenStorage(),
};
const oauth = new OAuth({ config: config });
```
89 changes: 52 additions & 37 deletions docs/chunkedUploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ 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)
- [](#)
- [](#)

## Create upload session

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

<!-- sample post_files_upload_sessions -->

```ts
await client.chunkedUploads.createFileUploadSession({
fileName: fileName,
fileSize: fileSize,
folderId: folderId,
} satisfies CreateFileUploadSessionRequestBodyArg);
```
_Currently we don't have an example for calling `createFileUploadSession` in integration tests_

### Arguments

Expand Down Expand Up @@ -77,11 +71,7 @@ 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/).

<!-- sample get_files_upload_sessions_id -->

```ts
await client.chunkedUploads.getFileUploadSessionById(uploadSessionId);
```
_Currently we don't have an example for calling `getFileUploadSessionById` in integration tests_

### Arguments

Expand All @@ -105,15 +95,7 @@ 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/).

<!-- sample put_files_upload_sessions_id -->

```ts
await client.chunkedUploads.uploadFilePart(
uploadSessionId,
uploadedChunk,
new UploadFilePartHeadersArg({ digest: digest, contentRange: contentRange })
);
```
_Currently we don't have an example for calling `uploadFilePart` in integration tests_

### Arguments

Expand Down Expand Up @@ -167,11 +149,7 @@ 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/).

<!-- sample get_files_upload_sessions_id_parts -->

```ts
await client.chunkedUploads.getFileUploadSessionParts(uploadSessionId);
```
_Currently we don't have an example for calling `getFileUploadSessionParts` in integration tests_

### Arguments

Expand All @@ -198,15 +176,7 @@ 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/).

<!-- sample post_files_upload_sessions_id_commit -->

```ts
await client.chunkedUploads.createFileUploadSessionCommit(
uploadSessionId,
{ parts: parts } satisfies CreateFileUploadSessionCommitRequestBodyArg,
new CreateFileUploadSessionCommitHeadersArg({ digest: digest })
);
```
_Currently we don't have an example for calling `createFileUploadSessionCommit` in integration tests_

### Arguments

Expand All @@ -226,3 +196,48 @@ Returns the file object in a list.Returns when all chunks have been uploaded but
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`
-

##

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,
fileName,
fileSize,
parentFolderId
);
```

### Arguments

- file `ByteStream`
- The stream of the file to upload.
- fileName `string`
- The name of the file, which will be used for storage in Box.
- fileSize `number`
- The total size of the file for the chunked upload in bytes.
- parentFolderId `string`
- The ID of the folder where the file should be uploaded.
31 changes: 27 additions & 4 deletions docs/collaborationAllowlistEntries.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ This operation is performed by calling function `getCollaborationWhitelistEntrie
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-entries/).

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

```ts
await client.collaborationAllowlistEntries.getCollaborationWhitelistEntries();
```

### Arguments

Expand All @@ -40,7 +44,14 @@ This operation is performed by calling function `createCollaborationWhitelistEnt
See the endpoint docs at
[API Reference](https://developer.box.com/reference/post-collaboration-whitelist-entries/).

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

```ts
await client.collaborationAllowlistEntries.createCollaborationWhitelistEntry({
direction: direction,
domain: domain,
} satisfies CreateCollaborationWhitelistEntryRequestBodyArg);
```

### Arguments

Expand All @@ -65,7 +76,13 @@ This operation is performed by calling function `getCollaborationWhitelistEntryB
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-entries-id/).

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

```ts
await client.collaborationAllowlistEntries.getCollaborationWhitelistEntryById(
entry.id
);
```

### Arguments

Expand All @@ -90,7 +107,13 @@ This operation is performed by calling function `deleteCollaborationWhitelistEnt
See the endpoint docs at
[API Reference](https://developer.box.com/reference/delete-collaboration-whitelist-entries-id/).

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

```ts
await client.collaborationAllowlistEntries.deleteCollaborationWhitelistEntryById(
entry.id
);
```

### Arguments

Expand Down
34 changes: 30 additions & 4 deletions docs/collaborationAllowlistExemptTargets.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ This operation is performed by calling function `getCollaborationWhitelistExempt
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-exempt-targets/).

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

```ts
await client.collaborationAllowlistExemptTargets.getCollaborationWhitelistExemptTargets();
```

### Arguments

Expand All @@ -40,7 +44,17 @@ This operation is performed by calling function `createCollaborationWhitelistExe
See the endpoint docs at
[API Reference](https://developer.box.com/reference/post-collaboration-whitelist-exempt-targets/).

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

```ts
await client.collaborationAllowlistExemptTargets.createCollaborationWhitelistExemptTarget(
{
user: {
id: user.id,
} satisfies CreateCollaborationWhitelistExemptTargetRequestBodyArgUserField,
} satisfies CreateCollaborationWhitelistExemptTargetRequestBodyArg
);
```

### Arguments

Expand All @@ -65,7 +79,13 @@ This operation is performed by calling function `getCollaborationWhitelistExempt
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-exempt-targets-id/).

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

```ts
await client.collaborationAllowlistExemptTargets.getCollaborationWhitelistExemptTargetById(
exemptTarget.id
);
```

### Arguments

Expand All @@ -90,7 +110,13 @@ This operation is performed by calling function `deleteCollaborationWhitelistExe
See the endpoint docs at
[API Reference](https://developer.box.com/reference/delete-collaboration-whitelist-exempt-targets-id/).

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

```ts
await client.collaborationAllowlistExemptTargets.deleteCollaborationWhitelistExemptTargetById(
exemptTarget.id
);
```

### Arguments

Expand Down
52 changes: 46 additions & 6 deletions docs/folderMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ This operation is performed by calling function `getFolderMetadata`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-folders-id-metadata/).

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

```ts
await client.folderMetadata.getFolderMetadata(folder.id);
```

### Arguments

Expand Down Expand Up @@ -44,7 +48,11 @@ This operation is performed by calling function `getFolderMetadataById`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-folders-id-metadata-id-id/).

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

```ts
await client.folderMetadata.getFolderMetadataById(folder.id, scope, template);
```

### Arguments

Expand All @@ -59,7 +67,7 @@ _Currently we don't have an example for calling `getFolderMetadataById` in integ

### Returns

This function returns a value of type `Metadata`.
This function returns a value of type `MetadataFull`.

An instance of the metadata template that includes
additional "key:value" pairs defined by the user or
Expand All @@ -82,7 +90,16 @@ This operation is performed by calling function `createFolderMetadataById`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/post-folders-id-metadata-id-id/).

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

```ts
await client.folderMetadata.createFolderMetadataById(
folder.id,
scope,
template,
data
);
```

### Arguments

Expand Down Expand Up @@ -120,7 +137,22 @@ This operation is performed by calling function `updateFolderMetadataById`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/put-folders-id-metadata-id-id/).

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

```ts
await client.folderMetadata.updateFolderMetadataById(
folder.id,
scope,
template,
[
{
op: 'replace' as UpdateFolderMetadataByIdRequestBodyArgOpField,
path: '/abc',
value: newValue,
} satisfies UpdateFolderMetadataByIdRequestBodyArg,
]
);
```

### Arguments

Expand Down Expand Up @@ -151,7 +183,15 @@ This operation is performed by calling function `deleteFolderMetadataById`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/delete-folders-id-metadata-id-id/).

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

```ts
await client.folderMetadata.deleteFolderMetadataById(
folder.id,
scope,
template
);
```

### Arguments

Expand Down
8 changes: 7 additions & 1 deletion docs/metadataTemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,13 @@ await client.metadataTemplates.createMetadataTemplateSchema({
scope: 'enterprise',
displayName: templateKey,
templateKey: templateKey,
fields: [{ type: 'string', key: 'testName', displayName: 'testName' }],
fields: [
{
type: 'string' as CreateMetadataTemplateSchemaRequestBodyArgFieldsFieldTypeField,
key: 'testName',
displayName: 'testName',
} satisfies CreateMetadataTemplateSchemaRequestBodyArgFieldsField,
],
} satisfies CreateMetadataTemplateSchemaRequestBodyArg);
```

Expand Down
Loading