mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
bug fix
This commit is contained in:
@@ -44,6 +44,7 @@ public abstract class GHPerson {
|
||||
* Fetches the repository of the given name from GitHub, and return it.
|
||||
*/
|
||||
protected GHRepository refreshRepository(String name) throws IOException {
|
||||
if (repositories==null) getRepositories(); // fetch the base first
|
||||
GHRepository r = root.retrieve("/repos/show/" + login + '/' + name, JsonRepository.class).wrap(root);
|
||||
repositories.put(name,r);
|
||||
return r;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -31,28 +30,32 @@ public class GHTeam {
|
||||
* Retrieves the current members.
|
||||
*/
|
||||
public Set<GHUser> getMembers() throws IOException {
|
||||
return org.root.retrieveWithAuth("/members",JsonUsersWithDetails.class).toSet(org.root);
|
||||
return org.root.retrieveWithAuth(api("/members"),JsonUsersWithDetails.class).toSet(org.root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a member to the team.
|
||||
*/
|
||||
public void add(GHUser u) throws IOException {
|
||||
org.root.retrieveWithAuth("/members?name="+u.getLogin(),null, "POST");
|
||||
org.root.retrieveWithAuth(api("/members?name="+u.getLogin()),null, "POST");
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a member to the team.
|
||||
*/
|
||||
public void remove(GHUser u) throws IOException {
|
||||
org.root.retrieveWithAuth("/members?name="+u.getLogin(),null, "DELETE");
|
||||
org.root.retrieveWithAuth(api("/members?name="+u.getLogin()),null, "DELETE");
|
||||
}
|
||||
|
||||
public void add(GHRepository r) throws IOException {
|
||||
org.root.retrieveWithAuth("/repositories?name="+r.getOwnerName()+'/'+r.getName(),null, "POST");
|
||||
org.root.retrieveWithAuth(api("/repositories?name="+r.getOwnerName()+'/'+r.getName()),null, "POST");
|
||||
}
|
||||
|
||||
public void remove(GHRepository r) throws IOException {
|
||||
org.root.retrieveWithAuth("/repositories?name="+r.getOwnerName()+'/'+r.getName(),null, "DELETE");
|
||||
org.root.retrieveWithAuth(api("/repositories?name="+r.getOwnerName()+'/'+r.getName()),null, "DELETE");
|
||||
}
|
||||
|
||||
private String api(String tail) {
|
||||
return "/teams/"+id+tail;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user