From 4a4a469ca43605a23cbd2fca814e2f499a5b34ff Mon Sep 17 00:00:00 2001 From: Joshua Krall Date: Mon, 2 Jan 2012 19:45:58 -0600 Subject: [PATCH] Fix for finding private repos on organizations, requires authenticated API call --- .../java/org/kohsuke/github/GHOrganization.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index 2b6d1d905c..5779d6e1c1 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -4,6 +4,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlAnchor; import com.gargoylesoftware.htmlunit.html.HtmlPage; +import java.io.FileNotFoundException; import java.io.IOException; import java.util.AbstractList; import java.util.ArrayList; @@ -42,6 +43,19 @@ public Map getTeams() throws IOException { return root.retrieveWithAuth("/organizations/"+login+"/teams",JsonTeams.class).toMap(this); } + /** + * + * @return + * null if the repository was not found + */ + public GHRepository getRepository(String name) throws IOException { + try { + return root.retrieveWithAuth3("/repos/" + login + '/' + name, GHRepository.class).wrap(root); + } catch (FileNotFoundException e) { + return null; + } + } + /** * Publicizes the membership. */