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 --saveInstall using yarn
$ yarn add github-adapterUsage
// 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
callbackrequestCallback
getCurrentUser
Gets the current user for the token passed
Parameters
callbackrequestCallback
postIssue
Posts the issue
Parameters
ownerstring Github username or orgnamerepostring Github repository namebodyobject Body of the issuecallbackrequestCallback
getIssue
Gets a issue
Parameters
ownerstring Github username or orgnamerepostring Github repository namenumbernumber Issue numbercallbackrequestCallback
getPR
Gets a pull request
Parameters
ownerstring Github username or orgnamerepostring Github repository namenumbernumber Pull Request numbercallbackrequestCallback
getPRDiff
Gets the diff version of a pull request
Parameters
ownerstring Github username or orgnamerepostring Github repository namenumbernumber Pull Request numbercallbackrequestCallback
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
ownerstring Github username or orgnamerepostring Github repository namenumbernumber Pull Request numbercallbackrequestCallback
getRawContent
Gets the raw content for a given full URL
Parameters
urlstring Absolute full url. Generally the value of propertyraw_urlcallbackrequestCallback
postPRComment
Creates a comment on a given line of a given PR
Parameters
ownerstring Github username or orgnamerepostring Github repository namenumbernumber Pull Request numberbodyobject Comment InputcallbackrequestCallback
requestCallback
This callback is displayed as part of the Requester class.
Parameters
