Skip to content

Commit 561f839

Browse files
committed
adding more operations
1 parent 5e2a27a commit 561f839

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

src/main/java/org/kohsuke/github/GHIssue.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.Collections;
3131
import java.util.Date;
3232
import java.util.List;
33-
import java.util.Locale;
3433

3534
/**
3635
* Represents an issue on GitHub.
@@ -100,7 +99,24 @@ public Date getUpdatedAt() {
10099
* Updates the issue by adding a comment.
101100
*/
102101
public void comment(String message) throws IOException {
103-
new Poster(root).withCredential().with("comment",message).to("/issues/comment/"+
104-
owner.getOwnerName()+"/"+owner.getName()+"/"+number);
102+
new Poster(root).withCredential().with("comment",message).to(getApiRoute("comment"));
103+
}
104+
105+
/**
106+
* Closes this issue.
107+
*/
108+
public void close() throws IOException {
109+
new Poster(root).withCredential().to(getApiRoute("close"));
110+
}
111+
112+
/**
113+
* Reopens this issue.
114+
*/
115+
public void reopen() throws IOException {
116+
new Poster(root).withCredential().to(getApiRoute("reopen"));
117+
}
118+
119+
private String getApiRoute(String verb) {
120+
return "/issues/"+verb+"/"+owner.getOwnerName()+"/"+owner.getName()+"/"+number;
105121
}
106122
}

0 commit comments

Comments
 (0)