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
1 change: 1 addition & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
USER_ID: ${{ secrets.USER_ID }}
ENTERPRISE_ID: ${{ secrets.ENTERPRISE_ID }}
BOX_FILE_REQUEST_ID: ${{ secrets.BOX_FILE_REQUEST_ID }}
BOX_EXTERNAL_USER_EMAIL: ${{ secrets.BOX_EXTERNAL_USER_EMAIL }}
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ Using `Client` object you can access managers, which allow you to perform some o
The example below demonstrates how to authenticate with Developer Token and print names of all items inside a root folder.

```js
const { BoxClient } = require('box-typescript-sdk-gen/lib/client.generated.js');
const {
BoxDeveloperTokenAuth,
} = require('box-typescript-sdk-gen/lib/developerTokenAuth.generated.js');
const { BoxClient, BoxDeveloperTokenAuth } = require('box-typescript-sdk-gen');

async function main(token) {
let auth = new BoxDeveloperTokenAuth({ token });
Expand All @@ -73,6 +70,14 @@ async function main(token) {
main('INSERT YOUR DEVELOPER TOKEN HERE');
```

In order to use in browser make sure you include the `lib/bundle.js` file and then you can access the classes like so:

```js
const { BoxClient, BoxDeveloperTokenAuth } = window['box-typescript-sdk-gen'];
```

See example.html for an example website using this SDK.

# Integration Tests

## Running integration tests locally
Expand All @@ -94,7 +99,7 @@ Now select `Authorization` and submit application to be reviewed by account admi
download your app configuration settings as JSON.
2. Encode configuration file to Base64, e.g. using command: `base64 -i path_to_json_file`
3. Set environment variable: `JWT_CONFIG_BASE_64` with base64 encoded jwt configuration file
4. Set environment variable: `BOX_FILE_REQUEST_ID` with ID of file request already created in the user account.
4. Set environment variable: `BOX_FILE_REQUEST_ID` with ID of file request already created in the user account, `BOX_EXTERNAL_USER_EMAIL` with email of free external user which not belongs to any enterprise.

# Questions, Bugs, and Feature Requests?

Expand Down
33 changes: 23 additions & 10 deletions docs/fileMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See the endpoint docs at
<!-- sample get_files_id_metadata -->

```ts
await client.fileMetadata.getFileMetadata(fileId);
await client.fileMetadata.getFileMetadata(file.id);
```

### Arguments
Expand Down Expand Up @@ -52,7 +52,11 @@ See the endpoint docs at
<!-- sample get_files_id_metadata_id_id -->

```ts
await client.fileMetadata.getFileMetadataById(fileId, scope, template);
await client.fileMetadata.getFileMetadataById(
file.id,
'global' as GetFileMetadataByIdScopeArg,
'properties'
);
```

### Arguments
Expand Down Expand Up @@ -141,13 +145,18 @@ See the endpoint docs at
<!-- sample put_files_id_metadata_id_id -->

```ts
await client.fileMetadata.updateFileMetadataById(fileId, scope, template, [
{
op: 'replace' as UpdateFileMetadataByIdRequestBodyArgOpField,
path: '/abc',
value: newValue,
} satisfies UpdateFileMetadataByIdRequestBodyArg,
]);
await client.fileMetadata.updateFileMetadataById(
file.id,
'global' as UpdateFileMetadataByIdScopeArg,
'properties',
[
{
op: 'replace' as UpdateFileMetadataByIdRequestBodyArgOpField,
path: '/abc',
value: newValue,
} satisfies UpdateFileMetadataByIdRequestBodyArg,
]
);
```

### Arguments
Expand Down Expand Up @@ -184,7 +193,11 @@ See the endpoint docs at
<!-- sample delete_files_id_metadata_id_id -->

```ts
await client.fileMetadata.deleteFileMetadataById(fileId, scope, template);
await client.fileMetadata.deleteFileMetadataById(
file.id,
'enterprise' as DeleteFileMetadataByIdScopeArg,
templateKey
);
```

### Arguments
Expand Down
20 changes: 12 additions & 8 deletions docs/folderMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ See the endpoint docs at
<!-- sample get_folders_id_metadata_id_id -->

```ts
await client.folderMetadata.getFolderMetadataById(folder.id, scope, template);
await client.folderMetadata.getFolderMetadataById(
folder.id,
'global' as GetFolderMetadataByIdScopeArg,
'properties'
);
```

### Arguments
Expand Down Expand Up @@ -99,9 +103,9 @@ See the endpoint docs at
```ts
await client.folderMetadata.createFolderMetadataById(
folder.id,
scope,
template,
data
'global' as CreateFolderMetadataByIdScopeArg,
'properties',
{ ['abc']: 'xyz' }
);
```

Expand Down Expand Up @@ -148,8 +152,8 @@ See the endpoint docs at
```ts
await client.folderMetadata.updateFolderMetadataById(
folder.id,
scope,
template,
'global' as UpdateFolderMetadataByIdScopeArg,
'properties',
[
{
op: 'replace' as UpdateFolderMetadataByIdRequestBodyArgOpField,
Expand Down Expand Up @@ -196,8 +200,8 @@ See the endpoint docs at
```ts
await client.folderMetadata.deleteFolderMetadataById(
folder.id,
scope,
template
'global' as DeleteFolderMetadataByIdScopeArg,
'properties'
);
```

Expand Down
19 changes: 17 additions & 2 deletions docs/invites.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ This operation is performed by calling function `createInvite`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/post-invites/).

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

```ts
await client.invites.createInvite({
enterprise: {
id: currentUser.enterprise!.id!,
} satisfies CreateInviteRequestBodyArgEnterpriseField,
actionableBy: {
login: email,
} satisfies CreateInviteRequestBodyArgActionableByField,
} satisfies CreateInviteRequestBodyArg);
```

### Arguments

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

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

```ts
await client.invites.getInviteById(invitation.id);
```

### Arguments

Expand Down
Loading