@@ -13,11 +13,14 @@ import (
13
13
14
14
// Comment represents a comment in commit and issue page.
15
15
type Comment struct {
16
- ID int64 `json:"id"`
17
- Poster * User `json:"user"`
18
- Body string `json:"body"`
19
- Created time.Time `json:"created_at"`
20
- Updated time.Time `json:"updated_at"`
16
+ ID int64 `json:"id"`
17
+ HTMLURL string `json:"html_url"`
18
+ PRURL string `json:"pull_request_url"`
19
+ IssueURL string `json:"issue_url"`
20
+ Poster * User `json:"user"`
21
+ Body string `json:"body"`
22
+ Created time.Time `json:"created_at"`
23
+ Updated time.Time `json:"updated_at"`
21
24
}
22
25
23
26
// ListIssueComments list comments on an issue.
@@ -26,6 +29,12 @@ func (c *Client) ListIssueComments(owner, repo string, index int64) ([]*Comment,
26
29
return comments , c .getParsedResponse ("GET" , fmt .Sprintf ("/repos/%s/%s/issues/%d/comments" , owner , repo , index ), nil , nil , & comments )
27
30
}
28
31
32
+ // ListRepoIssueComments list comments for a given repo.
33
+ func (c * Client ) ListRepoIssueComments (owner , repo string ) ([]* Comment , error ) {
34
+ comments := make ([]* Comment , 0 , 10 )
35
+ return comments , c .getParsedResponse ("GET" , fmt .Sprintf ("/repos/%s/%s/issues/comments" , owner , repo ), nil , nil , & comments )
36
+ }
37
+
29
38
// CreateIssueCommentOption is option when creating an issue comment.
30
39
type CreateIssueCommentOption struct {
31
40
Body string `json:"body" binding:"Required"`
@@ -55,3 +64,9 @@ func (c *Client) EditIssueComment(owner, repo string, index, commentID int64, op
55
64
comment := new (Comment )
56
65
return comment , c .getParsedResponse ("PATCH" , fmt .Sprintf ("/repos/%s/%s/issues/%d/comments/%d" , owner , repo , index , commentID ), jsonHeader , bytes .NewReader (body ), comment )
57
66
}
67
+
68
+ // DeleteIssueComment deletes an issue comment.
69
+ func (c * Client ) DeleteIssueComment (owner , repo string , index , commentID int64 ) error {
70
+ _ , err := c .getResponse ("DELETE" , fmt .Sprintf ("/repos/%s/%s/issues/%d/comments/%d" , owner , repo , index , commentID ), nil , nil )
71
+ return err
72
+ }
0 commit comments