A node module for interfacing with the Github API
npm install github-api-promiseA node module for interfacing with the Github API using promises. The full GitHub API documentation can be found at https://developer.github.com/v3/.
``bash`
npm install github-api-promise
- Documentation
- 
TLDR;
1. import _github-api-promise_
2. Set settings
3. Make API calls
Basic example code:
`JavaScript
import api from "github-api-promise";
// Set settings
api.config.owner = 'OwnersGithubUsername';
api.config.repo = 'RepoName';
api.config.token = 'YourAccessToken';
api.config.debug = true; // Default is false. Logs request information via console.log when true.
// Do stuff
api.repos.releases.getRepositoryReleases()
.then((res) => {
// Do your stuff here. res is the JSON object returned by the API
})
.catch((err) => {
console.log(Request failed: ${err});``
});
For help creating an access token, see the GitHub help article Creating an Access Token for Command Line Use. This package only requires either the _repo_ scope for private repos or the _public_repo_ scope for public repos.
The following APIs are supported. PRs welcome!
- Activity
- Events
- Issues
- Comments
- Events
- Issues
- Pull Requests
- Comments
- Pull Requests
- Repositories
- Commits
- Contents
- Releases
- Repositories
- Teams
- Teams
Special thanks to jeejkang for the Stormtroopocat image!
Thanks to aktau/github-release (a library for GO) for the inspiration for this project.