Unofficial Spire API client for node.js
Get your access token via the method explained in the API documentation
npm install spire-tracker
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)
})
client.streaks().then(function(data) {
console.log(JSON.stringify(data, null, 1))
})
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"}
]
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"}
]
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"}
]
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},
]