Skip to content

Commit a22cf85

Browse files
committed
fix: aapply fmt and lint
1 parent d310482 commit a22cf85

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

github/sub_issue.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import (
1818
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues
1919
type SubIssueService service
2020

21-
// Issue represents a GitHub issue on a repository.
22-
//
21+
// SubIssue represents a GitHub sub-issue on a repository.
2322
// Note: As far as the GitHub API is concerned, every pull request is an issue,
2423
// but not every issue is a pull request. Some endpoints, events, and webhooks
2524
// may also return pull requests via this struct. If PullRequestLinks is nil,
@@ -39,17 +38,17 @@ type SubIssueListByIssueOptions struct {
3938

4039
// SubIssueRequest represents a request to add, remove, or reprioritize sub-issues.
4140
type SubIssueRequest struct {
42-
SubIssueId int `json:"sub_issue_id,omitempty"` // Required: The ID of the sub-issue
43-
AfterId int `json:"after_id,omitempty"` // Optional: Position after this sub-issue ID
44-
BeforeId int `json:"before_id,omitempty"` // Optional: Position before this sub-issue ID
41+
SubIssueID int `json:"sub_issue_id,omitempty"` // Required: The ID of the sub-issue
42+
AfterID int `json:"after_id,omitempty"` // Optional: Position after this sub-issue ID
43+
BeforeID int `json:"before_id,omitempty"` // Optional: Position before this sub-issue ID
4544
ReplaceParent bool `json:"replace_parent,omitempty"` // Optional: Whether to replace the existing parent
4645
}
4746

4847
// Remove a sub-issue from the specified repository.
4948
//
50-
// GitHub API docs: https://docs.github.com/en/rest/issues/sub-issues?apiVersion=2022-11-28#remove-sub-issue
51-
52-
//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issues
49+
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#remove-sub-issue
50+
//
51+
//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue
5352
func (s *SubIssueService) Remove(ctx context.Context, owner string, repo string, subIssueNumber int, subIssue *SubIssueRequest) (*SubIssue, *Response, error) {
5453
u := fmt.Sprintf("repos/%v/%v/issues/%d/sub_issues", owner, repo, subIssueNumber)
5554

@@ -72,8 +71,8 @@ func (s *SubIssueService) Remove(ctx context.Context, owner string, repo string,
7271

7372
// ListByIssue lists all sub-issues for the specified issue.
7473
//
75-
// GitHub API docs: https://docs.github.com/en/rest/issues/sub-issues?apiVersion=2022-11-28#list-sub-issues
76-
74+
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#list-sub-issues
75+
//
7776
//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues
7877
func (s *SubIssueService) ListByIssue(ctx context.Context, owner string, repo string, issueNumber int, opts *IssueListOptions) ([]*SubIssue, *Response, error) {
7978
u := fmt.Sprintf("repos/%v/%v/issues/%d/sub_issues", owner, repo, issueNumber)
@@ -104,7 +103,7 @@ func (s *SubIssueService) ListByIssue(ctx context.Context, owner string, repo st
104103
// The sub-issue to be added must belong to the same repository owner as the parent issue.
105104
// To replace the existing parent of a sub-issue, set replaceParent to true.
106105
//
107-
// GitHub API docs: https://docs.github.com/en/rest/issues/sub-issues?apiVersion=2022-11-28#add-sub-issue
106+
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#add-sub-issue
108107
//
109108
//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues
110109
func (s *SubIssueService) Add(ctx context.Context, owner string, repo string, issueNumber int, subIssue *SubIssueRequest) (*SubIssue, *Response, error) {
@@ -127,12 +126,12 @@ func (s *SubIssueService) Add(ctx context.Context, owner string, repo string, is
127126
//
128127
// Either afterId or beforeId must be specified to determine the new position of the sub-issue.
129128
//
130-
// GitHub API docs: https://docs.github.com/en/rest/issues/sub-issues?apiVersion=2022-11-28#reprioritize-sub-issue
129+
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#reprioritize-sub-issue
131130
//
132-
//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority
131+
//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority
133132
func (s *SubIssueService) Reprioritize(ctx context.Context, owner string, repo string, issueNumber int, subIssue *SubIssueRequest) (*SubIssue, *Response, error) {
134133
u := fmt.Sprintf("repos/%v/%v/issues/%d/sub_issues/priority", owner, repo, issueNumber)
135-
req, err := s.client.NewRequest("POST", u, subIssue)
134+
req, err := s.client.NewRequest("PATCH", u, subIssue)
136135
if err != nil {
137136
return nil, nil, err
138137
}

github/sub_issue_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestSubIssuesService_Add(t *testing.T) {
1919
t.Parallel()
2020
client, mux, _ := setup(t)
2121

22-
input := &SubIssueRequest{SubIssueId: 42}
22+
input := &SubIssueRequest{SubIssueID: 42}
2323

2424
mux.HandleFunc("/repos/o/r/issues/1/sub_issues", func(w http.ResponseWriter, r *http.Request) {
2525
v := new(SubIssueRequest)
@@ -73,7 +73,7 @@ func TestSubIssuesService_Remove(t *testing.T) {
7373
t.Parallel()
7474
client, mux, _ := setup(t)
7575

76-
input := &SubIssueRequest{SubIssueId: 42}
76+
input := &SubIssueRequest{SubIssueID: 42}
7777

7878
mux.HandleFunc("/repos/o/r/issues/1/sub_issues", func(w http.ResponseWriter, r *http.Request) {
7979
testHeader(t, r, "Accept", mediaTypeV3)
@@ -105,16 +105,16 @@ func TestSubIssuesService_Reprioritize(t *testing.T) {
105105
t.Parallel()
106106
client, mux, _ := setup(t)
107107

108-
input := &SubIssueRequest{SubIssueId: 42, AfterId: 5}
108+
input := &SubIssueRequest{SubIssueID: 42, AfterID: 5}
109109

110110
mux.HandleFunc("/repos/o/r/issues/1/sub_issues/priority", func(w http.ResponseWriter, r *http.Request) {
111-
testMethod(t, r, "POST")
111+
testMethod(t, r, "PATCH")
112112
testHeader(t, r, "Accept", mediaTypeV3)
113113

114114
v := new(SubIssueRequest)
115115
assertNilError(t, json.NewDecoder(r.Body).Decode(v))
116116

117-
testMethod(t, r, "POST")
117+
testMethod(t, r, "PATCH")
118118
if !cmp.Equal(v, input) {
119119
t.Errorf("Request body = %+v, want %+v", v, input)
120120
}

0 commit comments

Comments
 (0)