Commit 37391356 authored by Tim Olshansky's avatar Tim Olshansky

Merge pull request #18 from dneves/master

added getUsers() and getUser( userId )
parents be12b3a7 5b8ce2f6
package org.gitlab.api; package org.gitlab.api;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.gitlab.api.http.GitlabHTTPRequestor;
import org.gitlab.api.models.GitlabBranch;
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.GitlabProjectMember;
import org.gitlab.api.models.GitlabSession;
import org.gitlab.api.models.GitlabUser;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.gitlab.api.http.GitlabHTTPRequestor;
import org.gitlab.api.http.Query; import org.gitlab.api.http.Query;
import org.gitlab.api.models.*; import org.gitlab.api.models.*;
/** /**
* Gitlab API Wrapper class * Gitlab API Wrapper class
* *
...@@ -77,6 +91,16 @@ public class GitlabAPI { ...@@ -77,6 +91,16 @@ public class GitlabAPI {
return new URL(_hostUrl + tailAPIUrl); return new URL(_hostUrl + tailAPIUrl);
} }
public List<GitlabUser> getUsers() throws IOException {
String tailUrl = GitlabUser.URL;
return retrieve().getAll( tailUrl, GitlabUser[].class );
}
public GitlabUser getUser(Integer userId) throws IOException {
String tailUrl = GitlabUser.URL + "/" + userId;
return retrieve().to(tailUrl, GitlabUser.class);
}
public GitlabGroup getGroup(Integer groupId) throws IOException { public GitlabGroup getGroup(Integer groupId) throws IOException {
String tailUrl = GitlabGroup.URL + "/" + groupId; String tailUrl = GitlabGroup.URL + "/" + groupId;
return retrieve().to(tailUrl, GitlabGroup.class); return retrieve().to(tailUrl, GitlabGroup.class);
......
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