Reputation: 1581
I am trying to return a list of Github issues from a private repo using Node.js. I am able to return a list of the repos, but am struggling to return the issues.
It appears that you can list the issues with the list_issues
function based on the documentation here https://octokit.github.io/octokit.rb/Octokit/Client/Issues.html
. However, I get an error when trying to access the function.
const octokit = require('@octokit/rest')()
octokit.authenticate({
type: 'basic',
username: 'username',
password: 'password'
})
octokit.repos.getForOrg({
org: 'name_of_organization',
type: 'private'
}).then(({data, headers, status}) => {
console.log(data) // returns list of repos as JSON
})
octokit.list_issues("name_of_org/name_of_repo")
.then(({data, headers, status}) => {
console.log(data) // error: octokit.list_issues in not a function
})
How can I return a list of private issues as JSON from Github?
Upvotes: 1
Views: 957
Reputation: 1581
Based on the documentation at: https://octokit.github.io/rest.js/#api-Search-issues
While using the same authentication code block an example request might look like:
octokit.issues.getAll({
filter: 'all',
state: 'open',
labels: '',
sort: 'updated',
direction: 'desc',
since: '2018-07-01T00:00:00Z',
per_page: '100',
page: '1'})
.then(result => {
console.log(result)
})
.catch(err => {
console.log(err)
})
Upvotes: 1