Shifter API wrapper SDK (Using axios).
import {
Configuration,
LoginApi,
SitesApi,
} from '@shifter/sdk'
const getConfByLogin = async () => {
const loginClient = new LoginApi()
const params = {
username: process.env.SHIFTER_USERNAME,
password: process.env.SHIFTER_PASSWORD
}
const {
data: {
AccessToken: apiKey
}
} = await loginClient.loginPost(params)
const conf = new Configuration({
apiKey
})
return conf
}
import {
Configuration,
LoginApi,
SitesApi,
} from '@shifter/sdk'
const listSitesWithLogin = async () => {
const loginClient = new LoginApi()
const params = {
username: process.env.SHIFTER_USERNAME,
password: process.env.SHIFTER_PASSWORD
}
const {
data: {
AccessToken: apiKey
}
} = await loginClient.loginPost(params)
if (!apiKey) throw new Error('UnAuthorized')
const conf = new Configuration({
apiKey
})
const client = new SitesApi(conf)
console.log(await client.sitesGet())
}
listSitesWithLogin()
.catch(e => {
console.log(e)
})
[WIP] https://getshifter.github.io/shifter-sdk-js/
Open API Docs: https://developer.getshifter.io/swagger.yaml
$ ./bin/generate-sdk.sh
$ git checkout master
$ yarn docs
$ git add ./docs/
$ git commit -m "docs: update docs"
$ git push origin master
$ yarn build
$ npm version [patch|minor|major]
$ npm publish .
Generated using TypeDoc