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 = var dribbble = dribbble
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
A Player's Shots
dribbble
Shots by Users Player is Following
dribbble
Shots Liked by Player
dribbble
Users that Follow the Player
dribbble
Users that the Player Follows
dribbble
Users Drafted by the Player
dribbble
Shots
All of the shot-related functions, except for list
, require a shot id.
An Individual Shot's Profile
dribbble
Rebounds of a Shot
dribbble
Comments on a Shot
dribbble
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 // has the same effect as dribbble
Options
Dribbble allows for options to be set. You can set these by passing your options, as an {}
object, just before the callback.
dribbble
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 { // do something} var { if Array popularShots = popularShots if pagingnext pagingnextrequestCallback else } dribbble
Future Plans
- User constructor, similar to the one in the Facebook Graph API
- Performance tweaks