From aa2b7ae60ad600d851d18b407792903f9545e512 Mon Sep 17 00:00:00 2001 From: James Athappilly Date: Fri, 26 Apr 2019 00:24:34 -0700 Subject: [PATCH] Adds the ability to get a repository by ID Fixes: https://github.com/kohsuke/github-api/issues/515 --- src/main/java/org/kohsuke/github/GitHub.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index d5d0a2be33..d5e6697127 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -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 *