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
135 changes: 133 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,133 @@
lib/
coverage/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# box-gen-sdk
lib/
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
<p align="center">
<img src="https://github.com/box/sdks/blob/master/images/box-dev-logo.png" alt= “box-dev-logo” width="30%" height="50%">
</p>

# Box TypeScript SDK GENERATED

We are excited to introduce the latest generation (currently in Beta) of Box TypeScript SDK, designed to elevate the developer experience and streamline your integration with the Box Content Cloud.

With this SDK, you’ll have access to:

1. Full API Support: The new generation of Box SDKs empowers developers with complete coverage of the Box API ecosystem. You can now access all the latest features and functionalities offered by Box, allowing you to build even more sophisticated and feature-rich applications.
2. Rapid API Updates: Say goodbye to waiting for new Box APIs to be incorporated into the SDK. With our new auto-generation development approach, we can now add new Box APIs to the SDK at a much faster pace (in a matter of days). This means you can leverage the most up-to-date features in your applications without delay.
3. Embedded Documentation: We understand that easy access to information is crucial for developers. With our new approach, we have included comprehensive documentation for all objects and parameters directly in the source code of the SDK. This means you no longer need to look up this information on the developer portal, saving you time and streamlining your development process.
4. Enhanced Convenience Methods: Our commitment to enhancing your development experience continues with the introduction of convenience methods. These methods cover various aspects such as chunk uploads, classification, and much more.
5. Seamless Start: The new SDKs integrate essential functionalities like authentication, automatic retries with exponential backoff, exception handling, request cancellation, and type checking, enabling you to focus solely on your application's business logic.

Embrace the new generation of Box SDKs and unlock the full potential of the Box Content Cloud.

# Table of contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Expand All @@ -13,7 +31,13 @@
# Installing

```console
npm install git+ssh://git@github.com/box/box-ts-sdk-generated.git
npm install box-typescript-sdk-gen
```

If you use yarn, please do this instead:

```console
yarn add box-typescript-sdk-gen
```

This is autogenerated Box SDK Beta version. The engine used for generating this SDK can be found [here](https://github.com/box/box-codegen).
Expand All @@ -30,8 +54,10 @@ 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 { Client } = require('BoxSDK/lib/client.generated.js');
const { DeveloperTokenAuth } = require('BoxSDK/lib/developerTokenAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const {
DeveloperTokenAuth,
} = require('box-typescript-sdk-gen/lib/developerTokenAuth.js');

async function main(token) {
let auth = new DeveloperTokenAuth({ token });
Expand All @@ -46,12 +72,11 @@ main('INSERT YOUR DEVELOPER TOKEN HERE');
# Questions, Bugs, and Feature Requests?

Need to contact us directly? [Browse the issues
tickets](https://github.com/box/box-ts-sdk-generated/issues)! Or, if that
tickets](https://github.com/box/box-typescript-sdk-gen/issues)! Or, if that
doesn't work, [file a new
one](https://github.com/box/box-ts-sdk-generated/issues/new) and we will get
one](https://github.com/box/box-typescript-sdk-gen/issues/new) and we will get
back to you. If you have general questions about the Box API, you can
post to the [Box Developer
Forum](https://community.box.com/t5/Developer-Forum/bd-p/DeveloperForum).
post to the [Box Developer Forum](https://forum.box.com/).

# Copyright and License

Expand Down
36 changes: 19 additions & 17 deletions docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ object with the `token` set to the developer token and construct the client with
<!-- sample x_auth init_with_dev_token -->

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

const auth = new DeveloperTokenAuth({ token: 'DEVELOPER_TOKEN_GOES_HERE' });
const client = new Client({ auth });
Expand Down Expand Up @@ -66,8 +68,8 @@ Service Account. Call one of static `JwtAuth` method:
or `JwtConfig.fromConfigJsonString(configJsonString)` and pass JSON config file content as string.

```js
const { Client } = require('BoxSDK/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('BoxSDK/lib/jwtAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('box-typescript-sdk-gen/lib/jwtAuth.js');

const jwtConfig = JwtConfig.fromConfigFile('/path/to/settings.json');
const jwtAuth = new JwtAuth({ config: jwtConfig });
Expand All @@ -80,8 +82,8 @@ console.log(`My user ID is ${me.id}`);
Otherwise, you'll need to provide the necessary configuration fields directly to the `JwtConfig` constructor:

```js
const { Client } = require('BoxSDK/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('BoxSDK/lib/jwtAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('box-typescript-sdk-gen/lib/jwtAuth.js');

const jwtConfig = new JwtConfig({
clientId: 'YOUR_CLIENT_ID',
Expand Down Expand Up @@ -109,8 +111,8 @@ Clients for making calls as an App User can be created with the same JSON JWT co
a user ID you want to authenticate.

```js
const { Client } = require('BoxSDK/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('BoxSDK/lib/jwtAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('box-typescript-sdk-gen/lib/jwtAuth.js');

const jwtConfig = JwtConfig.fromConfigFile('/path/to/settings.json');
const jwtAuth = new JwtAuth({ config: jwtConfig });
Expand All @@ -123,8 +125,8 @@ constructor as in the above examples, similarly to creating a Service Account cl
`userId` instead of `enterpriseId` when constructing the auth config instance:

```js
const { Client } = require('BoxSDK/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('BoxSDK/lib/jwtAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const { JwtAuth, JwtConfig } = require('box-typescript-sdk-gen/lib/jwtAuth.js');

const jwtConfig = new JwtConfig({
clientId: 'YOUR_CLIENT_ID',
Expand Down Expand Up @@ -153,8 +155,8 @@ and secret with enterprise or user ID, which allows you to work using service or
You can use `CCGAuth` to initialize a client object the same way as for other authentication types:

```js
const { Client } = require('BoxSDK/lib/client.generated.js');
const { CcgAuth } = require('BoxSDK/lib/ccgAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const { CcgAuth } = require('box-typescript-sdk-gen/lib/ccgAuth.js');

const ccgConfig = {
userId: 'YOUR_USER_ID',
Expand All @@ -179,8 +181,8 @@ are not accessible in any other account by default, and vice versa.
To obtain service account you will have to provide enterprise ID with client id and secret:

```js
const { Client } = require('BoxSDK/lib/client.generated.js');
const { CcgAuth } = require('BoxSDK/lib/ccgAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const { CcgAuth } = require('box-typescript-sdk-gen/lib/ccgAuth.js');

const ccgConfig = {
enterpriseId: 'YOUR_ENTERPRISE_ID',
Expand All @@ -200,8 +202,8 @@ select `Generate user access tokens`. Do not forget to re-authorize application
To obtain user account you will have to provide user ID with client id and secret.

```js
const { Client } = require('BoxSDK/lib/client.generated.js');
const { CcgAuth } = require('BoxSDK/lib/ccgAuth.js');
const { Client } = require('box-typescript-sdk-gen/lib/client.generated.js');
const { CcgAuth } = require('box-typescript-sdk-gen/lib/ccgAuth.js');

const ccgConfig = {
userId: 'YOUR_USER_ID',
Expand Down Expand Up @@ -246,7 +248,7 @@ browser or web view) in order to obtain an auth code.
<!-- sample get_authorize -->

```js
const { OAuth, OAuthConfig } = require('BoxSDK/lib/oauth.js');
const { OAuth, OAuthConfig } = require('box-typescript-sdk-gen/lib/oauth.js');

const config = {
clientId: 'OAUTH_CLIENT_ID',
Expand Down
Loading