Skip to content

Commit fc17d76

Browse files
authored
Rename id parameter to commentID in IssuesService comment methods. (google#886)
Also document which IssueComment fields need to be set in EditComment method. This should help improve clarity of the API, and reduce the chance to mix up the issue vs comment IDs. Resolves google#885.
1 parent d24afe1 commit fc17d76

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

github/issues_comments.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str
7979
// GetComment fetches the specified issue comment.
8080
//
8181
// GitHub API docs: https://developer.github.com/v3/issues/comments/#get-a-single-comment
82-
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, id int64) (*IssueComment, *Response, error) {
83-
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
82+
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) {
83+
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
8484

8585
req, err := s.client.NewRequest("GET", u, nil)
8686
if err != nil {
@@ -118,10 +118,11 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st
118118
}
119119

120120
// EditComment updates an issue comment.
121+
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
121122
//
122123
// GitHub API docs: https://developer.github.com/v3/issues/comments/#edit-a-comment
123-
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, id int64, comment *IssueComment) (*IssueComment, *Response, error) {
124-
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
124+
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) {
125+
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
125126
req, err := s.client.NewRequest("PATCH", u, comment)
126127
if err != nil {
127128
return nil, nil, err
@@ -138,8 +139,8 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri
138139
// DeleteComment deletes an issue comment.
139140
//
140141
// GitHub API docs: https://developer.github.com/v3/issues/comments/#delete-a-comment
141-
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, id int64) (*Response, error) {
142-
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
142+
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
143+
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
143144
req, err := s.client.NewRequest("DELETE", u, nil)
144145
if err != nil {
145146
return nil, err

0 commit comments

Comments
 (0)