Fetch counts of a user's contributions to various platforms (Github, NPM, Gem, CPAN, Nuget, ...)
- Github
- NPM
- Rubygems
- CPAN
- Nuget
- Bower
- Component
Send a GET
request to contributor.io/api with each platform/username you'd like as a query parameter.
# install dependencies
npm install
# start server
node server
# send a request!
curl "localhost:5000/api?github=myGithubUsername&npm=myNpmUsername"
# => { github: 42, npm: 66 }
To add Github authentication (optional, increase request limit):
-
Register a Github Application to receive an oauth2
id
andsecret
. -
Define
process.env.github_oauth_id
andprocess.env.github_oauth_secret
somewhere (eg. at the top ofcontributor.coffee
) and set them equal to the keys you got in Step #1. -
Define
process.env.github_user
, and set it equal to the username you want requests to be made under (defaults to the username queried).
# install dependencies
npm install
And in your (coffee)script:
contributor = require 'contributor.io'
contributor
gem: 'bcherny'
github: 'eighttrackmind'
npm: 'bcherny'
cpan: 'fayland'
nuget: 'microsoft'
.then (counts) ->
# returns an object with counts, eg.:
# {
# gem: 20
# github: 50
# npm: 45
# cpan: 67
# nuget: 818
# }
contributor = require 'contributor.io'
contributor.support #=> returns an array of supported platforms
- Node
- CommonJS
- Publish an NPM module which exports a single function that:
- Accepts one or more arguments. The first must be the
username
and the rest must be optional. - Returns a deferred promise.
- A resolved promise must return a single
Number
(aka. the number of contributions). - A rejected promise can return anything, but should ideally be a descriptive
Object
. - Ensure that your module is unit tested, and that promises are resolved and rejected appropriately.
- Accepts one or more arguments. The first must be the
- Fork contributor.io.
- Install your dependency with
npm install --save myNewModuleName
. - Require your module in the list at the top of
contributor.coffee
. - Add a human-readable description to the list at the top of
index.coffee
. - Add it to the list of supported modules in
README.md
, and as a keyword inpackage.json
. - Commit and send a pull request! :)