mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-05 08:21:21 +00:00
added code to create a new issue
This commit is contained in:
29
src/main/java/org/kohsuke/github/GHIssueBuilder.java
Normal file
29
src/main/java/org/kohsuke/github/GHIssueBuilder.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user