/spire-tracker

Node client for Spire mindfulnes tracker API

Primary LanguageJavaScriptISC LicenseISC

Spire API client

Build Status

Unofficial Spire API client for node.js

Usage

Get your access token via the method explained in the API documentation

Install

npm install spire-tracker

Quick example

const Spire = require('spire-tracker')

var token = 'MY_ACCESS_TOKEN'
var client = new Spire(token)

client.streaks().then(function(data) {
  console.log(JSON.stringify(data, null, 1))
}).catch(function(error){
  console.error(error)
})

Features

streaks

Documentation

client.streaks().then(function(data) {
  console.log(JSON.stringify(data, null, 1))
})

br (beaths per minute)

Returns br events, see documentation Note: date is optional.

client.br(date).then(function(data) {
  console.log(JSON.stringify(data, null, 1))
})

Example result:

[
  {"timestamp":1455454720,"value":16.94,"event_type":"br"},
  {"timestamp":1455454760,"value":18.18,"event_type":"br"}
]

calories

Returns calories events, see documentation

Note: date is optional.

client.calories(date).then(function(data) {
  console.log(JSON.stringify(data, null, 1))
})

Example result:

[
  {"timestamp":1455454720,"value":4.142012,"event_type":"calories"},
  {"timestamp":1455454760,"value":2.075894,"event_type":"calories"}
]

steps

Returns steps events, see documentation

Note: date is optional.

client.steps(date).then(function(data) {
  console.log(JSON.stringify(data, null, 1))
})

Example result:

[
  {"timestamp":1455454720,"value":8,"event_type":"steps"},
  {"timestamp":1455454760,"value":4,"event_type":"steps"}
]

events

Returns combined br, calories and steps events. Note: date is optional.

client.events(date).then(function(data) {
  console.log(JSON.stringify(data, null, 1))
})

Example result:

[
  {"timestamp":1455454720,"br":16.94,"calories":4.142012,"steps":8},
  {"timestamp":1455454720,"br":18.18,"calories":2.075894,"steps":4},
]