@shifter/headless-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

Shifter Headless API SDK (beta)

npm install --save @shifter/headless-sdk

Usage

Directory set authorization token

If you integrated by OAuth2, we can use the authorization token.

TypeScript

import {Shifter} from '@shifter/headless-sdk'
const shifter = new Shifter({
   token: "SHIFTER_AUTH_TOKEN"
})
shifter.sites.lists()
 .then(data => console.log(data))

JavaScript

const {Shifter} = require('@shifter/headless-sdk')

const shifter = new Shifter({
   token: "SHIFTER_AUTH_TOKEN"
})
shifter.sites.lists()
 .then(data => console.log(data))

Setup with username/password auth

We can directory setup the client with username and password.

TypeScript

import {Shifter} from '@shifter/headless-sdk'
const shifter = await Shifter.setupWithLogin('USERNAME', 'PASSWORD')

shifter.sites.lists()
 .then(data => console.log(data))

JavaScript

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)
        })
})

Development

This project was bootstrapped with TSDX.

Local Development

Below is a list of commands you will probably find useful.

npm start or yarn start

Runs 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 build

Bundles 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 test

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

Readme

Keywords

none

Package Sidebar

Install

npm i @shifter/headless-sdk

Weekly Downloads

1

Version

1.0.11

License

MIT

Unpacked Size

284 kB

Total Files

28

Last publish

Collaborators

  • hideokamoto
  • emaildano