open-index/open-npm huggingface dataset:
npm package: @quickshippy/client-js
Description: Client for QuickShippy Rest API
Author: QuickShippy Inc.
Latest version: 1.0.0

# QuickShippy JS Client

[![Version](https://img.shields.io/npm/v/stripe.svg)](https://www.npmjs.org/package/@quickshippy/client-js)

The QuickShippy JS Client provides easy access to the QuickShippy API from a client written in Typescript.

## Installation

Install the package with:

```sh
npm install @quickshippy/client-js
# or
yarn add @quickshippy/client-js
```

## Usage

Import QuickShippy as a default import and initiate it:

```js
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:

```js
const quickshippy = new QuickShippy({
  maxRetries: 3,
  baseUrl: 'http://localhost:3000',
  accessToken: '[ACCESS TOKEN]'
});
```
or
```js
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.            |