diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java index 8c071a93f8..71394a6b0f 100644 --- a/src/main/java/org/kohsuke/github/GHIssue.java +++ b/src/main/java/org/kohsuke/github/GHIssue.java @@ -141,8 +141,9 @@ public URL getApiURL(){ /** * Updates the issue by adding a comment. */ - public void comment(String message) throws IOException { - new Requester(root).with("body",message).to(getIssuesApiRoute() + "/comments"); + public GHIssueComment comment(String message) throws IOException { + GHIssueComment r = new Requester(root).with("body",message).to(getIssuesApiRoute() + "/comments", GHIssueComment.class); + return r.wrapUp(this); } private void edit(String key, Object value) throws IOException { diff --git a/src/main/java/org/kohsuke/github/GHIssueComment.java b/src/main/java/org/kohsuke/github/GHIssueComment.java index 732c508a2d..f36b110499 100644 --- a/src/main/java/org/kohsuke/github/GHIssueComment.java +++ b/src/main/java/org/kohsuke/github/GHIssueComment.java @@ -79,4 +79,23 @@ public GHUser getUser() throws IOException { public URL getHtmlUrl() { return null; } + + /** + * Updates the body of the issue comment. + */ + public void update(String body) throws IOException { + new Requester(owner.root).with("body", body).method("PATCH").to(getCommentApiTail(), GHIssueComment.class); + this.body = body; + } + + /** + * Deletes this issue comment. + */ + public void delete() throws IOException { + new Requester(owner.root).method("DELETE").to(getCommentApiTail()); + } + + private String getCommentApiTail() { + return "/repos/"+owner.getRepository().getOwnerName()+"/"+owner.getRepository().getName()+"/issues/comments/" + id; + } } diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java index 09863f78cf..3051f4b700 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java +++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java @@ -94,6 +94,7 @@ protected String getApiRoute() { */ public void update(String body) throws IOException { new Requester(owner.root).method("PATCH").with("body", body).to(getApiRoute(),this); + this.body = body; } /**