diff --git a/src/main/java/com/podio/space/SpaceAPI.java b/src/main/java/com/podio/space/SpaceAPI.java index 897f7c1..2084b81 100644 --- a/src/main/java/com/podio/space/SpaceAPI.java +++ b/src/main/java/com/podio/space/SpaceAPI.java @@ -3,6 +3,7 @@ import java.util.List; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; import com.podio.BaseAPI; import com.podio.ResourceFactory; @@ -125,6 +126,41 @@ public List getActiveMembers(int spaceId) { new GenericType>() { }); } + + /** + * Returns the active members of the given space ("v2"). + * + * @param spaceId + * The id of the space + * @param offset + * The offset into the user list + * @param limit + * The number of results to return (max 500) + * @return The active members of the space + */ + public List getActiveMembersV2(int spaceId, int offset, int limit) { + return getResourceFactory() + .getApiResource("/space/" + spaceId + "/member/v2/") + .queryParam("offset", new Integer(offset).toString()) + .queryParam("limit", new Integer(limit).toString()) + .get(new GenericType>() { }); + } + + /** + * Returns the active members of the given space ("v2"). + * + * @param spaceId + * The id of the space + * @param options + * The parameters for get space members v2 + * @return The active members of the space + */ + public List getActiveMembersV2(int spaceId, MultivaluedMap options) { + return getResourceFactory() + .getApiResource("/space/" + spaceId + "/member/v2/") + .queryParams(options) + .get(new GenericType>() { }); + } /** * Returns a list of the members that have been removed from the space. diff --git a/src/main/java/com/podio/space/SpaceMemberV2.java b/src/main/java/com/podio/space/SpaceMemberV2.java new file mode 100644 index 0000000..c6b9cf9 --- /dev/null +++ b/src/main/java/com/podio/space/SpaceMemberV2.java @@ -0,0 +1,96 @@ +/** + * Podio Java library + */ +package com.podio.space; + +import org.codehaus.jackson.annotate.JsonProperty; + +import com.podio.common.Role; +import com.podio.contact.Profile; + +/** + * To match the data returned by the "get space members v2" API call + * + * @author apitman + */ +public class SpaceMemberV2 { + + /** + * Employee or external user + */ + private boolean employee; + + /** + * The member of the space + */ + private Profile profile; + + /** + * The number of grants given to the user on the space + */ + private int grants; + + /** + * The role that the member has + */ + private Role role; + + /** + * @return the employee + */ + public boolean isEmployee() { + return employee; + } + + /** + * @param employee the employee to set + */ + @JsonProperty("employee") + public void setEmployee(boolean employee) { + this.employee = employee; + } + + /** + * @return the profile + */ + public Profile getProfile() { + return profile; + } + + /** + * @param profile the profile to set + */ + @JsonProperty("profile") + public void setProfile(Profile profile) { + this.profile = profile; + } + + /** + * @return the grants + */ + public int getGrants() { + return grants; + } + + /** + * @param grants the grants to set + */ + @JsonProperty("grants") + public void setGrants(int grants) { + this.grants = grants; + } + + /** + * @return the role + */ + public Role getRole() { + return role; + } + + /** + * @param role the role to set + */ + public void setRole(Role role) { + this.role = role; + } +}