Search in sources :

Example 6 with ListDialogNodesOptions

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

the class Assistant method listDialogNodes.

/**
 * List dialog nodes.
 *
 * <p>List the dialog nodes for a workspace.
 *
 * @param listDialogNodesOptions the {@link ListDialogNodesOptions} containing the options for the
 *     call
 * @return a {@link ServiceCall} with a result of type {@link DialogNodeCollection}
 */
public ServiceCall<DialogNodeCollection> listDialogNodes(ListDialogNodesOptions listDialogNodesOptions) {
    com.ibm.cloud.sdk.core.util.Validator.notNull(listDialogNodesOptions, "listDialogNodesOptions cannot be null");
    Map<String, String> pathParamsMap = new HashMap<String, String>();
    pathParamsMap.put("workspace_id", listDialogNodesOptions.workspaceId());
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/workspaces/{workspace_id}/dialog_nodes", pathParamsMap));
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listDialogNodes");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
        builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    builder.query("version", String.valueOf(this.version));
    if (listDialogNodesOptions.pageLimit() != null) {
        builder.query("page_limit", String.valueOf(listDialogNodesOptions.pageLimit()));
    }
    if (listDialogNodesOptions.includeCount() != null) {
        builder.query("include_count", String.valueOf(listDialogNodesOptions.includeCount()));
    }
    if (listDialogNodesOptions.sort() != null) {
        builder.query("sort", String.valueOf(listDialogNodesOptions.sort()));
    }
    if (listDialogNodesOptions.cursor() != null) {
        builder.query("cursor", String.valueOf(listDialogNodesOptions.cursor()));
    }
    if (listDialogNodesOptions.includeAudit() != null) {
        builder.query("include_audit", String.valueOf(listDialogNodesOptions.includeAudit()));
    }
    ResponseConverter<DialogNodeCollection> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<DialogNodeCollection>() {
    }.getType());
    return createServiceCall(builder.build(), responseConverter);
}
Also used : RequestBuilder(com.ibm.cloud.sdk.core.http.RequestBuilder) HashMap(java.util.HashMap) DialogNodeCollection(com.ibm.watson.assistant.v1.model.DialogNodeCollection)

Aggregations

NotFoundException (com.ibm.watson.developer_cloud.service.exception.NotFoundException)4 UnauthorizedException (com.ibm.watson.developer_cloud.service.exception.UnauthorizedException)4 Test (org.junit.Test)4 DialogNodeCollection (com.ibm.watson.assistant.v1.model.DialogNodeCollection)2 CreateDialogNodeOptions (com.ibm.watson.developer_cloud.assistant.v1.model.CreateDialogNodeOptions)2 DeleteDialogNodeOptions (com.ibm.watson.developer_cloud.assistant.v1.model.DeleteDialogNodeOptions)2 DialogNodeCollection (com.ibm.watson.developer_cloud.assistant.v1.model.DialogNodeCollection)2 ListDialogNodesOptions (com.ibm.watson.developer_cloud.assistant.v1.model.ListDialogNodesOptions)2 CreateDialogNodeOptions (com.ibm.watson.developer_cloud.conversation.v1.model.CreateDialogNodeOptions)2 DeleteDialogNodeOptions (com.ibm.watson.developer_cloud.conversation.v1.model.DeleteDialogNodeOptions)2 DialogNodeCollection (com.ibm.watson.developer_cloud.conversation.v1.model.DialogNodeCollection)2 ListDialogNodesOptions (com.ibm.watson.developer_cloud.conversation.v1.model.ListDialogNodesOptions)2 Date (java.util.Date)2 RequestBuilder (com.ibm.cloud.sdk.core.http.RequestBuilder)1 ListDialogNodesOptions (com.ibm.watson.assistant.v1.model.ListDialogNodesOptions)1 DialogNode (com.ibm.watson.developer_cloud.assistant.v1.model.DialogNode)1 DialogNode (com.ibm.watson.developer_cloud.conversation.v1.model.DialogNode)1 HashMap (java.util.HashMap)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1