/** * The team that gets granted access to this repository. Only valid for creating a repository in * an organization. */ public GHCreateRepositoryBuilder team(GHTeam team) { if (team!=null) this.builder.with("team_id",team.getId()); return this; }
/** * Finds a team that has the given name in its {@link GHTeam#getName()} */ public GHTeam getTeamByName(String name) throws IOException { for (GHTeam t : listTeams()) { if(t.getName().equals(name)) return t; } return null; }
/** * Returns true if this user belongs to the specified team. */ public boolean isMemberOf(GHTeam team) { return team.hasMember(this); }
/** * Deletes this team. */ public void delete() throws IOException { org.root.retrieve().method("DELETE").to(api("")); }
/*package*/ static GHTeam[] wrapUp(GHTeam[] teams, GHOrganization owner) { for (GHTeam t : teams) { t.wrapUp(owner); } return teams; }
/** * 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; }
public Map<String,GHRepository> getRepositories() throws IOException { Map<String,GHRepository> m = new TreeMap<String, GHRepository>(); for (GHRepository r : listRepositories()) { m.put(r.getName(), r); } return m; }
public Set<GHUser> getMembers() throws IOException { return Collections.unmodifiableSet(listMembers().asSet()); }
public GHBranchProtectionBuilder teamReviewDismissals(GHTeam... teams) { for (GHTeam team : teams) { addReviewRestriction(team.getSlug(), true); } return this; }
public void add(GHRepository r) throws IOException { add(r,null); }
/** * Deletes this team. */ public void delete() throws IOException { org.root.retrieve().method("DELETE").to(api("")); }
/*package*/ static GHTeam[] wrapUp(GHTeam[] teams, GHOrganization owner) { for (GHTeam t : teams) { t.wrapUp(owner); } return teams; }
/** * 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; }
public Map<String,GHRepository> getRepositories() throws IOException { Map<String,GHRepository> m = new TreeMap<String, GHRepository>(); for (GHRepository r : listRepositories()) { m.put(r.getName(), r); } return m; }
public Set<GHUser> getMembers() throws IOException { return Collections.unmodifiableSet(listMembers().asSet()); }
public GHBranchProtectionBuilder teamPushAccess(GHTeam... teams) { for (GHTeam team : teams) { getRestrictions().teams.add(team.getSlug()); } return this; }
public void add(GHRepository r) throws IOException { add(r,null); }
/** * Adds a member to the team. * * The user will be invited to the organization if required. * * @since 1.59 */ public void add(GHUser u) throws IOException { org.root.retrieve().method("PUT").to(api("/memberships/" + u.getLogin()), null); }
/*package*/ static GHTeam[] wrapUp(GHTeam[] teams, GHOrganization owner) { for (GHTeam t : teams) { t.wrapUp(owner); } return teams; }
/** * 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; }