added code to create a new issue

This commit is contained in:
Kohsuke Kawaguchi
2012-09-13 15:56:05 -07:00
parent 2e74517a4a
commit e53e62bfa0
3 changed files with 39 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
package org.kohsuke.github;
import java.io.IOException;
/**
* @author Kohsuke Kawaguchi
*/
public class GHIssueBuilder {
private final GHRepository repo;
private final Requester builder;
GHIssueBuilder(GHRepository repo, String title) {
this.repo = repo;
this.builder = new Requester(repo.root);
builder.with("title",title);
}
public GHIssueBuilder body(String str) {
builder.with("body",str);
return this;
}
/**
* Creates a new issue.
*/
public GHIssue create() throws IOException {
return builder.to("/repos/"+repo.getOwnerName()+'/'+repo.getName()+"/issues",GHIssue.class).wrap(repo);
}
}