Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.

Commit 45a5d12

Browse files
author
Christian Holm
committed
Merge pull request #14 from UseTheSrc/master
Add support for "Get space members v2" API call
2 parents ec9e171 + 75cfd0b commit 45a5d12

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

src/main/java/com/podio/space/SpaceAPI.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.List;
44

55
import javax.ws.rs.core.MediaType;
6+
import javax.ws.rs.core.MultivaluedMap;
67

78
import com.podio.BaseAPI;
89
import com.podio.ResourceFactory;
@@ -125,6 +126,41 @@ public List<SpaceMember> getActiveMembers(int spaceId) {
125126
new GenericType<List<SpaceMember>>() {
126127
});
127128
}
129+
130+
/**
131+
* Returns the active members of the given space ("v2").
132+
*
133+
* @param spaceId
134+
* The id of the space
135+
* @param offset
136+
* The offset into the user list
137+
* @param limit
138+
* The number of results to return (max 500)
139+
* @return The active members of the space
140+
*/
141+
public List<SpaceMemberV2> getActiveMembersV2(int spaceId, int offset, int limit) {
142+
return getResourceFactory()
143+
.getApiResource("/space/" + spaceId + "/member/v2/")
144+
.queryParam("offset", new Integer(offset).toString())
145+
.queryParam("limit", new Integer(limit).toString())
146+
.get(new GenericType<List<SpaceMemberV2>>() { });
147+
}
148+
149+
/**
150+
* Returns the active members of the given space ("v2").
151+
*
152+
* @param spaceId
153+
* The id of the space
154+
* @param options
155+
* The parameters for get space members v2
156+
* @return The active members of the space
157+
*/
158+
public List<SpaceMemberV2> getActiveMembersV2(int spaceId, MultivaluedMap<String, String> options) {
159+
return getResourceFactory()
160+
.getApiResource("/space/" + spaceId + "/member/v2/")
161+
.queryParams(options)
162+
.get(new GenericType<List<SpaceMemberV2>>() { });
163+
}
128164

129165
/**
130166
* Returns a list of the members that have been removed from the space.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* Podio Java library
3+
*/
4+
package com.podio.space;
5+
6+
import org.codehaus.jackson.annotate.JsonProperty;
7+
8+
import com.podio.common.Role;
9+
import com.podio.contact.Profile;
10+
11+
/**
12+
* To match the data returned by the "get space members v2" API call
13+
*
14+
* @author apitman
15+
*/
16+
public class SpaceMemberV2 {
17+
18+
/**
19+
* Employee or external user
20+
*/
21+
private boolean employee;
22+
23+
/**
24+
* The member of the space
25+
*/
26+
private Profile profile;
27+
28+
/**
29+
* The number of grants given to the user on the space
30+
*/
31+
private int grants;
32+
33+
/**
34+
* The role that the member has
35+
*/
36+
private Role role;
37+
38+
/**
39+
* @return the employee
40+
*/
41+
public boolean isEmployee() {
42+
return employee;
43+
}
44+
45+
/**
46+
* @param employee the employee to set
47+
*/
48+
@JsonProperty("employee")
49+
public void setEmployee(boolean employee) {
50+
this.employee = employee;
51+
}
52+
53+
/**
54+
* @return the profile
55+
*/
56+
public Profile getProfile() {
57+
return profile;
58+
}
59+
60+
/**
61+
* @param profile the profile to set
62+
*/
63+
@JsonProperty("profile")
64+
public void setProfile(Profile profile) {
65+
this.profile = profile;
66+
}
67+
68+
/**
69+
* @return the grants
70+
*/
71+
public int getGrants() {
72+
return grants;
73+
}
74+
75+
/**
76+
* @param grants the grants to set
77+
*/
78+
@JsonProperty("grants")
79+
public void setGrants(int grants) {
80+
this.grants = grants;
81+
}
82+
83+
/**
84+
* @return the role
85+
*/
86+
public Role getRole() {
87+
return role;
88+
}
89+
90+
/**
91+
* @param role the role to set
92+
*/
93+
public void setRole(Role role) {
94+
this.role = role;
95+
}
96+
}

0 commit comments

Comments
 (0)