use of com.ibm.watson.developer_cloud.conversation.v1.model.ListLogsOptions in project java-sdk by watson-developer-cloud.
the class Conversation method listLogs.
/**
* List log events in a workspace.
*
* List log events in a specific workspace.
*
* @param listLogsOptions the {@link ListLogsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link LogCollection}
*/
public ServiceCall<LogCollection> listLogs(ListLogsOptions listLogsOptions) {
Validator.notNull(listLogsOptions, "listLogsOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "logs" };
String[] pathParameters = { listLogsOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
builder.query(VERSION, versionDate);
if (listLogsOptions.sort() != null) {
builder.query("sort", listLogsOptions.sort());
}
if (listLogsOptions.filter() != null) {
builder.query("filter", listLogsOptions.filter());
}
if (listLogsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listLogsOptions.pageLimit()));
}
if (listLogsOptions.cursor() != null) {
builder.query("cursor", listLogsOptions.cursor());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LogCollection.class));
}
use of com.ibm.watson.developer_cloud.conversation.v1.model.ListLogsOptions in project java-sdk by watson-developer-cloud.
the class AssistantServiceIT method testListLogs.
/**
* Test listLogs.
*/
@Test
public void testListLogs() {
try {
ListLogsOptions listOptions = new ListLogsOptions.Builder().workspaceId(workspaceId).build();
LogCollection response = service.listLogs(listOptions).execute();
assertNotNull(response);
assertNotNull(response.getLogs());
assertNotNull(response.getPagination());
// nextUrl may be null
if (response.getPagination().getNextUrl() == null) {
assertNull(response.getPagination().getCursor());
} else {
assertNotNull(response.getPagination().getCursor());
}
} catch (Exception ex) {
fail(ex.getMessage());
}
}
use of com.ibm.watson.developer_cloud.conversation.v1.model.ListLogsOptions in project java-sdk by watson-developer-cloud.
the class ConversationServiceIT method testListLogs.
/**
* Test listLogs.
*/
@Test
public void testListLogs() {
try {
ListLogsOptions listOptions = new ListLogsOptions.Builder().workspaceId(workspaceId).build();
LogCollection response = service.listLogs(listOptions).execute();
assertNotNull(response);
assertNotNull(response.getLogs());
assertNotNull(response.getPagination());
// nextUrl may be null
if (response.getPagination().getNextUrl() == null) {
assertNull(response.getPagination().getCursor());
} else {
assertNotNull(response.getPagination().getCursor());
}
} catch (Exception ex) {
fail(ex.getMessage());
}
}
Aggregations