From b03f14af132af5a2f5066ed5d998f59e7eb0df35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Thu, 8 Sep 2016 14:17:53 +0200 Subject: [PATCH 1/3] Issue-comments can be deleted --- issue_comment.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/issue_comment.go b/issue_comment.go index c766f55..d041112 100644 --- a/issue_comment.go +++ b/issue_comment.go @@ -55,3 +55,9 @@ func (c *Client) EditIssueComment(owner, repo string, index, commentID int64, op comment := new(Comment) return comment, c.getParsedResponse("PATCH", fmt.Sprintf("/repos/:%s/:%s/issues/%d/comments/%d", owner, repo, index, commentID), jsonHeader, bytes.NewReader(body), comment) } + +// DeleteIssueComment deletes an issue comment. +func (c *Client) DeleteIssueComment(owner, repo string, index, commentID int64) error { + _, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/issues/%d/comments/%d", owner, repo, index, commentID), nil, nil) + return err +} From 18ff1a7ba19c19140c3300249a3dda315a34a0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Thu, 8 Sep 2016 14:19:36 +0200 Subject: [PATCH 2/3] List all comments for a repo --- issue_comment.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/issue_comment.go b/issue_comment.go index d041112..4dca41e 100644 --- a/issue_comment.go +++ b/issue_comment.go @@ -26,6 +26,13 @@ func (c *Client) ListIssueComments(owner, repo string, index int64) ([]*Comment, return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/%d/comments", owner, repo, index), nil, nil, &comments) } +// ListRepoIssueComments list comments for a given repo. +func (c *Client) ListRepoIssueComments(owner, repo string) ([]*Comment, error) { + comments := make([]*Comment, 0, 10) + return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/comments", owner, repo), nil, nil, &comments) +} + + // CreateIssueCommentOption is option when creating an issue comment. type CreateIssueCommentOption struct { Body string `json:"body" binding:"Required"` From 791a29d999cac1f7db76a428c073c51e62649ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Wed, 2 Nov 2016 00:50:34 +0100 Subject: [PATCH 3/3] Moar data in issue-comments --- issue_comment.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/issue_comment.go b/issue_comment.go index 4dca41e..2c9949b 100644 --- a/issue_comment.go +++ b/issue_comment.go @@ -13,11 +13,14 @@ import ( // Comment represents a comment in commit and issue page. type Comment struct { - ID int64 `json:"id"` - Poster *User `json:"user"` - Body string `json:"body"` - Created time.Time `json:"created_at"` - Updated time.Time `json:"updated_at"` + ID int64 `json:"id"` + HTMLURL string `json:"html_url"` + PRURL string `json:"pull_request_url"` + IssueURL string `json:"issue_url"` + Poster *User `json:"user"` + Body string `json:"body"` + Created time.Time `json:"created_at"` + Updated time.Time `json:"updated_at"` } // ListIssueComments list comments on an issue. @@ -32,7 +35,6 @@ func (c *Client) ListRepoIssueComments(owner, repo string) ([]*Comment, error) { return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/comments", owner, repo), nil, nil, &comments) } - // CreateIssueCommentOption is option when creating an issue comment. type CreateIssueCommentOption struct { Body string `json:"body" binding:"Required"`