ListLabels lists all labels for a repository. GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-a-repository meta:operation GET /repos/{owner}/{repo}/labels
(ctx context.Context, owner, repo string, opts *ListOptions)
| 31 | // |
| 32 | //meta:operation GET /repos/{owner}/{repo}/labels |
| 33 | func (s *IssuesService) ListLabels(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Label, *Response, error) { |
| 34 | u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) |
| 35 | u, err := addOptions(u, opts) |
| 36 | if err != nil { |
| 37 | return nil, nil, err |
| 38 | } |
| 39 | |
| 40 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 41 | if err != nil { |
| 42 | return nil, nil, err |
| 43 | } |
| 44 | |
| 45 | var labels []*Label |
| 46 | resp, err := s.client.Do(req, &labels) |
| 47 | if err != nil { |
| 48 | return nil, resp, err |
| 49 | } |
| 50 | |
| 51 | return labels, resp, nil |
| 52 | } |
| 53 | |
| 54 | // GetLabel gets a single label. |
| 55 | // |