0.0.6 • Published 10 years ago
github-api-tool v0.0.6
Tools to implement GitHub API clients
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.