mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
added an operation to retrieve repositories from a team.
This commit is contained in:
@@ -31,10 +31,7 @@ public abstract class GHPerson {
|
||||
public synchronized Map<String,GHRepository> getRepositories() throws IOException {
|
||||
if (repositories==null) {
|
||||
repositories = Collections.synchronizedMap(new TreeMap<String, GHRepository>());
|
||||
for (GHRepository r : root.retrieve("/repos/show/" + login, JsonRepositories.class).repositories) {
|
||||
r.root = root;
|
||||
repositories.put(r.getName(),r);
|
||||
}
|
||||
repositories.putAll(root.retrieve("/repos/show/" + login, JsonRepositories.class).wrap(root));
|
||||
}
|
||||
|
||||
return Collections.unmodifiableMap(repositories);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -33,6 +34,10 @@ public class GHTeam {
|
||||
return org.root.retrieveWithAuth(api("/members"),JsonUsersWithDetails.class).toSet(org.root);
|
||||
}
|
||||
|
||||
public Map<String,GHRepository> getRepositories() throws IOException {
|
||||
return org.root.retrieveWithAuth(api("/repositories"),JsonRepositories.class).wrap(org.root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a member to the team.
|
||||
*/
|
||||
|
||||
@@ -24,10 +24,21 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
class JsonRepositories {
|
||||
public List<GHRepository> repositories;
|
||||
|
||||
public Map<String,GHRepository> wrap(GitHub root) {
|
||||
Map<String,GHRepository> map = new TreeMap<String, GHRepository>();
|
||||
for (GHRepository r : repositories) {
|
||||
r.root = root;
|
||||
map.put(r.getName(),r);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user