Skip to content

Commit

Permalink
Add delete and update for GHIssueComment
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed Jun 16, 2015
1 parent dd3e739 commit cce02ae
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/kohsuke/github/GHIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/org/kohsuke/github/GHIssueComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit cce02ae

Please sign in to comment.