Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

levels-health-unofficial

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

levels-health-unofficial

Unofficial API for Levels Health glucose tracker

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Levels Health (unofficial)

Unofficial JS API for Levels Health, mined using Charles proxy.

This API is not associated with Levels Health and you shouldn't bother them if this breaks due to their own API changes.

Installation

npm install --save levels-health-unofficial
yarn install levels-health-unofficial

Usage

const LevelsHealth = require('levels-health-unofficial')

// Class was used to hold `token` and constructors can't be async`
const levels = new LevelsHealth()

const email = 'email@email.com'
const password = 'hunter2!'

// No need to save this, just useful if you want it. Their login method is AWS Cognito so
// this method could be handy utility when the API is expanded and this lib isn't update.
const jwtToken = await levels.login(email, password)

const beginQuery = dayjs().subtract(7, 'days').startOf()
const endQuery = dayjs.add(1, 'days').startOf()

const glucoseHistory = await levels.glucoseHistory(beginQuery, endQuery)

const {
  glucoseMetrics,
} = glucoseHistory

glucoseMetrics.values.forEach(console.log)

API

userData()

Fetch data of your account, pretty basic info

requestSensorRefresh()

Request that Levels re-fetch sensor data. Already automated so don't call this constantly.

findZones()

Fetch daily stats of glucose high-low and scores

Returns Promise of scores & glucose ranges

getSensorStatus()

Fetch status of current Libre sensor

metabolicFitnessStreaks(start, end)

Fetch metabolic fitness streaks

nametypedescription
startNumberRange start, time since unix epoch in milliseconds
endNumberRange end, time since unix epoch in milliseconds

Returns Promise of streaks of good glucose scores

heartRateMetrics(start, end)

Fetch heart rate metrics, presumably pulled from Apple Health

nametypedescription
startNumberRange start, time since unix epoch in milliseconds
endNumberRange end, time since unix epoch in milliseconds

Returns Promise of heart rate metrics

metabolicFitness(start, end)

Fetch daily metabolic fitness score

nametypedescription
startNumberRange start, time since unix epoch in milliseconds
endNumberRange end, time since unix epoch in milliseconds

Returns Promise of daily overall metabolic fitness score

getInsightFeed(start, end)

Fetch insight / news feed

nametypedescription
startNumberRange start, time since unix epoch in milliseconds
endNumberRange end, time since unix epoch in milliseconds

Returns Promise of insights / news feeds

glucoseHistory(start, end)

Fetch raw glucose scores of range

nametypedescription
startNumberRange start, time since unix epoch in milliseconds
endNumberRange end, time since unix epoch in milliseconds

Returns Promise of raw glucose scores along with stats

FAQs

Package last updated on 01 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc