use of com.ibm.cloud.cloudant.v1.model.ActivityTrackerEvents in project cloudant-java-sdk by IBM.
the class Cloudant method getActivityTrackerEvents.
/**
* Retrieve Activity Tracker events information.
*
* Check event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.
*
* @param getActivityTrackerEventsOptions the {@link GetActivityTrackerEventsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link ActivityTrackerEvents}
*/
public ServiceCall<ActivityTrackerEvents> getActivityTrackerEvents(GetActivityTrackerEventsOptions getActivityTrackerEventsOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_api/v2/user/activity_tracker/events"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getActivityTrackerEvents");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<ActivityTrackerEvents> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ActivityTrackerEvents>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.model.ActivityTrackerEvents in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetActivityTrackerEventsWOptions.
@Test
public void testGetActivityTrackerEventsWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"types\": [\"management\"]}";
String getActivityTrackerEventsPath = "/_api/v2/user/activity_tracker/events";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetActivityTrackerEventsOptions model
GetActivityTrackerEventsOptions getActivityTrackerEventsOptionsModel = new GetActivityTrackerEventsOptions();
// Invoke operation with valid options model (positive test)
Response<ActivityTrackerEvents> response = cloudantService.getActivityTrackerEvents(getActivityTrackerEventsOptionsModel).execute();
assertNotNull(response);
ActivityTrackerEvents responseObj = response.getResult();
assertNotNull(responseObj);
// Verify the contents of the request
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "GET");
// Check query
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
// Check request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, getActivityTrackerEventsPath);
}
use of com.ibm.cloud.cloudant.v1.model.ActivityTrackerEvents in project cloudant-java-sdk by IBM.
the class ActivityTrackerEventsTest method testActivityTrackerEvents.
@Test
public void testActivityTrackerEvents() throws Throwable {
ActivityTrackerEvents activityTrackerEventsModel = new ActivityTrackerEvents.Builder().types(new java.util.ArrayList<String>(java.util.Arrays.asList("management"))).build();
assertEquals(activityTrackerEventsModel.types(), new java.util.ArrayList<String>(java.util.Arrays.asList("management")));
String json = TestUtilities.serialize(activityTrackerEventsModel);
ActivityTrackerEvents activityTrackerEventsModelNew = TestUtilities.deserialize(json, ActivityTrackerEvents.class);
assertTrue(activityTrackerEventsModelNew instanceof ActivityTrackerEvents);
}
Aggregations