-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
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 b2f14c8
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz 5da58b1
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz 0b1dc04
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz f4ab50f
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz 9b50e82
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz 4f5c3ec
feat(actions): add support for GitHub-hosted runner API endpoints
atilsensalduz 6ecf469
feat: Refactor hosted runner request handling: Use shared struct and …
atilsensalduz 5167f45
feat: Refactor hosted runner request handling: Use shared struct and …
atilsensalduz 65910b7
feat: Refactor hosted runner request handling: Use shared struct and …
atilsensalduz 22d4aba
refactor: improve error handling by preserving the original error con…
atilsensalduz a2199bb
refactor: improve error handling by preserving the original error con…
atilsensalduz 69acb87
Merge branch 'google:master' into master
atilsensalduz 56f4c18
feat: add support for Issue Types API
atilsensalduz cca495e
feat: add support for Issue Types API
atilsensalduz 15b891e
feat: add support for Issue Types API
atilsensalduz f605f76
feat: add support for Issue Types API
atilsensalduz 72f1988
Merge branch 'master' into add-issue-type
atilsensalduz d39244c
feat: add support for Issue Types API
atilsensalduz 8a6fa7d
feat: add support for Issue Types API
atilsensalduz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.