Search in sources :

Example 6 with EntityCollection

use of com.ibm.watson.developer_cloud.assistant.v1.model.EntityCollection in project java-sdk by watson-developer-cloud.

the class Conversation method listEntities.

/**
 * List entities.
 *
 * List the entities for a workspace.
 *
 * @param listEntitiesOptions the {@link ListEntitiesOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link EntityCollection}
 */
public ServiceCall<EntityCollection> listEntities(ListEntitiesOptions listEntitiesOptions) {
    Validator.notNull(listEntitiesOptions, "listEntitiesOptions cannot be null");
    String[] pathSegments = { "v1/workspaces", "entities" };
    String[] pathParameters = { listEntitiesOptions.workspaceId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    builder.query(VERSION, versionDate);
    if (listEntitiesOptions.export() != null) {
        builder.query("export", String.valueOf(listEntitiesOptions.export()));
    }
    if (listEntitiesOptions.pageLimit() != null) {
        builder.query("page_limit", String.valueOf(listEntitiesOptions.pageLimit()));
    }
    if (listEntitiesOptions.includeCount() != null) {
        builder.query("include_count", String.valueOf(listEntitiesOptions.includeCount()));
    }
    if (listEntitiesOptions.sort() != null) {
        builder.query("sort", listEntitiesOptions.sort());
    }
    if (listEntitiesOptions.cursor() != null) {
        builder.query("cursor", listEntitiesOptions.cursor());
    }
    if (listEntitiesOptions.includeAudit() != null) {
        builder.query("include_audit", String.valueOf(listEntitiesOptions.includeAudit()));
    }
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(EntityCollection.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) EntityCollection(com.ibm.watson.developer_cloud.conversation.v1.model.EntityCollection)

Aggregations

NotFoundException (com.ibm.watson.developer_cloud.service.exception.NotFoundException)4 Ignore (org.junit.Ignore)4 Test (org.junit.Test)4 EntityCollection (com.ibm.watson.developer_cloud.assistant.v1.model.EntityCollection)3 EntityCollection (com.ibm.watson.developer_cloud.conversation.v1.model.EntityCollection)3 CreateEntityOptions (com.ibm.watson.developer_cloud.assistant.v1.model.CreateEntityOptions)2 DeleteEntityOptions (com.ibm.watson.developer_cloud.assistant.v1.model.DeleteEntityOptions)2 EntityExport (com.ibm.watson.developer_cloud.assistant.v1.model.EntityExport)2 ListEntitiesOptions (com.ibm.watson.developer_cloud.assistant.v1.model.ListEntitiesOptions)2 CreateEntityOptions (com.ibm.watson.developer_cloud.conversation.v1.model.CreateEntityOptions)2 DeleteEntityOptions (com.ibm.watson.developer_cloud.conversation.v1.model.DeleteEntityOptions)2 EntityExport (com.ibm.watson.developer_cloud.conversation.v1.model.EntityExport)2 ListEntitiesOptions (com.ibm.watson.developer_cloud.conversation.v1.model.ListEntitiesOptions)2 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)2 CreateValue (com.ibm.watson.developer_cloud.assistant.v1.model.CreateValue)1 CreateValue (com.ibm.watson.developer_cloud.conversation.v1.model.CreateValue)1