github-adapter v0.1.0
Github Adapter
A small javascript adapter library to help other javascript projects to use Github API.
Installation
Install using npm
$ npm install github-adapter --save
Install using yarn
$ yarn add github-adapter
Usage
// es6
import GithubAdapter from 'github-adapter';
// es5
var GithubAdapter = require('github-adapter');
Initialize the adapter using the github token
var adapter = new GithubAdapter(token);
Following API calls are supported
API
getRateLimit
Gets the current rate limit status set by the rate-limit-rules using this method
Parameters
callback
requestCallback
getCurrentUser
Gets the current user for the token passed
Parameters
callback
requestCallback
postIssue
Posts the issue
Parameters
owner
string Github username or orgnamerepo
string Github repository namebody
object Body of the issuecallback
requestCallback
getIssue
Gets a issue
Parameters
owner
string Github username or orgnamerepo
string Github repository namenumber
number Issue numbercallback
requestCallback
getPR
Gets a pull request
Parameters
owner
string Github username or orgnamerepo
string Github repository namenumber
number Pull Request numbercallback
requestCallback
getPRDiff
Gets the diff version of a pull request
Parameters
owner
string Github username or orgnamerepo
string Github repository namenumber
number Pull Request numbercallback
requestCallback
getPRFiles
Gets the list of files created/updated in the pull request. This also contains the patch which can be used to know the changes made to the file.
Parameters
owner
string Github username or orgnamerepo
string Github repository namenumber
number Pull Request numbercallback
requestCallback
getRawContent
Gets the raw content for a given full URL
Parameters
url
string Absolute full url. Generally the value of propertyraw_url
callback
requestCallback
postPRComment
Creates a comment on a given line of a given PR
Parameters
owner
string Github username or orgnamerepo
string Github repository namenumber
number Pull Request numberbody
object Comment Inputcallback
requestCallback
requestCallback
This callback is displayed as part of the Requester class.
Parameters