0.3.0 • Published 2 years ago

@black-mirror/sdk v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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

import * as sdk from '@black-mirror/sdk';

Get the settings

This will get the settings from the server.

api.settings.retrieve();

It will return as a promise that resolve to:

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.

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

It will return as a promise that resolve to:

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.

api.settings.timezones();

The first result will return a promise with:

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

You can also search the timezones with:

api.settings.timezones('toro');

It will return a promise that resolves to:

const result = [
  'America\/Toronto'
]
0.3.0

2 years ago

0.2.9

2 years ago

0.2.7

2 years ago

0.2.8

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago