# @black-mirror/sdk

> The black mirror SDK for the API.

Latest version **0.3.0** (published 2022-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @black-mirror/sdk
pnpm add @black-mirror/sdk
yarn add @black-mirror/sdk
bun add @black-mirror/sdk
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2022-10-23 |
| First published | 2022-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 4 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | Dany Gagnon ddanygagnon@gmail.com |
| Maintainers | devior |

## Links

- npm: https://www.npmjs.com/package/@black-mirror/sdk
- Repository: http://bitbucket.cstjean.qc.ca:7990/scm/mir/black-mirror-sdk
- npm.io page: https://npm.io/package/@black-mirror/sdk

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.27.2
- [luxon](https://npm.io/package/luxon.md) ^3.0.3
- [pusher-js](https://npm.io/package/pusher-js.md) ^7.4.0
- [laravel-echo](https://npm.io/package/laravel-echo.md) ^1.14.0

## Recent versions

- 0.3.0 (latest) — 2022-10-23
- 0.2.9 — 2022-10-23
- 0.2.8 — 2022-10-12
- 0.2.7 — 2022-10-11
- 0.2.6 — 2022-09-18
- 0.2.5 — 2022-09-18
- 0.2.4 — 2022-09-18
- 0.2.3 — 2022-09-18
- 0.2.2 — 2022-09-18
- 0.2.1 — 2022-09-18
- 0.2.0 — 2022-09-18
- 0.1.4 — 2022-09-18
- 0.1.3 — 2022-09-18
- 0.1.2 — 2022-09-18
- 0.1.1 — 2022-09-18
- … 1 more at https://npm.io/package/@black-mirror/sdk/versions

## README

# Black mirror SDK

The black mirror SDK allows the developers to use the SDK and let it handle
the requests instead of making the API calls.

## Getting started

To install the package, run the command: 

```
npm install --save @black-mirror/sdk
```

## Sdk

To import the sdk
```javascript
import * as sdk from '@black-mirror/sdk';
```

### Get the settings

This will get the settings from the server.

```javascript
api.settings.retrieve();
```

It will return as a promise that resolve to:


```javascript
const result = {
  id: 1,
  type: 'settings',
  attributes: {
    timezone: 'America\/Toronto', 
    hour12: true,
    interval_ms: 1000
  }
}
```

### Updates the settings

This will update the settings on the server and send a broadcast
to all the subscribed websockets.

```javascript
api.settings.update({
  timezone: 'America/Toronto',
  hour12: false,
  interval_ms: 500
});
```

It will return as a promise that resolve to:

```javascript
const result = {
  id: 1,
  type: "settings",
  attributes: {
    timezone: "America\/Toronto", 
    hour12: false,
    interval_ms: 500
  }
}
```

### Get the timezones

This will get the settings from the server.

```javascript
api.settings.timezones();
```

The first result will return a promise with:

```javascript
const result = [
  'Africa\/Abidjan',
  'Africa\/Accra',
  'Africa\/Addis_Ababa',
  'Africa\/Algiers',
  'Africa\/Asmara',
  'Africa\/Bamako',
  'Africa\/Bangui',
  // ...
]
```

You can also search the timezones with:

```javascript
api.settings.timezones('toro');
```

It will return a promise that resolves to:

```javascript
const result = [
  'America\/Toronto'
]
```

---
_Source: https://npm.io/package/@black-mirror/sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
