use of com.ibm.watson.assistant.v1.model.ListIntentsOptions in project java-sdk by watson-developer-cloud.
the class Assistant method listIntents.
/**
* List intents.
*
* <p>List the intents for a workspace.
*
* @param listIntentsOptions the {@link ListIntentsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link IntentCollection}
*/
public ServiceCall<IntentCollection> listIntents(ListIntentsOptions listIntentsOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(listIntentsOptions, "listIntentsOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("workspace_id", listIntentsOptions.workspaceId());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/workspaces/{workspace_id}/intents", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listIntents");
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 (listIntentsOptions.export() != null) {
builder.query("export", String.valueOf(listIntentsOptions.export()));
}
if (listIntentsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listIntentsOptions.pageLimit()));
}
if (listIntentsOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listIntentsOptions.includeCount()));
}
if (listIntentsOptions.sort() != null) {
builder.query("sort", String.valueOf(listIntentsOptions.sort()));
}
if (listIntentsOptions.cursor() != null) {
builder.query("cursor", String.valueOf(listIntentsOptions.cursor()));
}
if (listIntentsOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listIntentsOptions.includeAudit()));
}
ResponseConverter<IntentCollection> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<IntentCollection>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations