1.0.0 • Published 2 years ago
@quickshippy/client-js v1.0.0
QuickShippy JS Client
The QuickShippy JS Client provides easy access to the QuickShippy API from a client written in Typescript.
Installation
Install the package with:
npm install @quickshippy/client-js
# or
yarn add @quickshippy/client-js
Usage
Import QuickShippy as a default import and initiate it:
import QuickShippy from '@quickshippy/client-js';
const quickshippy = new QuickShippy();
const response = await quickshippy.auth.login({ email: 'email@example.com', password: 'password' });
Authentication
Authentication can be achieved using the client-js
client, by utilizing access token.
Using Access token
Access token can be used to authenticate requests in QuickShippy. To use Access token for authentication the key should be used when client-js
is initialized with a config object or via setAccessToken
as described below.
Configuration
Initialize with config object
The package can be initialized with several options:
const quickshippy = new QuickShippy({
maxRetries: 3,
baseUrl: 'http://localhost:3000',
accessToken: '[ACCESS TOKEN]'
});
or
const quickshippy = new QuickShippy({
maxRetries: 3,
baseUrl: 'http://localhost:3000',
});
quickshippy.setAccessToken('[ACCESS TOKEN]');
Option | Default | Description |
---|---|---|
maxRetries | 0 | The amount of times a request is retried. |
baseUrl | 'http://localhost:3000' | The url to which requests are made to. |
accessToken | '[ACCESS TOKEN]' | Access token used for authenticating requests. |
1.0.0
2 years ago