Skip to content

Commit

Permalink
create get labels function
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Feb 3, 2022
1 parent 363ebce commit dc79ab0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@ async function getColumnCardIssues (columnId) {
return cardIssues
}

// Get a list of labels for an issue
// @param {string} issueNumber The number of the issue to fetch labels for
// @return {Promise} A promise representing fetching of the labels for an issue
// @fulfilled {Object} A list of objects each representing a label
// @throws {TypeError} for a parameter of the incorrect type
// @throws {RangeError} when issueNumber is less than 1
// @throws {Error} if an error occurs while trying to fetch the project data
async function getIssueLabels (issueNumber) {
if (!Number.isInteger(issueNumber)) {
throw new TypeError('Param issueNumber must be an integer')
}

return await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/labels', {
owner: owner,
repo: repo,
issue_number: issueNumber
})
}

// Get the project with name passed into projectName from the current repo
// @param {string} projectName The name of the project
// @return {Promise} A promise representing fetching of the project
Expand Down

0 comments on commit dc79ab0

Please sign in to comment.