npm install --save @shifter/headless-sdkIf you integrated by OAuth2, we can use the authorization token.
import {Shifter} from '@shifter/headless-sdk'
const shifter = new Shifter({
token: "SHIFTER_AUTH_TOKEN"
})
shifter.sites.lists()
.then(data => console.log(data))const {Shifter} = require('@shifter/headless-sdk')
const shifter = new Shifter({
token: "SHIFTER_AUTH_TOKEN"
})
shifter.sites.lists()
.then(data => console.log(data))We can directory setup the client with username and password.
import {Shifter} from '@shifter/headless-sdk'
const shifter = await Shifter.setupWithLogin('USERNAME', 'PASSWORD')
shifter.sites.lists()
.then(data => console.log(data))const {Shifter} = require('@shifter/headless-sdk')
Shifter.setupWithLogin('USERNAME', 'PASSWORD')
.then(shifter => {
shifter.sites.list()
.then(data => {
console.log(data)
}).catch(e => {
console.log(e)
})
})This project was bootstrapped with TSDX.
Below is a list of commands you will probably find useful.
npm start or yarn startRuns the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.

Your library will be rebuilt if you make edits.
npm run build or yarn buildBundles the package to the dist folder.
The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).

npm test or yarn testRuns the test watcher (Jest) in an interactive mode.
By default, runs tests related to files changed since the last commit.