@tillhub/javascript-sdk
v4.165.0
Published
The JavaScript (Browser) SDK for the Tillhub API.
Downloads
3,702
Readme
Tillhub JavaScript SDK
Usage
# Run npm install and write your library name when asked. That's all!
npm install @tillhub/javascript-sdk
Features
Importing library
You can import the generated bundle to use the whole library generated by this starter:
import * as tillhub from '@tillhub/javascript-sdk'
// configure which API to use. E.g. you can also run staging and sandbox APIs
th.init({
base: 'https://api.tillhub.com'
})
// use any authentication method that .auth provides
th.auth.loginUsername({ username: '[email protected]', password: 'xxxxxxxxxxx' })
// or when already authenticated and rehydrating state you can immediately also hydrated an
// authenticated th client
th.init({
base: 'https://api.tillhub.com',
credentials: {
token: window.localStorage.getItem('th-token')
},
user: window.localStorage.getItem('th-user-uuid')
})
Additionally, you can import the transpiled modules from dist/lib
in case you have a modular library:
import Auth from '@tillhub/javascript-sdk/dist/lib/Auth'
Development
npm t
: Run test suitenpm start
: Runnpm run build
in watch modenpm run test:watch
: Run test suite in interactive watch modenpm run test:prod
: Run linting and generate coveragenpm run build
: Generate bundles and typings, create docsnpm run lint
: Lints codenpm run commit
: Commit using conventional commit style (husky will tell you to use it if you haven't :wink:)
Utilities
TODO: The SDK will rely on inherited base handlers as utilities.
LICENSE
Apache-2.0