0.0.2 • Published 2 years ago

dw-client-js v0.0.2

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
2 years ago

dw-client-js

Client library for DeskWatch in TypeScript/JavaScript.

Build Status npm Known Vulnerabilities

Install

npm install dw-client-js

Usage

The library uses Promises for almost everything, so either use .then() or the (recommended) async/aways syntax.

The example below is written with .then() to make it easy to run in the node REPL.

const { DWClient } = require('dw-client-js');
const client = new DWClient('test-client')

// Get server info
client.getInfo().then(console.log);

// List buckets
client.getBuckets().then(console.log);

// Create bucket
const bucketId = "test";
client.createBucket(bucketId, "bucket-type", "your-hostname");

// Send a heartbeat
const nowStr = (new Date()).toISOString();
const heartbeat = {timestamp: nowStr, duration: 0, data: { label: "just testing!" }};
client.heartbeat(bucketId, 5, heartbeat);

Contribute

Setup your dev environment

npm install

Build the library

npm run compile

Run the tests

npm run test
0.0.2

2 years ago

0.0.20

2 years ago

0.0.10

2 years ago