Search in sources :

Example 31 with DialogNode

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

the class Assistant method getDialogNode.

/**
 * Get dialog node.
 *
 * <p>Get information about a dialog node.
 *
 * @param getDialogNodeOptions the {@link GetDialogNodeOptions} containing the options for the
 *     call
 * @return a {@link ServiceCall} with a result of type {@link DialogNode}
 */
public ServiceCall<DialogNode> getDialogNode(GetDialogNodeOptions getDialogNodeOptions) {
    com.ibm.cloud.sdk.core.util.Validator.notNull(getDialogNodeOptions, "getDialogNodeOptions cannot be null");
    Map<String, String> pathParamsMap = new HashMap<String, String>();
    pathParamsMap.put("workspace_id", getDialogNodeOptions.workspaceId());
    pathParamsMap.put("dialog_node", getDialogNodeOptions.dialogNode());
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/workspaces/{workspace_id}/dialog_nodes/{dialog_node}", pathParamsMap));
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getDialogNode");
    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 (getDialogNodeOptions.includeAudit() != null) {
        builder.query("include_audit", String.valueOf(getDialogNodeOptions.includeAudit()));
    }
    ResponseConverter<DialogNode> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<DialogNode>() {
    }.getType());
    return createServiceCall(builder.build(), responseConverter);
}
Also used : RequestBuilder(com.ibm.cloud.sdk.core.http.RequestBuilder) HashMap(java.util.HashMap) DialogNode(com.ibm.watson.assistant.v1.model.DialogNode)

Aggregations

MockResponse (okhttp3.mockwebserver.MockResponse)13 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)13 Test (org.testng.annotations.Test)13 DialogNode (com.ibm.watson.assistant.v1.model.DialogNode)10 HashMap (java.util.HashMap)10 NotFoundException (com.ibm.watson.developer_cloud.service.exception.NotFoundException)8 UnauthorizedException (com.ibm.watson.developer_cloud.service.exception.UnauthorizedException)8 Test (org.junit.Test)8 DialogNode (com.ibm.watson.developer_cloud.assistant.v1.model.DialogNode)7 DialogNode (com.ibm.watson.developer_cloud.conversation.v1.model.DialogNode)7 JsonObject (com.google.gson.JsonObject)6 DialogNodeContext (com.ibm.watson.assistant.v1.model.DialogNodeContext)6 DialogNodeAction (com.ibm.watson.assistant.v1.model.DialogNodeAction)5 DialogNodeNextStep (com.ibm.watson.assistant.v1.model.DialogNodeNextStep)5 DialogNodeOutput (com.ibm.watson.assistant.v1.model.DialogNodeOutput)5 DialogNodeOutputGeneric (com.ibm.watson.assistant.v1.model.DialogNodeOutputGeneric)5 DialogNodeOutputModifiers (com.ibm.watson.assistant.v1.model.DialogNodeOutputModifiers)5 ResponseGenericChannel (com.ibm.watson.assistant.v1.model.ResponseGenericChannel)5 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)5 Map (java.util.Map)5