Can someone please point me in the right direction for listing all open issues that are in repos owned by the user? Thanks in advance.
To communicate with GitHub's GraphQL API, fill in the header name with "Authorization" and the header value with "bearer [your personal access token]". Save this new header for your GraphiQL application. Finally, you are ready to make requests to GitHub's GraphQL API with your GraphiQL application.
To create integrations, retrieve data, and automate your workflows, use the GitHub GraphQL API. The GitHub GraphQL API offers more precise and flexible queries than the GitHub REST API. Overview.
To use the explorer, we'll head to studio.apollographql.com/dev and create an account (using either GitHub or your email). Finally, choose a name for your graph, select the “Development” graph type, add your localhost endpoint (Apollo Server's default is http://localhost:4000), and click “Create Graph”. And that's it!
GraphQL is a query language and server-side runtime for application programming interfaces (APIs) that prioritizes giving clients exactly the data they request and no more. GraphQL is designed to make APIs fast, flexible, and developer-friendly.
I think I've figured it out. Please let me know if there's a more optimal answer.
query {
search(first: 100, type: ISSUE, query: "user:will-stone state:open") {
issueCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
... on Issue {
createdAt
title
url,
repository {
name
}
}
}
}
}
}
Your answer is probably the most efficient way in terms of pagination, but another approach you could take is to iterate over all of the user's owned repositories, and for each of those repositories fetch their issues with something like:
query($userLogin: String!) {
user(login: $userLogin) {
repositories(affiliations: [OWNER], last: 10) {
edges {
node {
issues(states: [OPEN], last: 10) {
edges {
node {
createdAt
title
url
repository {
name
}
}
}
}
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With