+
Skip to content

feat: Add support for Issue Types API #3525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ff58ec2
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz Feb 20, 2025
b2f14c8
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz Feb 20, 2025
5da58b1
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz Feb 21, 2025
0b1dc04
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz Feb 21, 2025
f4ab50f
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz Feb 21, 2025
9b50e82
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz Feb 21, 2025
4f5c3ec
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz Feb 21, 2025
6ecf469
feat: Refactor hosted runner request handling: Use shared struct and …
atilsensalduz Feb 25, 2025
5167f45
feat: Refactor hosted runner request handling: Use shared struct and …
atilsensalduz Feb 25, 2025
65910b7
feat: Refactor hosted runner request handling: Use shared struct and …
atilsensalduz Feb 25, 2025
22d4aba
refactor: improve error handling by preserving the original error con…
atilsensalduz Feb 26, 2025
a2199bb
refactor: improve error handling by preserving the original error con…
atilsensalduz Feb 26, 2025
69acb87
Merge branch 'google:master' into master
atilsensalduz Mar 19, 2025
56f4c18
feat: add support for Issue Types API
atilsensalduz Mar 20, 2025
cca495e
feat: add support for Issue Types API
atilsensalduz Mar 20, 2025
15b891e
feat: add support for Issue Types API
atilsensalduz Mar 20, 2025
f605f76
feat: add support for Issue Types API
atilsensalduz Mar 20, 2025
72f1988
Merge branch 'master' into add-issue-type
atilsensalduz Mar 20, 2025
d39244c
feat: add support for Issue Types API
atilsensalduz Mar 20, 2025
8a6fa7d
feat: add support for Issue Types API
atilsensalduz Mar 20, 2025
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
24 changes: 24 additions & 0 deletions github/github-accessors.go

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

33 changes: 33 additions & 0 deletions github/github-accessors_test.go

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

99 changes: 99 additions & 0 deletions github/orgs_issue_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
"context"
"fmt"
)

// CreateOrUpdateIssueTypesOptions represents the parameters for creating or updating an issue type.
type CreateOrUpdateIssueTypesOptions 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.)
}

// ListIssueTypes lists all issue types for an organization.
//
// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#list-issue-types-for-an-organization
//
//meta:operation GET /orgs/{org}/issue-types
func (s *OrganizationsService) ListIssueTypes(ctx context.Context, org string) ([]*IssueType, *Response, error) {
u := fmt.Sprintf("orgs/%v/issue-types", org)

req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}

var issueTypes []*IssueType
resp, err := s.client.Do(ctx, req, &issueTypes)
if err != nil {
return nil, resp, err
}

return issueTypes, resp, nil
}

// CreateIssueType creates a new issue type for an organization.
//
// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#create-issue-type-for-an-organization
//
//meta:operation POST /orgs/{org}/issue-types
func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) {
u := fmt.Sprintf("orgs/%v/issue-types", org)
req, err := s.client.NewRequest("POST", u, opt)
if err != nil {
return nil, nil, err
}

issueType := new(IssueType)
resp, err := s.client.Do(ctx, req, issueType)
if err != nil {
return nil, resp, err
}

return issueType, resp, nil
}

// UpdateIssueType updates GitHub Pages for the named repo.
//
// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#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, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) {
u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID)
req, err := s.client.NewRequest("PUT", u, opt)
if err != nil {
return nil, nil, err
}

issueType := new(IssueType)
resp, err := s.client.Do(ctx, req, issueType)
if err != nil {
return nil, resp, err
}

return issueType, resp, nil
}

// DeleteIssueType deletes an issue type for an organization.
//
// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#delete-issue-type-for-an-organization
//
//meta:operation DELETE /orgs/{org}/issue-types/{issue_type_id}
func (s *OrganizationsService) DeleteIssueType(ctx context.Context, org string, issueTypeID int64) (*Response, error) {
u := fmt.Sprintf("orgs/%v/issue-types/%d", org, issueTypeID)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}

return s.client.Do(ctx, req, nil)
}
Loading
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载