refocus-client

1.2.0 • Public • Published

Coverage Status

refocus-client

Interact with the Refocus API using refocus-client and Bluebird promises.

Install

npm install refocus-client --save

Usage

const RefocusClient = require('refocus-client');

// Some configuration
const refocusUrl = 'http://localhost:3000'; // The URL where Refocus is running
const apiVersion = 'v1'; // The Refocus API version
const token = 'skqjkbqkjnq9n34jn3jk3fjnwefwefwef34'; // Your API token

// Instantiate the RefocusClient.
const rc = new RefocusClient(refocusUrl, apiVersion, token);

// Now use the RefocusClient API. For example, here we create a new Aspect:
rc.addAspect({
  name: 'Latency',
  isPublished: true,
  timeout: '5m',
  valueType: 'NUMERIC',
  valueLabel: 'ms',
  criticalRange: [500, 999999999999],
  warningRange: [300, 500],
  infoRange: [200, 300],
  okRange: [0, 200],
})
.then((asp) => {
  // Do something else now that the aspect has been created?
  console.log(`Created "${asp.name}"`);
})
.catch((err) => {
  // Handle errors...
  console.log('Uh oh!', err);
});

Proxy

If you need to specify a proxy for communication to Refocus, set environment variable "http_proxy".

API

/refocus-client/

    Package Sidebar

    Install

    npm i refocus-client

    Weekly Downloads

    11

    Version

    1.2.0

    License

    ISC

    Unpacked Size

    178 kB

    Total Files

    20

    Last publish

    Collaborators

    • ianmgoldstein