Commit f377b902 authored by Adam Retter's avatar Adam Retter

Support for Getting Group Members from the API

parent 6b01ce8a
...@@ -87,6 +87,29 @@ public class GitlabAPI { ...@@ -87,6 +87,29 @@ public class GitlabAPI {
return retrieve().getAll(tailUrl, GitlabGroup[].class); return retrieve().getAll(tailUrl, GitlabGroup[].class);
} }
/**
* Gets all members of a Group
*
* @param group The GitLab Group
*
* @return The Group Members
*/
public List<GitlabGroupMember> getGroupMembers(GitlabGroup group) throws IOException {
return getGroupMembers(group.getId());
}
/**
* Gets all members of a Group
*
* @param groupId The id of the GitLab Group
*
* @return The Group Members
*/
public List<GitlabGroupMember> getGroupMembers(Integer groupId) throws IOException {
String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabGroupMember.URL;
return Arrays.asList(retrieve().to(tailUrl, GitlabGroupMember[].class));
}
/** /**
* Creates a Group * Creates a Group
* *
......
package org.gitlab.api.models;
import org.codehaus.jackson.annotate.JsonProperty;
public abstract class GitlabAbstractMember extends GitlabUser {
public static final String URL = "/members";
@JsonProperty("access_level")
private int _accessLevel;
public int getAccessLevel() {
return _accessLevel;
}
public void setAccessLevel(int accessLevel) {
_accessLevel = accessLevel;
}
}
package org.gitlab.api.models;
public class GitlabGroupMember extends GitlabAbstractMember {
}
package org.gitlab.api.models; package org.gitlab.api.models;
public class GitlabProjectMember extends GitlabUser { public class GitlabProjectMember extends GitlabAbstractMember {
public static final String URL = "/members";
private int _accessLevel;
public int getAccessLevel() {
return _accessLevel;
}
public void setAccessLevel(int accessLevel) {
_accessLevel = accessLevel;
}
} }
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