/*package*/ static GHTeam[] wrapUp(GHTeam[] teams, GHOrganization owner) { for (GHTeam t : teams) { t.wrapUp(owner); } return teams; }
/*package*/ static GHTeam[] wrapUp(GHTeam[] teams, GHOrganization owner) { for (GHTeam t : teams) { t.wrapUp(owner); } return teams; }
/*package*/ static GHTeam[] wrapUp(GHTeam[] teams, GHOrganization owner) { for (GHTeam t : teams) { t.wrapUp(owner); } return teams; }
/*package*/ GHTeam wrapUp(GitHub root) { // auto-wrapUp when organization is known from GET /user/teams this.organization.wrapUp(root); return wrapUp(organization); }
/*package*/ GHTeam wrapUp(GitHub root) { // auto-wrapUp when organization is known from GET /user/teams this.organization.wrapUp(root); return wrapUp(organization); }
/*package*/ GHTeam wrapUp(GitHub root) { // auto-wrapUp when organization is known from GET /user/teams this.organization.wrapUp(root); return wrapUp(organization); }
/** * If this repository belongs to an organization, return a set of teams. */ public Set<GHTeam> getTeams() throws IOException { return Collections.unmodifiableSet(new HashSet<GHTeam>(Arrays.asList(GHTeam.wrapUp(root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class), root.getOrganization(owner.login))))); }
/** * If this repository belongs to an organization, return a set of teams. */ public Set<GHTeam> getTeams() throws IOException { return Collections.unmodifiableSet(new HashSet<GHTeam>(Arrays.asList(GHTeam.wrapUp(root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class), root.getOrganization(getOwnerName()))))); }
/** * Gets complete map of organizations/teams that current user belongs to. * * Leverages the new GitHub API /user/teams made available recently to * get in a single call the complete set of organizations, teams and permissions * in a single call. */ public Map<String, Set<GHTeam>> getMyTeams() throws IOException { Map<String, Set<GHTeam>> allMyTeams = new HashMap<String, Set<GHTeam>>(); for (GHTeam team : retrieve().to("/user/teams", GHTeam[].class)) { team.wrapUp(this); String orgLogin = team.getOrganization().getLogin(); Set<GHTeam> teamsPerOrg = allMyTeams.get(orgLogin); if (teamsPerOrg == null) { teamsPerOrg = new HashSet<GHTeam>(); } teamsPerOrg.add(team); allMyTeams.put(orgLogin, teamsPerOrg); } return allMyTeams; }
/** * If this repository belongs to an organization, return a set of teams. */ public Set<GHTeam> getTeams() throws IOException { return Collections.unmodifiableSet(new HashSet<GHTeam>(Arrays.asList(GHTeam.wrapUp(root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class), root.getOrganization(getOwnerName()))))); }
/** * Gets complete map of organizations/teams that current user belongs to. * * Leverages the new GitHub API /user/teams made available recently to * get in a single call the complete set of organizations, teams and permissions * in a single call. */ public Map<String, Set<GHTeam>> getMyTeams() throws IOException { Map<String, Set<GHTeam>> allMyTeams = new HashMap<String, Set<GHTeam>>(); for (GHTeam team : retrieve().to("/user/teams", GHTeam[].class)) { team.wrapUp(this); String orgLogin = team.getOrganization().getLogin(); Set<GHTeam> teamsPerOrg = allMyTeams.get(orgLogin); if (teamsPerOrg == null) { teamsPerOrg = new HashSet<GHTeam>(); } teamsPerOrg.add(team); allMyTeams.put(orgLogin, teamsPerOrg); } return allMyTeams; }
/** * Gets complete map of organizations/teams that current user belongs to. * * Leverages the new GitHub API /user/teams made available recently to * get in a single call the complete set of organizations, teams and permissions * in a single call. */ public Map<String, Set<GHTeam>> getMyTeams() throws IOException { Map<String, Set<GHTeam>> allMyTeams = new HashMap<String, Set<GHTeam>>(); for (GHTeam team : retrieve().to("/user/teams", GHTeam[].class)) { team.wrapUp(this); String orgLogin = team.getOrganization().getLogin(); Set<GHTeam> teamsPerOrg = allMyTeams.get(orgLogin); if (teamsPerOrg == null) { teamsPerOrg = new HashSet<GHTeam>(); } teamsPerOrg.add(team); allMyTeams.put(orgLogin, teamsPerOrg); } return allMyTeams; }
/** * Creates a new team and assigns the repositories. */ public GHTeam createTeam(String name, Permission p, Collection<GHRepository> repositories) throws IOException { Requester post = new Requester(root).with("name", name).with("permission", p); List<String> repo_names = new ArrayList<String>(); for (GHRepository r : repositories) { repo_names.add(r.getName()); } post.with("repo_names",repo_names); return post.method("POST").to("/orgs/" + login + "/teams", GHTeam.class).wrapUp(this); }
/** * Creates a new team and assigns the repositories. */ public GHTeam createTeam(String name, Permission p, Collection<GHRepository> repositories) throws IOException { Requester post = new Requester(root).with("name", name).with("permission", p.name().toLowerCase()); List<String> repo_names = new ArrayList<String>(); for (GHRepository r : repositories) { repo_names.add(r.getName()); } post.with("repo_names",repo_names); return post.method("POST").to("/orgs/" + login + "/teams", GHTeam.class).wrapUp(this); }
/** * Creates a new team and assigns the repositories. */ public GHTeam createTeam(String name, Permission p, Collection<GHRepository> repositories) throws IOException { Requester post = new Requester(root).with("name", name).with("permission", p); List<String> repo_names = new ArrayList<String>(); for (GHRepository r : repositories) { repo_names.add(r.getName()); } post.with("repo_names",repo_names); return post.method("POST").to("/orgs/" + login + "/teams", GHTeam.class).wrapUp(this); }