mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-15 02:18:58 +08:00
28 lines
809 B
JavaScript
28 lines
809 B
JavaScript
const Octokit = require('@octokit/rest')
|
|
|
|
const addPagination = require('./pagination')
|
|
const addRateLimiting = require('./rate-limiting')
|
|
const addLogging = require('./logging')
|
|
const addGraphQL = require('./graphql')
|
|
|
|
/**
|
|
* the [@octokit/rest Node.js module](https://github.com/octokit/rest.js),
|
|
* which wraps the [GitHub API](https://developer.github.com/v3/) and allows
|
|
* you to do almost anything programmatically that you can do through a web
|
|
* browser.
|
|
* @typedef github
|
|
* @see {@link https://github.com/octokit/rest.js}
|
|
*/
|
|
function EnhancedGitHubClient (options = {}) {
|
|
const octokit = Octokit(options)
|
|
|
|
addRateLimiting(octokit, options.limiter)
|
|
addLogging(octokit, options.logger)
|
|
addPagination(octokit)
|
|
addGraphQL(octokit)
|
|
|
|
return octokit
|
|
}
|
|
|
|
module.exports = EnhancedGitHubClient
|