Skip to content

Commit

Permalink
Adds the ability to get a repository by ID
Browse files Browse the repository at this point in the history
Fixes: hub4j#515
  • Loading branch information
jamesatha committed Apr 26, 2019
1 parent fad203a commit 265d814
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.kohsuke</groupId>
<artifactId>pom</artifactId>
<version>20</version>
<version>21</version>
</parent>

<artifactId>github-api</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/kohsuke/github/GitHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,14 @@ public GHRepository getRepository(String name) throws IOException {
String[] tokens = name.split("/");
return retrieve().to("/repos/" + tokens[0] + '/' + tokens[1], GHRepository.class).wrap(this);
}

/**
* Gets the repository object from its ID
*/
public GHRepository getRepositoryById(String id) throws IOException {
return retrieve().to("/repositories/" + id, GHRepository.class).wrap(this);
}

/**
* Returns a list of popular open source licenses
*
Expand Down

0 comments on commit 265d814

Please sign in to comment.