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 🙏

© 2024 – Pkg Stats / Ryan Hefner

beeminder

v2.0.0

Published

NodeJS wrapper for the Beeminder API

Downloads

92

Readme

beeminderjs

NodeJS wrapper for the Beeminder API. Created for integration with Complice, a productivity app that's more qualified-self than quantified-self.

BeeminderJS is designed for use within NodeJS apps, although it also works in a very basic rudimentary way from command-line. I'm open to people contributing new functions to either purpose!

Install to your node project

npm install --save beeminder

Usage as a library

As of 2.0.0, promises only. Errors may also be slightly different, due to using fetch instead of curlrequest.

Refer to the Beeminder API docs for information on goal creation parameters or what will be returned when calling these endpoints.

var beeminder = require('beeminder')
var bm = beeminder(auth_token)

bm.getUser(function (err, result) {
  console.log(err || result)
  // do something
})

bm.getGoal('goalslug', function (err, result) {...})

bm.createGoal('goalslug', params, function (err, result) {...})

bm.getDatapoints('goalslug', function (err, result) {...})

bm.createDatapoint('goalslug', {
  value: 1, // {type: Number, required: true},
  timestamp: new Date("2015-02-21").valueOf() // {type: Number, default: now},
  comment: 'updated readme',
  sendmail: true, // if you want the user to be emailed
  // requestid allows you to run command again without creating duplicate datapoints
  requestid: 'thisHasToBeAlphanumericWhichIsWhyThereAreNoSpaces',
}, function (err, result) {...})

bm.createGoal('goalslug', params).then(function () {
  return bm.createDatapoints('goalslug', [{...}])
}).then(function () {
  res.send('Created goal and added datapoints')  
}).catch(...)

Install as a command-line tool

sudo npm install --global beeminder

bm # run this once to ensure you're authenticated

Usage as a command-line tool

bm user
bm status # outputs a list of goals sorted by derail time
bm goal <goalslug>
bm datapoints <goalslug>
bm createdatapoint <goalslug> <value> [<optional comment, in quotes if it has a space>]
bm cd # same as createdatapoint

Example

I have the following in .bash_aliases, which allows me to post a user-visible improvement simultaneously to beeminder (m/complice-uvi) and twitter (@compluvi). Requires the twitter bash client t, available here (although barely still supported since it uses an old version of Ruby and an unavailable-for-new-apps Twitter API).

uvi () {
  bm cd complice-uvi 1 "$@"
  t update "$@"
}

# example
uvi "UVIs will be posted more frequently because I can now post them from command line :D"

todo

  • implement other endpoints (feel free to ask for them or to submit pull requests)