ghapi

0.0.5 • Public • Published

github api (ghapi)

A github api for node and the browser.

Usage

npm install ghapi
var api = require('ghapi')
api(command, arg_1, ..., arg_n [, parameters, callback])

See commands.js for a list of all the commands. The file is compiled by scraping all the commands form the Github API documentation. Consult the Github documentation for parameters associated with each api call. For commands requiring authentication, append an auth object to parameters.

Create a new gist

POST /gists
api('createGist', parameters)
var files = { 
  'api.txt': { 
    content: 'hello!' 
  }
}
var basicAuth = { 
  user: 'user', 
  pass: 'pass' 
}
api('createGist', { files: files, auth: basicAuth }).pipe(process.stdout);

Fork a gist

POST /gists/:id/forks
api('createGistFork', id, parameters);
var bearerAuth = { bearer: 'access token' } // github access token
api('createGistFork', '1',  { auth: bearerAuth }, function (err, res, body) {
  console.log(body);
});

Todo

  • Add tests and documentation

Readme

Keywords

none

Package Sidebar

Install

npm i ghapi

Weekly Downloads

2

Version

0.0.5

License

ISC

Last publish

Collaborators

  • lukeburns