예제 #1
0
 /** Teams by their names. */
 public Map<String, GHTeam> getTeams() throws IOException {
   Map<String, GHTeam> r = new TreeMap<String, GHTeam>();
   for (GHTeam t : listTeams()) {
     r.put(t.getName(), t);
   }
   return r;
 }
예제 #2
0
 /** 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("/repos/" + owner.login + "/" + name + "/teams", GHTeam[].class),
                   root.getOrganization(owner.login)))));
 }
예제 #3
0
 public GHRepository createRepository(
     String name, String description, String homepage, GHTeam team, boolean isPublic)
     throws IOException {
   if (team == null) throw new IllegalArgumentException("Invalid team");
   // such API doesn't exist, so fall back to HTML scraping
   return new Requester(root)
       .with("name", name)
       .with("description", description)
       .with("homepage", homepage)
       .with("public", isPublic)
       .with("team_id", team.getId())
       .to("/orgs/" + login + "/repos", GHRepository.class)
       .wrap(root);
 }
예제 #4
0
 public GHRepository createRepository(
     String name, String description, String homepage, GHTeam team, boolean isPublic)
     throws IOException {
   // such API doesn't exist, so fall back to HTML scraping
   return new Poster(root, V3)
       .withCredential()
       .with("name", name)
       .with("description", description)
       .with("homepage", homepage)
       .with("public", isPublic)
       .with("team_id", team.getId())
       .to("/orgs/" + login + "/repos", GHRepository.class)
       .wrap(root);
 }
예제 #5
0
 /** 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;
 }