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

node-boxfish

v1.0.0

Published

Boxfish's Javacript API interface.

Downloads

6

Readme

Boxfish Node API

This is the Node.js interface for the Boxfish API.

Install

Install via npm.

$ npm install boxfish

Features

  • Interactive REPL
  • Auto generated documentation (npm run doc)

Usage

Require the API in your program.

var Boxfish = require("boxfish");

Boxfish.authorize("cake", "candle").then(function() {
	return Boxfish.channels.getServices();
}).then(function(services) {
	console.log("Services!")
}).catch(function(err) {
	console.log("Oh no, error!");
});

One of the main features of the Boxfish API is ease of use so try using the API in the REPL. It adds several helper functions to make testing a real treat.

$ node
> var Boxfish = require("boxfish");
Welcome to the Boxfish API.

Each API function has it's own .help() function. For a list
of functions, use .list(). Have fun playing around. Don't
forget to .authorize() first with your credentials.

Examples:
  Boxfish.channels.help(); // List of channel functions
  Boxfish.channels.getServices.help() // Parameters required

> Boxfish.authorize("cake", "candle");

Methods

The API has the following namespaces:

  • channels - Channels provides channel lists for provided ZIP codes, services and related content. See channels.

      Boxfish.channels.getServices( :zipcode ) ✔
      Boxfish.channels.createLineup( :service ) ✔
      Boxfish.channels.getLineup( :lineupId ) ✔
      Boxfish.channels.getRelatedContent( :channels, :channelType, :time ) [REVIEW]
      Boxfish.channels.getThumbnails( :channels, :channelType, :time, :size ) ✔ [REVIEW]
      Boxfish.channels.getDiscussions( :channels, :channelType, :lineupId, :time ) ✔ [REVIEW]
  • trending - The trending discussions endpoint provides search results for currently trending topics.

      Boxfish.trending.getTopics( :category ) ✔
      Boxfish.trending.getDicussions( :category, :lineupId ) ✔
  • topics - Get tags or entities for programs.

      Boxfish.topics.getChannelTags( :channels, :channelType, :startTime, :endTime ) ✔
      Boxfish.topics.getChannelTagsLatest( :channels, :channelType, :date ) ✔ [REVIEW]
      Boxfish.topics.getChannelEntities( :channels, :channelType, :startTime, :endTime ) ✔
      Boxfish.topics.getChannelEntitiesLatest( :channels, :channelType, :date ) ✔ [REVIEW]
      Boxfish.topics.getRelated( :topic ) [REVIEW]
  • search - Search tags, programs, channels or all.

      Boxfish.search.all( :query, :lineupId, :categories, :limit, :types ) ✔
      Boxfish.search.mentions( :query, :lineupId, :categories ) ✔
      Boxfish.search.programs( :query, :lineupId ) ✔
      Boxfish.search.channels( :query, :lineupId ) ✔
  • metrics - Metrics provides real time updated statistics for entity keywords or expressions, minute by minute, or aggregated by year, month, day or hour.

      Boxfish.metrics.getMentions( :keywords, :start, :stop ) ✔
      Boxfish.metrics.getChannels( :keywords, :channels, :channelType, :start, :stop ) ✔
      Boxfish.metrics.getCount( :keywords, :channels, :channelType, :start, :stop ) ✔
      Boxfish.metrics.getGraph( :keywords, :channels, :channelType, :start, :stop ) ✔
  • epg - Thse epg endpoint provides access to program (TV show) EPG data.

      Boxfish.epg.getSchedule( :channels, :channelType, :lineupId, :start, :stop, :category ) ✔
      Boxfish.epg.getGuide( :lineupId, :start, :stop, :category ) ✔

Every API methods can be called in the following ways:

1. Using a callback.

Boxfish.channels.getServices(89083, function(err, data) {
	if(err) console.log("Oh noes! Error!");
	else console.log("Got dem services", data);
});

2. Using promises.

Boxfish.channels.getServices(89083).then(function(data) {
	console.log("Got dem services", data);
}).catch(function(err) {
	console.log("Oh noes! Error!");
});

3. Implicit arguments. So if we had an API function that required the following data; startTime, endTime, count, we can implicitly pass those arguments in that order to the function. (Promises are supported here if callback is omitted!)

Boxfish.search.programs("obama", "231jk4hkj-the-cake-is-a-lie-123jdk", function(err, data) {
	if(err) console.log("Oh noes! Error!");
	else console.log("Your programs: ", data);
});

4. Explicit arguments. Instead of passing the arguments as a list, you can pass them in an object so order does not matter.

Boxfish.search.programs({
	lineupId: "231jk4hkj-the-cake-is-a-lie-123jdk",
	query: "obama"
}, function(err, data) {
	if(err) console.log("Oh noes! Error!");
	else console.log("Your programs: ", data);
});

5. Using a callback, but getting request stream. WARNING: This method does not handle any errors in the request. That's up to you.

Boxfish.search.programs("obama", "231jk4hkj-the-cake-is-a-lie-123jdk", function(request) {
	request.pipe(fs.createWriteStream("./my-programs.json"));
});

Channels

Channels provide channel lists for provided ZIP codes and service providers.

TODO

  • Emit errors on the API object.
  • Automate testing. The Endpoint tests work but are silly.
  • Have <fn>.example() run an example request using example data.