use of com.ibm.watson.assistant.v1.model.GetIntentOptions in project java-sdk by watson-developer-cloud.
the class Assistant method getIntent.
/**
* Get intent.
*
* <p>Get information about an intent, optionally including all intent content.
*
* @param getIntentOptions the {@link GetIntentOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Intent}
*/
public ServiceCall<Intent> getIntent(GetIntentOptions getIntentOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getIntentOptions, "getIntentOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("workspace_id", getIntentOptions.workspaceId());
pathParamsMap.put("intent", getIntentOptions.intent());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/workspaces/{workspace_id}/intents/{intent}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getIntent");
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 (getIntentOptions.export() != null) {
builder.query("export", String.valueOf(getIntentOptions.export()));
}
if (getIntentOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getIntentOptions.includeAudit()));
}
ResponseConverter<Intent> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Intent>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations