Skip to content

Commit

Permalink
added a method to retrieve a single issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Sep 13, 2012
1 parent bd58412 commit aed8880
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public GHUser getOwner() throws IOException {
return root.getUser(owner.login); // because 'owner' isn't fully populated
}

public GHIssue getIssue(int id) throws IOException {
return root.retrieve().to("/repos/" + owner.login + "/" + name + "/issues/" + id, GHIssue.class).wrap(this);
}

public List<GHIssue> getIssues(GHIssueState state) throws IOException {
return Arrays.asList(GHIssue.wrap(root.retrieve().to("/repos/" + owner.login + "/" + name + "/issues?state=" + state.toString().toLowerCase(), GHIssue[].class), this));
}
Expand Down Expand Up @@ -333,7 +337,7 @@ public GHRepository fork() throws IOException {
* Newly forked repository that belong to you.
*/
public GHRepository forkTo(GHOrganization org) throws IOException {
new Requester(root).to(String.format("/repos/%s/%s/forks?org=%s",owner.login,name,org.getLogin()));
new Requester(root).to(String.format("/repos/%s/%s/forks?org=%s", owner.login, name, org.getLogin()));

// this API is asynchronous. we need to wait for a bit
for (int i=0; i<10; i++) {
Expand Down Expand Up @@ -476,7 +480,7 @@ public GHCommitStatus getLastCommitStatus(String sha1) throws IOException {
*/
public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description) throws IOException {
return new Requester(root)
.with("state",state.name().toLowerCase(Locale.ENGLISH))
.with("state", state.name().toLowerCase(Locale.ENGLISH))
.with("target_url", targetUrl)
.with("description", description)
.to(String.format("/repos/%s/%s/statuses/%s",owner.login,this.name,sha1),GHCommitStatus.class).wrapUp(root);
Expand Down Expand Up @@ -504,7 +508,7 @@ public GHHook createHook(String name, Map<String,String> config, Collection<GHEv
}

return new Requester(root)
.with("name",name)
.with("name", name)
.with("active", active)
._with("config", config)
._with("events",ea)
Expand Down

0 comments on commit aed8880

Please sign in to comment.