0.4.0 • Published 3 months ago

aw-client v0.4.0

Weekly downloads
84
License
MPL-2.0
Repository
github
Last release
3 months ago

aw-client-js

Client library for ActivityWatch in TypeScript/JavaScript.

Build Status npm Known Vulnerabilities

Install

npm install aw-client

Usage

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

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

const { AWClient } = require('aw-client');
const client = new AWClient('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 test
0.4.0

3 months ago

0.3.6

6 months ago

0.3.5

7 months ago

0.3.7

6 months ago

0.3.4

12 months ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

3 years ago

0.2.0

4 years ago

0.1.0

6 years ago