You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.5 KiB

5 years ago
# ghutils
**A collection of utility functions for dealing with the GitHub API**
## API
### makeOptions(auth, options)
Helper to make options to pass to [jsonist](http://github.com/rvagg/jsonist) given a GitHub auth from [ghauth](https://github.com/rvagg/ghauth) and any additional options.
### handler(callback)
Takes a JSON response from the GitHub API and turns any errors and applies them properly to the `callback`.
### ghpost(auth, url, data, options, callback)
Make a GitHub API compatible POST request to the given URL via [jsonist](http://github.com/rvagg/jsonist), uses `makeOptions()` to extend the options. Requires a GitHub auth from [ghauth](https://github.com/rvagg/ghauth) and any additional options.
### ghget(auth, url, options, callback)
Make a GitHub API compatible GET request to the given URL via [jsonist](http://github.com/rvagg/jsonist), uses `makeOptions()` to extend the options. Requires a GitHub auth from [ghauth](https://github.com/rvagg/ghauth) and any additional options.
### lister(auth, urlbase, options, callback)
Given a paginated url resource, recursively fetch all available pages of data and return an array containing the complete list.
### apiRoot
The api root url `'https://api.github.com'`.
## License & Copyright
**ghutils** is Copyright (c) 2015 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.