Search in sources :

Example 6 with Assistant

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

the class Assistant method listWorkspaces.

/**
 * List workspaces.
 *
 * List the workspaces associated with an Assistant service instance. This operation is limited to 500 requests per 30
 * minutes. For more information, see **Rate limiting**.
 *
 * @param listWorkspacesOptions the {@link ListWorkspacesOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection}
 */
public ServiceCall<WorkspaceCollection> listWorkspaces(ListWorkspacesOptions listWorkspacesOptions) {
    String[] pathSegments = { "v1/workspaces" };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
    builder.query(VERSION, versionDate);
    if (listWorkspacesOptions != null) {
        if (listWorkspacesOptions.pageLimit() != null) {
            builder.query("page_limit", String.valueOf(listWorkspacesOptions.pageLimit()));
        }
        if (listWorkspacesOptions.includeCount() != null) {
            builder.query("include_count", String.valueOf(listWorkspacesOptions.includeCount()));
        }
        if (listWorkspacesOptions.sort() != null) {
            builder.query("sort", listWorkspacesOptions.sort());
        }
        if (listWorkspacesOptions.cursor() != null) {
            builder.query("cursor", listWorkspacesOptions.cursor());
        }
        if (listWorkspacesOptions.includeAudit() != null) {
            builder.query("include_audit", String.valueOf(listWorkspacesOptions.includeAudit()));
        }
    }
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(WorkspaceCollection.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) WorkspaceCollection(com.ibm.watson.developer_cloud.assistant.v1.model.WorkspaceCollection)

Aggregations

MessageOptions (com.ibm.watson.developer_cloud.assistant.v1.model.MessageOptions)5 Test (org.junit.Test)3 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)2 Assistant (com.ibm.watson.developer_cloud.assistant.v1.Assistant)2 MessageResponse (com.ibm.watson.developer_cloud.assistant.v1.model.MessageResponse)2 OutputData (com.ibm.watson.developer_cloud.assistant.v1.model.OutputData)1 WorkspaceCollection (com.ibm.watson.developer_cloud.assistant.v1.model.WorkspaceCollection)1 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)1 ServiceCallback (com.ibm.watson.developer_cloud.http.ServiceCallback)1 ToneAnalyzer (com.ibm.watson.developer_cloud.tone_analyzer.v3.ToneAnalyzer)1 ToneAnalysis (com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis)1 HashMap (java.util.HashMap)1 CompletableFuture (jersey.repackaged.jsr166e.CompletableFuture)1