RepoIssueTypes fetches the available issue types for a repository.
(client *Client, repo ghrepo.Interface)
| 725 | |
| 726 | // RepoIssueTypes fetches the available issue types for a repository. |
| 727 | func RepoIssueTypes(client *Client, repo ghrepo.Interface) ([]IssueType, error) { |
| 728 | query := ` |
| 729 | query RepositoryIssueTypes($owner: String!, $name: String!) { |
| 730 | repository(owner: $owner, name: $name) { |
| 731 | issueTypes(first: 50) { |
| 732 | nodes { id, name, description, color } |
| 733 | } |
| 734 | } |
| 735 | }` |
| 736 | variables := map[string]interface{}{ |
| 737 | "owner": repo.RepoOwner(), |
| 738 | "name": repo.RepoName(), |
| 739 | } |
| 740 | var result struct { |
| 741 | Repository struct { |
| 742 | IssueTypes struct { |
| 743 | Nodes []IssueType |
| 744 | } |
| 745 | } |
| 746 | } |
| 747 | err := client.GraphQL(repo.RepoHost(), query, variables, &result) |
| 748 | if err != nil { |
| 749 | return nil, err |
| 750 | } |
| 751 | return result.Repository.IssueTypes.Nodes, nil |
| 752 | } |
| 753 | |
| 754 | // IssueNodeID fetches the node ID for an issue given its number and repository. |
| 755 | func IssueNodeID(client *Client, repo ghrepo.Interface, number int) (string, error) { |
no test coverage detected