Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ linters:
- IssueComment
- IssueImportRequest
- Key
- Label
- LockIssueOptions
- MaintenanceOptions
- Milestone
Expand Down
84 changes: 66 additions & 18 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 69 additions & 24 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 24 additions & 10 deletions github/issues_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,33 @@ import (

// Label represents a GitHub label on an Issue.
type Label struct {
ID *int64 `json:"id,omitempty"`
URL *string `json:"url,omitempty"`
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
Description *string `json:"description,omitempty"`
Default *bool `json:"default,omitempty"`
NodeID *string `json:"node_id,omitempty"`
ID int64 `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Color string `json:"color"`
Description *string `json:"description"`
Default bool `json:"default"`
NodeID string `json:"node_id"`
}

func (l Label) String() string {
return Stringify(l)
}

// CreateIssueLabelRequest represents a request to create a label.
type CreateIssueLabelRequest struct {
Name string `json:"name"`
Color *string `json:"color,omitempty"`
Description *string `json:"description,omitempty"`
}

// UpdateIssueLabelRequest represents a request to update a label.
type UpdateIssueLabelRequest struct {
NewName *string `json:"new_name,omitempty"`
Color *string `json:"color,omitempty"`
Description *string `json:"description,omitempty"`
}

// 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
Expand Down Expand Up @@ -77,7 +91,7 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner, repo, name string)
// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#create-a-label
//
//meta:operation POST /repos/{owner}/{repo}/labels
func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, body *Label) (*Label, *Response, error) {
func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, body CreateIssueLabelRequest) (*Label, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
req, err := s.client.NewRequest(ctx, "POST", u, body)
if err != nil {
Expand All @@ -93,12 +107,12 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, bod
return l, resp, nil
}

// EditLabel edits a label.
// UpdateLabel updates a label.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#update-a-label
//
//meta:operation PATCH /repos/{owner}/{repo}/labels/{name}
func (s *IssuesService) EditLabel(ctx context.Context, owner, repo, name string, body *Label) (*Label, *Response, error) {
func (s *IssuesService) UpdateLabel(ctx context.Context, owner, repo, name string, body UpdateIssueLabelRequest) (*Label, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
req, err := s.client.NewRequest(ctx, "PATCH", u, body)
if err != nil {
Expand Down
Loading
Loading