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

dribbble-api

v0.0.3

Published

Node.js wrapper for the Dribbble API

Downloads

3

Readme

Dribbble Api 0.0.3

What's this?

This is a node module, serving as Dribbble API wrapper. See the Dribbble API docs for more details.

Installation

The easiest way to install is via npm

npm install dribbble-api

Otherwise, you can install this is by taking the code and sticking it in your node_modules folder.

Usage

Dribbble doesn't (yet) require any sort of auth key or access token. Still, this module is a constructor. This way, if things change and keys are required, the constructor would be utilized and legacy code would be less effected.

Making a request looks something like this:

var dribbbleApi = require('dribbble-api')

var dribbble = new dribbbleApi()

dribbble.list('debuts', function(err, res, json, paging) { })

Every callback gets four arguments; An error (if there is one), the HTTP response, a JSON object (probably what you will want) and a paging object (more on this in the paging section).

Player

All of the player-related functions require a player id (or username).

Player Profile

dribbble.player('44656', function(err, res, json, paging) {
	console.log(json)
})

A Player's Shots

dribbble.playerShots('44656', function(err, res, json, paging) {
	console.log(json)	// json.shots
})

Shots by Users Player is Following

dribbble.playerFollowingShots('44656', function(err, res, json, paging) {
	console.log(json)	// json.shots
})

Shots Liked by Player

dribbble.playerLikes('44656', function(err, res, json, paging) {
	console.log(json)	// json.shots
})

Users that Follow the Player

dribbble.playerFollowers('44656', function(err, res, json, paging) {
	console.log(json)	// json.players
})

Users that the Player Follows

dribbble.playerFollows('44656', function(err, res, json, paging) {
	console.log(json)	// json.players
})

Users Drafted by the Player

dribbble.playerDraftees('44656', function(err, res, json, paging) {
	console.log(json)	// json.players
})

Shots

All of the shot-related functions, except for list, require a shot id.

An Individual Shot's Profile

dribbble.shot('300230', function(err, res, json, paging) {
	console.log(json)
})

Rebounds of a Shot

dribbble.shotRebounds('43424', function(err, res, json, paging) {
	console.log(json) 	// json.shots
})

Comments on a Shot

dribbble.shotComments('43424', function(err, res, json, paging) {
	console.log(json) 	// json.comments
})

Lists of Shots

This one is a bit different. It doesn't take a shot id. Instead it takes the name of a list.

Possible names are popular, debuts and everyone.

If you don't pass a list name it will default to popular.

dribbble.list('popular', function(err, res, json, paging) {
	console.log(json) 	// json.shots
})

// has the same effect as

dribbble.list(function(err, res, json, paging) {
	console.log(json) 	// json.shots
})

Options

Dribbble allows for options to be set. You can set these by passing your options, as an {} object, just before the callback.

dribbble.lists('debuts', { per_page: 30, page: 5 }, function(err, res, json, paging) { })

Paging

The paging object returned to the callbacks may contain a next or previous function. These functions allow you to make another request, using the same arguments passed before, but with a new callback.

Here's an example where we request as many pages as we can, from the 'popular list', and add all resulting shots to the popularShots array. Once this is done we'll call onRequestsFinished.

var popularShots = []

var onRequestsFinished = function() {
	// do something
}

var requestCallback = function(err, res, json, paging) {
	if (Array.isArray(json.shots)) {
		popularShots = popularShots.concat(json.shots)
	}

	if (paging.next) {
		paging.next(requestCallback)
	}
	else {
		onRequestsFinished()
	}
}

dribbble.list('popular', requestCallback)

Future Plans