Repository: google/go-github
File: github/sub_issue.go (Go)

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

	// TODO: remove custom Accept header when this API fully launches.
	req.Header.Set("Accept", mediaTypeV3)

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

	return subIssues, resp, nil
}

// Add adds a sub-issue to the specified issue.
//
// The sub-issue to be added must belong to the same repository owner as the parent issue.
// To replace the existing parent of a sub-issue, set replaceParent to true.
//
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#add-sub-issue
//
//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues
func (s *SubIssueService) Add(ctx context.Context, owner string, repo string, issueNumber int, subIssue *SubIssueRequest) (*SubIssue, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/issues/%d/sub_issues", owner, repo, issueNumber)
	req, err := s.client.NewRequest("POST", u, subIssue)
	if err != nil {
		return nil, nil, err
	}

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

	return si, resp, nil
}

// Reprioritize changes a sub-issue's priority to a different position in the parent list.
//
// Either afterId or beforeId must be specified to determine the new position of the sub-issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#reprioritize-sub-issue
//
//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority
func (s *SubIssueService) Reprioritize(ctx context.Context, owner string, repo string, issueNumber int, subIssue *SubIssueRequest) (*SubIssue, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/issues/%d/sub_issues/priority", owner, repo, issueNumber)
	req, err := s.client.NewRequest("PATCH", u, subIssue)

Review comment (suggestion):
```suggestion
func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) {
```

Code after:
	}

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

	return subIssues, resp, nil
}

// Add adds a sub-issue to the specified issue.
//
// The sub-issue to be added must belong to the same repository owner as the parent issue.
// To replace the existing parent of a sub-issue, set replaceParent to true.
//
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#add-sub-issue
//
//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues
func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, issueNumber)
	req, err := s.client.NewRequest("POST", u, subIssue)
	if err != nil {
		return nil, nil, err
	}

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

	return si, resp, nil
}

// Reprioritize changes a sub-issue's priority to a different position in the parent list.
//
// Either afterId or beforeId must be specified to determine the new position of the sub-issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#reprioritize-sub-issue
//
//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority
func (s *SubIssueService) Reprioritize(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues/priority", owner, repo, issueNumber)
	req, err := s.client.NewRequest("PATCH", u, subIssue)
	if err != nil {
		return nil, nil, err
	}

	si := new(SubIssue)
	resp, err := s.client.Do(ctx, req, si)