Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/main/java/com/podio/space/SpaceAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -125,6 +126,41 @@ public List<SpaceMember> getActiveMembers(int spaceId) {
new GenericType<List<SpaceMember>>() {
});
}

/**
* 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<SpaceMemberV2> 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<List<SpaceMemberV2>>() { });
}

/**
* 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<SpaceMemberV2> getActiveMembersV2(int spaceId, MultivaluedMap<String, String> options) {
return getResourceFactory()
.getApiResource("/space/" + spaceId + "/member/v2/")
.queryParams(options)
.get(new GenericType<List<SpaceMemberV2>>() { });
}

/**
* Returns a list of the members that have been removed from the space.
Expand Down
96 changes: 96 additions & 0 deletions src/main/java/com/podio/space/SpaceMemberV2.java
Original file line number Diff line number Diff line change
@@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly this shouldn't be needed as the snake case and camelc ase is the same here. Also goes for profile.

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;
}
}