Skip to content

Commit

Permalink
feat: .issues.replaceLabels() for GHE <= 2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jan 27, 2019
1 parent 5e68c88 commit 6752523
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,33 @@ module.exports = octokitEnterpriseCompatibility

function octokitEnterpriseCompatibility (octokit) {
// see https://github.com/octokit/rest.js/blob/15.x/lib/routes.json#L3046-L3068
const addOrReplaceLabelsOptions = {
params: {
labels: {
required: true,
type: 'string[]',
mapTo: 'data'
},
number: {
required: true,
type: 'integer'
},
owner: {
required: true,
type: 'string'
},
repo: {
required: true,
type: 'string'
}
},
url: '/repos/:owner/:repo/issues/:number/labels'
}

octokit.registerEndpoints({
issues: {
addLabels: {
method: 'POST',
params: {
labels: {
required: true,
type: 'string[]',
mapTo: 'data'
},
number: {
required: true,
type: 'integer'
},
owner: {
required: true,
type: 'string'
},
repo: {
required: true,
type: 'string'
}
},
url: '/repos/:owner/:repo/issues/:number/labels'
}
addLabels: Object.assign({ method: 'POST' }, addOrReplaceLabelsOptions),
replaceLabels: Object.assign({ method: 'PUT' }, addOrReplaceLabelsOptions)
}
})
}

0 comments on commit 6752523

Please sign in to comment.