private void modifyCollaborators(Collection<GHUser> users, String method) throws IOException { verifyMine(); for (GHUser user : users) { new Requester(root) .method(method) .to("/repos/" + owner.login + "/" + name + "/collaborators/" + user.getLogin()); } }
/** Gets the collaborators on this repository. This set always appear to include the owner. */ @WithBridgeMethods(Set.class) public GHPersonSet<GHUser> getCollaborators() throws IOException { return new GHPersonSet<GHUser>( GHUser.wrap( root.retrieve() .to("/repos/" + owner.login + "/" + name + "/collaborators", GHUser[].class), root)); }
/** * Gets the names of the collaborators on this repository. This method deviates from the principle * of this library but it works a lot faster than {@link #getCollaborators()}. */ public Set<String> getCollaboratorNames() throws IOException { Set<String> r = new HashSet<String>(); for (GHUser u : GHUser.wrap( root.retrieve() .to("/repos/" + owner.login + "/" + name + "/collaborators", GHUser[].class), root)) r.add(u.login); return r; }