0.0.6 • Published 10 years ago

github-api-tool v0.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
10 years ago

Tools to implement GitHub API clients

Build Status Supercharged by Zenhub.io

This package includes some utilities to implement Github API clients.

Installation

Using npm:

npm install github-api-tol

Using bower:

bower install github-api-tool

Example using node.js

var Promise = require('bluebird');
var request = require('request');

var GithubApiTool = require('github-api-tool');

var doRequest = function(opts) {
  return new Promise(function(resolve, reject){
    request({
      url: opts.uri,
      baseUrl: opts.baseUri,
      qs: opts.qs,
      headers: opts.headers,
      method: opts.method,
    } , function(err, res, body) {
      if (err) {
        return reject(err);
      }
      resolve({
        headers: res.headers,
        body: res.body,
        status: res.statusCode,
      });
    });
  });
};

var ghApi = new GithubApiTool({request: doRequest});
ghApi.request({
  method: 'GET',
  url: '/user/repos',
  token: 'MYTOKEN',
  qs: {
    type: 'owner',
    sort: 'pushed',
    direction: 'desc',
    per_page: 100
  },
  fetchAll: true
}).then(function(myRepos){
  // Do something with the repos.
});

Contributing

Please check CONTRIBUTING.md.

This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.

Author

Collaborators

License

MIT

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago