MCPcopy Index your code
hub / github.com/cli/cli / IssueNodeID

Function IssueNodeID

api/queries_issue.go:755–781  ·  view source on GitHub ↗

IssueNodeID fetches the node ID for an issue given its number and repository.

(client *Client, repo ghrepo.Interface, number int)

Source from the content-addressed store, hash-verified

753
754// IssueNodeID fetches the node ID for an issue given its number and repository.
755func IssueNodeID(client *Client, repo ghrepo.Interface, number int) (string, error) {
756 query := `
757 query IssueNodeID($owner: String!, $name: String!, $number: Int!) {
758 repository(owner: $owner, name: $name) {
759 issue(number: $number) {
760 id
761 }
762 }
763 }`
764 variables := map[string]interface{}{
765 "owner": repo.RepoOwner(),
766 "name": repo.RepoName(),
767 "number": number,
768 }
769 var result struct {
770 Repository struct {
771 Issue struct {
772 ID string
773 }
774 }
775 }
776 err := client.GraphQL(repo.RepoHost(), query, variables, &result)
777 if err != nil {
778 return "", err
779 }
780 return result.Repository.Issue.ID, nil
781}

Callers 1

ResolveIssueRefFunction · 0.92

Calls 4

GraphQLMethod · 0.80
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected