mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
added methods to retrieve teams
This commit is contained in:
@@ -145,6 +145,14 @@ public class GHRepository {
|
||||
return Collections.unmodifiableSet(r);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this repository belongs to an organization, return a set of teams.
|
||||
*/
|
||||
public Set<GHTeam> getTeams() throws IOException {
|
||||
return Collections.unmodifiableSet(root.retrieve("/repos/show/"+owner+"/"+name+"/teams",JsonTeams.class).toSet(
|
||||
root.getOrganization(owner)));
|
||||
}
|
||||
|
||||
public void addCollaborators(GHUser... users) throws IOException {
|
||||
addCollaborators(asList(users));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
@@ -18,4 +20,13 @@ class JsonTeams {
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
Set<GHTeam> toSet(GHOrganization org) {
|
||||
Set<GHTeam> r = new HashSet<GHTeam>();
|
||||
for (GHTeam t : teams) {
|
||||
t.org = org;
|
||||
r.add(t);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user