@trd-clarkdwain/trd-box-sdk
v1.29.0
Published
Cloned SDK for Box Plaform APIs
Downloads
7
Maintainers
Readme
TRD BOX Module
Installation
npm install --save @trd-clarkdwain/trd-box-sdk
Getting Started
To get started with the SDK, get a Developer Token from the Configuration page of your app in the [Box Developer Console][dev-console]. You can use this token to make test calls for your own Box account.
var TrdBoxSDK = require('trd-box-sdk');
// Initialize the SDK with your app credentials
var sdk = new TrdBoxSDK({
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
});
// Create a basic API client, which does not automatically refresh the access token
var client = sdk.getBasicClient('DEVELOPER_TOKEN');
// Get your own user object from the Box API
// All client methods return a promise that resolves to the results of the API call,
// or rejects when an error occurs
client.users.get(client.CURRENT_USER_ID)
.then(user => console.log('Hello', user.name, '!'))
.catch(err => console.log('Got an error!', err));