npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@biostrap/api

v0.0.4

Published

Biostrap API Node SDK

Readme

NODEJS BIOSTRAP API

Requirements

NodeJS > 18.0

Installation

Using npm

npm i --save @biostrap/api

Using yarn

yarn add @biostrap/api

Usage

OAuth2.0

Create your oauth application in app.biostrap.com. Use the credentials of your app for authorization.

  • Example 1: Using import
import BiostrapApi from '@biostrap/api'

const biostrapAuth = new BiostrapApi.Oauth2({
    clientId: '', // your client id from the oauth app
    clientSecret: '', // your client secret from the oauth app
    redirectUri: '', // your redirect uri
    authorizationEndpoint: '', // https://dev.auth.biostrap.com/authorize for test or https://auth.biostrap.com/authorize for prod
    tokenEndpoint: '', // https://dev.auth.biostrap.com/token for dev or https://auth.biostrap.com/token for prod
    scopes: []
})

// in login route
const biostrapAuthorizationUrl = biostrapAuth.getAuthorizationUrl()

// in the callback route
const tokenData = await biostrapAuth.getToken(code);

const { access_token, refresh_token, expires_in, token_type } = tokenData;

// Save the tokens to use biostrap services. Send them along with the other requests.
  • Example 2: Using require
const BiostrapApi = require('@biostrap/api')

const biostrapAuth = new BiostrapApi.Oauth2({
    clientId: '', // your client id from the oauth app
    clientSecret: '', // your client secret from the oauth app
    redirectUri: '', // your redirect uri
    authorizationEndpoint: '', // https://dev.auth.biostrap.com/authorize for test or https://auth.biostrap.com/authorize for prod
    tokenEndpoint: '', // https://dev.auth.biostrap.com/token for dev or https://auth.biostrap.com/token for prod
    scopes: []
})

// in login route
const biostrapAuthorizationUrl = biostrapAuth.getAuthorizationUrl()

// in the callback route
const tokenData = await biostrapAuth.getToken(code);

const { access_token, refresh_token, expires_in, token_type } = tokenData;

// Save the tokens to use biostrap services. Send them along with the other requests.

Api

Using the saved access_token to retrieve the data of a specific user.

const Biostrap = require('@biostrap/api')
const biostrapApi = new Biostrap.Api({
    access_token: '',
    refresh_token: '',
    environment: 'test' | 'prod'
})

Sleep

Use the above created API instance to fetch sleep details.

try {
const sleep = await biostrapApi.sleep.getDailySleep("2023-03-07");
} catch(err) {
    // handle the error
}
Available methods in Sleep
  • getSleepStats('YYYY-MM-DD')
  • getDailySleep('YYYY-MM-DD')
  • getWeeklySleep('YYYY-MM-DD')
  • getMonthlySleep('YYYY-MM-DD')
  • getYearlySleep('YYYY-MM-DD')

Steps

Available methods in steps
  • getDailySteps('YYYY-MM-DD')
  • getWeeklySteps('YYYY-MM-DD')
  • getMonthlySteps('YYYY-MM-DD')
  • getYearlySteps('YYYY-MM-DD')

Scores

Available methods in scores
  • getDailyScores('YYYY-MM-DD')
  • getDailyRecoveryScores('YYYY-MM-DD')
  • getWeeklyRecoveryScores('YYYY-MM-DD')
  • getMonthlyRecoveryScores('YYYY-MM-DD')
  • getYearlyRecoveryScores('YYYY-MM-DD')

Calorie

Available methods in calorie
  • getDailyCalories('YYYY-MM-DD')
  • getWeeklyCalories('YYYY-MM-DD')
  • getMonthlyCalories('YYYY-MM-DD')
  • getYearlyCalories('YYYY-MM-DD')

Biometrics

Available methods in biometrics
  • getBiometrics(timestamp with millisecond , limit < 50)

Activities

Available methods in activities
  • getActivities(timestamp with millisecond , limit < 50)

For more detailed documentation visit our documentation