Skip to content
Open
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
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ linters:
- CodeScanningAlertState
- ConfigApplyOptions
- ConfigSettings
- CreateOrUpdateIssueTypesOptions
- CreateUpdateEnvironment
- CreateWorkflowDispatchEventRequest
- CustomDeploymentProtectionRuleRequest
Expand Down Expand Up @@ -244,7 +243,6 @@ linters:
- ConfigApplyOptions
- CreateCheckRunOptions
- CreateCheckSuiteOptions
- CreateOrUpdateIssueTypesOptions
- InstallationTokenListRepoOptions
- InstallationTokenOptions
- LockIssueOptions
Expand Down
104 changes: 64 additions & 40 deletions github/github-accessors.go

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

125 changes: 76 additions & 49 deletions github/github-accessors_test.go

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

21 changes: 14 additions & 7 deletions github/orgs_issue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import (
"fmt"
)

// CreateOrUpdateIssueTypesOptions represents the parameters for creating or updating an issue type.
type CreateOrUpdateIssueTypesOptions struct {
// CreateIssueTypeRequest represents the parameters to create an issue type.
type CreateIssueTypeRequest struct {
Name string `json:"name"` // Name of the issue type. (Required.)
IsEnabled bool `json:"is_enabled"` // Whether or not the issue type is enabled at the organization level. (Required.)
IsPrivate *bool `json:"is_private,omitempty"` // Whether or not the issue type is restricted to issues in private repositories. (Optional.)
Description *string `json:"description,omitempty"` // Description of the issue type. (Optional.)
Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", green "orange", "red", "pink", "purple", "null". (Optional.)
Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", "green", "yellow", "orange", "red", "pink", "purple", "null". (Optional.)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", "green", "yellow", "orange", "red", "pink", "purple", "null". (Optional.)
Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", "green", "yellow", "orange", "red", "pink", "purple". (Optional.)

}

// UpdateIssueTypeRequest represents the parameters to update an issue type.
type UpdateIssueTypeRequest struct {
Name string `json:"name"` // Name of the issue type. (Required.)
IsEnabled bool `json:"is_enabled"` // Whether or not the issue type is enabled at the organization level. (Required.)
Description *string `json:"description,omitempty"` // Description of the issue type. (Optional.)
Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", "green", "yellow", "orange", "red", "pink", "purple", "null". (Optional.)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", "green", "yellow", "orange", "red", "pink", "purple", "null". (Optional.)
Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", "green", "yellow", "orange", "red", "pink", "purple". (Optional.)

}

// ListIssueTypes lists all issue types for an organization.
Expand Down Expand Up @@ -46,7 +53,7 @@ func (s *OrganizationsService) ListIssueTypes(ctx context.Context, org string) (
// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#create-issue-type-for-an-organization
//
//meta:operation POST /orgs/{org}/issue-types
func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, body *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) {
func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, body CreateIssueTypeRequest) (*IssueType, *Response, error) {
u := fmt.Sprintf("orgs/%v/issue-types", org)
req, err := s.client.NewRequest(ctx, "POST", u, body)
if err != nil {
Expand All @@ -62,12 +69,12 @@ func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string,
return issueType, resp, nil
}

// UpdateIssueType updates GitHub Pages for the named repo.
// UpdateIssueType updates an issue type for an organization.
//
// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#update-issue-type-for-an-organization
//
//meta:operation PUT /orgs/{org}/issue-types/{issue_type_id}
func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, body *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) {
func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, body UpdateIssueTypeRequest) (*IssueType, *Response, error) {
u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
Expand Down
6 changes: 2 additions & 4 deletions github/orgs_issue_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ func TestOrganizationsService_CreateIssueType(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)

input := &CreateOrUpdateIssueTypesOptions{
input := CreateIssueTypeRequest{
Name: "Epic",
Description: new("An issue type for a multi-week tracking of work"),
IsEnabled: true,
Color: new("green"),
IsPrivate: new(true),
}

mux.HandleFunc("/orgs/o/issue-types", func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -150,12 +149,11 @@ func TestOrganizationsService_UpdateIssueType(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)

input := &CreateOrUpdateIssueTypesOptions{
input := UpdateIssueTypeRequest{
Name: "Epic",
Description: new("An issue type for a multi-week tracking of work"),
IsEnabled: true,
Color: new("green"),
IsPrivate: new(true),
}

mux.HandleFunc("/orgs/o/issue-types/410", func(w http.ResponseWriter, r *http.Request) {
Expand Down
Loading