diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2018-07-08 09:34:59 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2018-07-08 09:34:59 -0700 |
commit | 151f74ffa870561bbb3c857c0f07aeb4b27968f5 (patch) | |
tree | fc81aefe1330750c9fcfef28f38d2c938b792cd4 /src/main/java/com/p4square/ccbapi/CCBAPIClient.java | |
parent | 35887b81ac23a389f123df529e45fd9c49ce7459 (diff) |
Add Groups Service APIs
Diffstat (limited to 'src/main/java/com/p4square/ccbapi/CCBAPIClient.java')
-rw-r--r-- | src/main/java/com/p4square/ccbapi/CCBAPIClient.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/com/p4square/ccbapi/CCBAPIClient.java b/src/main/java/com/p4square/ccbapi/CCBAPIClient.java index 96abf78..a0335ba 100644 --- a/src/main/java/com/p4square/ccbapi/CCBAPIClient.java +++ b/src/main/java/com/p4square/ccbapi/CCBAPIClient.java @@ -165,6 +165,43 @@ public class CCBAPIClient implements CCBAPI { return makeRequest("update_individual", params, form, UpdateIndividualProfileResponse.class); } + @Override + public GetGroupProfilesResponse getGroupProfiles(GetGroupProfilesRequest request) throws IOException { + // Prepare the request. + String serviceName; + final Map<String, String> params = new HashMap<>(); + + if (request.getId() != 0) { + // Use group_profile_from_id (id) + serviceName = "group_profile_from_id"; + params.put("id", String.valueOf(request.getId())); + + } else { + // Use group_profiles + serviceName = "group_profiles"; + if (request.getModifiedSince() != null) { + params.put("modified_since", request.getModifiedSince().toString()); + } + if (request.getPage() != 0) { + params.put("page", String.valueOf(request.getPage())); + } + if (request.getPerPage() != 0) { + params.put("per_page", String.valueOf(request.getPerPage())); + } + if (request.getIncludeParticipants() != null) { + params.put("include_participants", request.getIncludeParticipants() ? "true" : "false"); + } + } + + // This option applies to all request types. + if (request.getIncludeImageUrl() != null) { + params.put("include_image_link", request.getIncludeImageUrl() ? "true" : "false"); + } + + // Send the request and parse the response. + return makeRequest(serviceName, params, null, GetGroupProfilesResponse.class); + } + /** * Build the URI for a particular service call. * |