Commit a9cbe1f9 authored by Tim Olshansky's avatar Tim Olshansky

Merge pull request #8 from pweingardt/master

getNamespaceMembers and getCurrentSession
parents cd037b61 1a383ac7
......@@ -15,11 +15,12 @@ import org.gitlab.api.models.GitlabCommit;
import org.gitlab.api.models.GitlabIssue;
import org.gitlab.api.models.GitlabMergeRequest;
import org.gitlab.api.models.GitlabMilestone;
import org.gitlab.api.models.GitlabNamespace;
import org.gitlab.api.models.GitlabNote;
import org.gitlab.api.models.GitlabProject;
import org.gitlab.api.models.GitlabProjectHook;
import org.gitlab.api.models.GitlabSession;
import org.gitlab.api.models.GitlabProjectMember;
import org.gitlab.api.models.GitlabSession;
/**
* Gitlab API Wrapper class
......@@ -92,7 +93,7 @@ public class GitlabAPI {
public List<GitlabProject> getProjects() throws IOException {
String tailUrl = GitlabProject.URL;
return Arrays.asList(retrieve().to(tailUrl, GitlabProject[].class));
return retrieve().getAll(tailUrl, GitlabProject[].class);
}
public List<GitlabProject> getAllProjects() throws IOException {
......@@ -300,4 +301,30 @@ public class GitlabAPI {
String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectMember.URL;
return Arrays.asList(retrieve().to(tailUrl, GitlabProjectMember[].class));
}
/**
* This will fail, if the given namespace is a user and not a group
* @param namespace
* @return
* @throws IOException
*/
public List<GitlabProjectMember> getNamespaceMembers(GitlabNamespace namespace) throws IOException {
return getNamespaceMembers(namespace.getId());
}
/**
* This will fail, if the given namespace is a user and not a group
* @param namespaceId
* @return
* @throws IOException
*/
public List<GitlabProjectMember> getNamespaceMembers(Integer namespaceId) throws IOException {
String tailUrl = GitlabNamespace.URL + "/" + namespaceId + GitlabProjectMember.URL;
return Arrays.asList(retrieve().to(tailUrl, GitlabProjectMember[].class));
}
public GitlabSession getCurrentSession() throws IOException {
String tailUrl = "/user";
return retrieve().to(tailUrl, GitlabSession.class);
}
}
......@@ -4,7 +4,8 @@ import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty;
public class GitlabNamespace {
public static final String URL = "/groups";
private Integer _id;
private String _name;
private String _path;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment