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

foobotjs

v0.0.4

Published

Foobot node SDK

Downloads

8

Readme

Foobot Node SDK

Foobot API documentation

This is a simple SDK that wraps the Foobot API. In order to use it, get yourself a foobot and create a user with a password and an API key (secret key).

Usage

Create a Foobot with new Foobot(user, password, key). You can also pass in the version as a fourth argument. Currently, only v2 is supported and is the default.

Use either of:

import Foobot from "foobotjs";
const Foobot = require("foobotjs").default

The API is promise-based, so all methods return promises.

Foobot

The Foobot object makes requests to the Foobot API on your behalf based on the credentials you provide.

getDevices

Returns a list of Devices associated with this user.

const devices = await foobot.getDevices();
devices.map(device => console.log(device.uuid));

getDataPoints

Requests getDataPoints for the first Device on your account. Useful if you only have one device.

Device

You shouldn't need to instantiate a device, but this object is returned from getDevices.

getDataPoints

This takes one to three arguments:

  • period / start (default: 0, only start if end is provided)
  • averageBy (default: 0)
  • end (default: "last")

Gets data points over the requested period and provided average time. If end (third argument) is not provided, the start is considered the period and you will get the latest data points automatically. Use no arguments to get the last data point.

Example

This will get all registered devices and print out the last data point for each:

const foobot = new Foobot(USER, PASS, KEY);
(async () => {
    const devices = await foobot.getDevices();
    const dataPointResults = await Promise.all(devices.map(device => device.getDataPoints()));
    dataPointResults.map(dataPointResult => console.log(dataPointResult.datapoints[0]));
})();