mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-25 10:01:30 -04:00
577 B
577 B
@octokit/plugins/*
⚠️ Plugins are currently experimental. APIs can change at any time.
Usage
const octokit = require('@octokit/rest')()
function myPlugin (octokit) {
octokit.myMethod = function () {
// ...
}
octokit.hook.before('request', (options) => {
// change options or cancel request.
// return promise for async methods
})
octokit.hook.after('request', (result, options) => {
// ...
})
}
octokit.plugin(myPlugin)
octokit.myMethod()
octokit.request({ url: '/' }) // runs before/after hooks defined above