diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2018-07-14 12:13:04 -0700 |
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net> | 2018-07-14 12:13:04 -0700 |
| commit | 808c6323049c1efff52f20d872813f86e21c5b37 (patch) | |
| tree | acf7ec4000631e5fa7d5d9a8155367070c23fffa /src/main/java/com/p4square/ccbapi/CCBAPIClient.java | |
| parent | 35887b81ac23a389f123df529e45fd9c49ce7459 (diff) | |
| parent | 633d0cebff548b6a54ac33e464447d93e800bf12 (diff) | |
Merge branch 'groups-api'
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. * |
