From 1b8b67c194c4cd2d0a6b01c43a4e15da31b9294b Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Thu, 24 Sep 2020 13:51:52 -0500 Subject: [PATCH 01/27] fix(generation): api def tag 'sdk-2020-08-20' with disco-v2 passage update gen tag '2.3.1' --- .../ibm/watson/assistant/v1/Assistant.java | 4 +- .../ibm/watson/assistant/v2/Assistant.java | 4 +- .../v2/model/MessageContextSkill.java | 10 +- .../discovery/v1/model/CredentialDetails.java | 10 +- .../ibm/watson/discovery/v2/Discovery.java | 832 +++++++----------- .../discovery/v2/model/QueryResponse.java | 15 +- .../v2/model/QueryResponsePassage.java | 118 +++ .../v3/model/ListDocumentsOptions.java | 34 +- .../ListIdentifiableLanguagesOptions.java | 34 +- .../v3/model/ListLanguagesOptions.java | 32 +- .../v1/model/ListClassifiersOptions.java | 34 +- .../v1/NaturalLanguageUnderstanding.java | 4 +- .../v1/model/CategoriesOptions.java | 10 +- .../v1/model/ListModelsOptions.java | 34 +- .../v1/model/MetadataOptions.java | 34 +- .../speech_to_text/v1/SpeechToText.java | 69 +- .../v1/model/CheckJobsOptions.java | 34 +- .../v1/model/ListModelsOptions.java | 34 +- .../v1/model/RecognizeOptions.java | 111 +-- .../model/SpeechRecognitionAlternative.java | 10 +- .../text_to_speech/v1/TextToSpeech.java | 55 +- .../v1/model/ListVoicesOptions.java | 34 +- .../v1/model/SynthesizeOptions.java | 35 +- .../v3/VisualRecognition.java | 23 +- .../v4/VisualRecognition.java | 25 +- .../v4/model/ListCollectionsOptions.java | 34 +- .../v4/model/UpdateObjectMetadata.java | 5 +- 27 files changed, 534 insertions(+), 1144 deletions(-) create mode 100644 discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponsePassage.java diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java index 415c3aa3325..1ada85669eb 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -101,7 +101,7 @@ */ public class Assistant extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "assistant"; + private static final String DEFAULT_SERVICE_NAME = "conversation"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.assistant.watson.cloud.ibm.com"; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java index e4e817609e5..67794c50b02 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -47,7 +47,7 @@ */ public class Assistant extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "assistant"; + private static final String DEFAULT_SERVICE_NAME = "conversation"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.assistant.watson.cloud.ibm.com"; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java index bd0a7741b6b..66516baef05 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -25,12 +25,12 @@ public class MessageContextSkill extends GenericModel { @SerializedName("user_defined") protected Map userDefined; - protected Map system; + protected MessageContextSkillSystem system; /** Builder. */ public static class Builder { private Map userDefined; - private Map system; + private MessageContextSkillSystem system; private Builder(MessageContextSkill messageContextSkill) { this.userDefined = messageContextSkill.userDefined; @@ -66,7 +66,7 @@ public Builder userDefined(Map userDefined) { * @param system the system * @return the MessageContextSkill builder */ - public Builder system(Map system) { + public Builder system(MessageContextSkillSystem system) { this.system = system; return this; } @@ -104,7 +104,7 @@ public Map userDefined() { * * @return the system */ - public Map system() { + public MessageContextSkillSystem system() { return system; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java index 894ca91c0b4..7d382c76295 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -39,7 +39,7 @@ public interface CredentialType { /** saml. */ String SAML = "saml"; /** username_password. */ - String USERNAME_PASSWORD = "username_password"; // pragma: whitelist secret + String USERNAME_PASSWORD = "username_password"; /** noauth. */ String NOAUTH = "noauth"; /** basic. */ @@ -141,7 +141,7 @@ private Builder(CredentialDetails credentialDetails) { this.publicKeyId = credentialDetails.publicKeyId; this.privateKey = credentialDetails.privateKey; this.passphrase = credentialDetails.passphrase; - this.password = credentialDetails.password; // pragma: whitelist secret + this.password = credentialDetails.password; this.gatewayId = credentialDetails.gatewayId; this.sourceVersion = credentialDetails.sourceVersion; this.webApplicationUrl = credentialDetails.webApplicationUrl; @@ -291,7 +291,7 @@ public Builder passphrase(String passphrase) { * @return the CredentialDetails builder */ public Builder password(String password) { - this.password = password; // pragma: whitelist secret + this.password = password; return this; } @@ -385,7 +385,7 @@ protected CredentialDetails(Builder builder) { publicKeyId = builder.publicKeyId; privateKey = builder.privateKey; passphrase = builder.passphrase; - password = builder.password; // pragma: whitelist secret + password = builder.password; gatewayId = builder.gatewayId; sourceVersion = builder.sourceVersion; webApplicationUrl = builder.webApplicationUrl; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java index ef5d5b8fd5d..a3d8886a0ce 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -71,10 +71,10 @@ import okhttp3.MultipartBody; /** - * IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add - * to applications to identify patterns, trends and actionable insights to drive better - * decision-making. Securely unify structured and unstructured data with pre-enriched content, and - * use a simplified query language to eliminate the need for manual filtering of results. + * IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to + * identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and + * unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual + * filtering of results. * * @version v2 * @see Discovery @@ -83,30 +83,26 @@ public class Discovery extends BaseService { private static final String DEFAULT_SERVICE_NAME = "discovery"; - private static final String DEFAULT_SERVICE_URL = - "https://api.us-south.discovery.watson.cloud.ibm.com"; + private static final String DEFAULT_SERVICE_URL = "https://api.us-south.discovery.watson.cloud.ibm.com"; private String versionDate; - /** +/** * Constructs a new `Discovery` client using the DEFAULT_SERVICE_NAME. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. */ public Discovery(String versionDate) { - this( - versionDate, - DEFAULT_SERVICE_NAME, - ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); + this(versionDate, DEFAULT_SERVICE_NAME, ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); } /** - * Constructs a new `Discovery` client with the DEFAULT_SERVICE_NAME and the specified - * Authenticator. + * Constructs a new `Discovery` client with the DEFAULT_SERVICE_NAME + * and the specified Authenticator. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. * @param authenticator the Authenticator instance to be configured for this service */ public Discovery(String versionDate, Authenticator authenticator) { @@ -116,8 +112,8 @@ public Discovery(String versionDate, Authenticator authenticator) { /** * Constructs a new `Discovery` client with the specified serviceName. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. * @param serviceName The name of the service to configure. */ public Discovery(String versionDate, String serviceName) { @@ -125,18 +121,18 @@ public Discovery(String versionDate, String serviceName) { } /** - * Constructs a new `Discovery` client with the specified Authenticator and serviceName. + * Constructs a new `Discovery` client with the specified Authenticator + * and serviceName. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. * @param serviceName The name of the service to configure. * @param authenticator the Authenticator instance to be configured for this service */ public Discovery(String versionDate, String serviceName, Authenticator authenticator) { super(serviceName, authenticator); setServiceUrl(DEFAULT_SERVICE_URL); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); this.versionDate = versionDate; this.configureService(serviceName); } @@ -144,21 +140,17 @@ public Discovery(String versionDate, String serviceName, Authenticator authentic /** * List collections. * - *

Lists existing collections for the specified project. + * Lists existing collections for the specified project. * - * @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the - * call + * @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListCollectionsResponse} */ - public ServiceCall listCollections( - ListCollectionsOptions listCollectionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listCollectionsOptions, "listCollectionsOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections"}; - String[] pathParameters = {listCollectionsOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall listCollections(ListCollectionsOptions listCollectionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listCollectionsOptions, + "listCollectionsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { listCollectionsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listCollections"); for (Entry header : sdkHeaders.entrySet()) { @@ -167,29 +159,24 @@ public ServiceCall listCollections( builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Create a collection. * - *

Create a new collection in the specified project. + * Create a new collection in the specified project. * - * @param createCollectionOptions the {@link CreateCollectionOptions} containing the options for - * the call + * @param createCollectionOptions the {@link CreateCollectionOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} */ - public ServiceCall createCollection( - CreateCollectionOptions createCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createCollectionOptions, "createCollectionOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections"}; - String[] pathParameters = {createCollectionOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall createCollection(CreateCollectionOptions createCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createCollectionOptions, + "createCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { createCollectionOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -205,37 +192,28 @@ public ServiceCall createCollection( contentJson.addProperty("language", createCollectionOptions.language()); } if (createCollectionOptions.enrichments() != null) { - contentJson.add( - "enrichments", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createCollectionOptions.enrichments())); + contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createCollectionOptions.enrichments())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get collection. * - *

Get details about the specified collection. + * Get details about the specified collection. * - * @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the - * call + * @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} */ public ServiceCall getCollection(GetCollectionOptions getCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getCollectionOptions, "getCollectionOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections"}; - String[] pathParameters = { - getCollectionOptions.projectId(), getCollectionOptions.collectionId() - }; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(getCollectionOptions, + "getCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { getCollectionOptions.projectId(), getCollectionOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -244,31 +222,24 @@ public ServiceCall getCollection(GetCollectionOptions getColl builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a collection. * - *

Updates the specified collection's name, description, and enrichments. + * Updates the specified collection's name, description, and enrichments. * - * @param updateCollectionOptions the {@link UpdateCollectionOptions} containing the options for - * the call + * @param updateCollectionOptions the {@link UpdateCollectionOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} */ - public ServiceCall updateCollection( - UpdateCollectionOptions updateCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateCollectionOptions, "updateCollectionOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections"}; - String[] pathParameters = { - updateCollectionOptions.projectId(), updateCollectionOptions.collectionId() - }; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall updateCollection(UpdateCollectionOptions updateCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateCollectionOptions, + "updateCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { updateCollectionOptions.projectId(), updateCollectionOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -283,38 +254,29 @@ public ServiceCall updateCollection( contentJson.addProperty("description", updateCollectionOptions.description()); } if (updateCollectionOptions.enrichments() != null) { - contentJson.add( - "enrichments", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateCollectionOptions.enrichments())); + contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateCollectionOptions.enrichments())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete a collection. * - *

Deletes the specified collection from the project. All documents stored in the specified - * collection and not shared is also deleted. + * Deletes the specified collection from the project. All documents stored in the specified collection and not shared + * is also deleted. * - * @param deleteCollectionOptions the {@link DeleteCollectionOptions} containing the options for - * the call + * @param deleteCollectionOptions the {@link DeleteCollectionOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteCollection(DeleteCollectionOptions deleteCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteCollectionOptions, "deleteCollectionOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections"}; - String[] pathParameters = { - deleteCollectionOptions.projectId(), deleteCollectionOptions.collectionId() - }; - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCollectionOptions, + "deleteCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { deleteCollectionOptions.projectId(), deleteCollectionOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -328,23 +290,22 @@ public ServiceCall deleteCollection(DeleteCollectionOptions deleteCollecti /** * Query a project. * - *

By using this method, you can construct queries. For details, see the [Discovery - * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). - * The default query parameters are defined by the settings for this project, see the [Discovery - * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults) - * for an overview of the standard default settings, and see [the Projects API - * documentation](#create-project) for details about how to set custom default query settings. + * By using this method, you can construct queries. For details, see the [Discovery + * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). The default query + * parameters are defined by the settings for this project, see the [Discovery + * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults) for an overview of + * the standard default settings, and see [the Projects API documentation](#create-project) for details about how to + * set custom default query settings. * * @param queryOptions the {@link QueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link QueryResponse} */ public ServiceCall query(QueryOptions queryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, "queryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "query"}; - String[] pathParameters = {queryOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, + "queryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "query" }; + String[] pathParameters = { queryOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "query"); for (Entry header : sdkHeaders.entrySet()) { @@ -353,10 +314,7 @@ public ServiceCall query(QueryOptions queryOptions) { builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (queryOptions.collectionIds() != null) { - contentJson.add( - "collection_ids", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(queryOptions.collectionIds())); + contentJson.add("collection_ids", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.collectionIds())); } if (queryOptions.filter() != null) { contentJson.addProperty("filter", queryOptions.filter()); @@ -374,9 +332,7 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("count", queryOptions.count()); } if (queryOptions.xReturn() != null) { - contentJson.add( - "return", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.xReturn())); + contentJson.add("return", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.xReturn())); } if (queryOptions.offset() != null) { contentJson.addProperty("offset", queryOptions.offset()); @@ -391,58 +347,43 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("spelling_suggestions", queryOptions.spellingSuggestions()); } if (queryOptions.tableResults() != null) { - contentJson.add( - "table_results", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(queryOptions.tableResults())); + contentJson.add("table_results", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.tableResults())); } if (queryOptions.suggestedRefinements() != null) { - contentJson.add( - "suggested_refinements", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(queryOptions.suggestedRefinements())); + contentJson.add("suggested_refinements", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.suggestedRefinements())); } if (queryOptions.passages() != null) { - contentJson.add( - "passages", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.passages())); + contentJson.add("passages", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.passages())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get Autocomplete Suggestions. * - *

Returns completion query suggestions for the specified prefix. + * Returns completion query suggestions for the specified prefix. * - * @param getAutocompletionOptions the {@link GetAutocompletionOptions} containing the options for - * the call + * @param getAutocompletionOptions the {@link GetAutocompletionOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Completions} */ - public ServiceCall getAutocompletion( - GetAutocompletionOptions getAutocompletionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getAutocompletionOptions, "getAutocompletionOptions cannot be null"); - String[] pathSegments = {"v2/projects", "autocompletion"}; - String[] pathParameters = {getAutocompletionOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getAutocompletion(GetAutocompletionOptions getAutocompletionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAutocompletionOptions, + "getAutocompletionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "autocompletion" }; + String[] pathParameters = { getAutocompletionOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "getAutocompletion"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getAutocompletion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); builder.query("prefix", getAutocompletionOptions.prefix()); if (getAutocompletionOptions.collectionIds() != null) { - builder.query( - "collection_ids", RequestUtils.join(getAutocompletionOptions.collectionIds(), ",")); + builder.query("collection_ids", RequestUtils.join(getAutocompletionOptions.collectionIds(), ",")); } if (getAutocompletionOptions.field() != null) { builder.query("field", getAutocompletionOptions.field()); @@ -451,28 +392,25 @@ public ServiceCall getAutocompletion( builder.query("count", String.valueOf(getAutocompletionOptions.count())); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Query system notices. * - *

Queries for notices (errors or warnings) that might have been generated by the system. - * Notices are generated when ingesting documents and performing relevance training. + * Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when + * ingesting documents and performing relevance training. * * @param queryNoticesOptions the {@link QueryNoticesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link QueryNoticesResponse} */ public ServiceCall queryNotices(QueryNoticesOptions queryNoticesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - queryNoticesOptions, "queryNoticesOptions cannot be null"); - String[] pathSegments = {"v2/projects", "notices"}; - String[] pathParameters = {queryNoticesOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryNoticesOptions, + "queryNoticesOptions cannot be null"); + String[] pathSegments = { "v2/projects", "notices" }; + String[] pathParameters = { queryNoticesOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "queryNotices"); for (Entry header : sdkHeaders.entrySet()) { @@ -495,27 +433,24 @@ public ServiceCall queryNotices(QueryNoticesOptions queryN builder.query("offset", String.valueOf(queryNoticesOptions.offset())); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List fields. * - *

Gets a list of the unique fields (and their types) stored in the the specified collections. + * Gets a list of the unique fields (and their types) stored in the the specified collections. * * @param listFieldsOptions the {@link ListFieldsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListFieldsResponse} */ public ServiceCall listFields(ListFieldsOptions listFieldsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listFieldsOptions, "listFieldsOptions cannot be null"); - String[] pathSegments = {"v2/projects", "fields"}; - String[] pathParameters = {listFieldsOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(listFieldsOptions, + "listFieldsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "fields" }; + String[] pathParameters = { listFieldsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listFields"); for (Entry header : sdkHeaders.entrySet()) { @@ -526,90 +461,76 @@ public ServiceCall listFields(ListFieldsOptions listFieldsOp builder.query("collection_ids", RequestUtils.join(listFieldsOptions.collectionIds(), ",")); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List component settings. * - *

Returns default configuration settings for components. + * Returns default configuration settings for components. * - * @param getComponentSettingsOptions the {@link GetComponentSettingsOptions} containing the - * options for the call + * @param getComponentSettingsOptions the {@link GetComponentSettingsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ComponentSettingsResponse} */ - public ServiceCall getComponentSettings( - GetComponentSettingsOptions getComponentSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getComponentSettingsOptions, "getComponentSettingsOptions cannot be null"); - String[] pathSegments = {"v2/projects", "component_settings"}; - String[] pathParameters = {getComponentSettingsOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getComponentSettings(GetComponentSettingsOptions getComponentSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getComponentSettingsOptions, + "getComponentSettingsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "component_settings" }; + String[] pathParameters = { getComponentSettingsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "getComponentSettings"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getComponentSettings"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Add a document. * - *

Add a document to a collection with optional metadata. + * Add a document to a collection with optional metadata. * - *

Returns immediately after the system has accepted the document for processing. + * Returns immediately after the system has accepted the document for processing. * - *

* The user must provide document content, metadata, or both. If the request is missing both - * document content and metadata, it is rejected. + * * The user must provide document content, metadata, or both. If the request is missing both document content and + * metadata, it is rejected. * - *

* The user can set the **Content-Type** parameter on the **file** part to indicate the media - * type of the document. If the **Content-Type** parameter is missing or is one of the generic - * media types (for example, `application/octet-stream`), then the service attempts to - * automatically detect the document's media type. + * * The user can set the **Content-Type** parameter on the **file** part to indicate the media type of the + * document. If the **Content-Type** parameter is missing or is one of the generic media types (for example, + * `application/octet-stream`), then the service attempts to automatically detect the document's media type. * - *

* The following field names are reserved and will be filtered out if present after - * normalization: `id`, `score`, `highlight`, and any field with the prefix of: `_`, `+`, or `-` + * * The following field names are reserved and will be filtered out if present after normalization: `id`, `score`, + * `highlight`, and any field with the prefix of: `_`, `+`, or `-` * - *

* Fields with empty name values after normalization are filtered out before indexing. + * * Fields with empty name values after normalization are filtered out before indexing. * - *

* Fields containing the following characters after normalization are filtered out before - * indexing: `#` and `,` + * * Fields containing the following characters after normalization are filtered out before indexing: `#` and `,` * - *

If the document is uploaded to a collection that has it's data shared with another - * collection, the **X-Watson-Discovery-Force** header must be set to `true`. + * If the document is uploaded to a collection that has it's data shared with another collection, the + * **X-Watson-Discovery-Force** header must be set to `true`. * - *

**Note:** Documents can be added with a specific **document_id** by using the + * **Note:** Documents can be added with a specific **document_id** by using the * **_/v2/projects/{project_id}/collections/{collection_id}/documents** method. * - *

**Note:** This operation only works on collections created to accept direct file uploads. It - * cannot be used to modify a collection that connects to an external source such as Microsoft - * SharePoint. + * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to + * modify a collection that connects to an external source such as Microsoft SharePoint. * * @param addDocumentOptions the {@link AddDocumentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall addDocument(AddDocumentOptions addDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - addDocumentOptions, "addDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); - String[] pathSegments = {"v2/projects", "collections", "documents"}; - String[] pathParameters = {addDocumentOptions.projectId(), addDocumentOptions.collectionId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(addDocumentOptions, + "addDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), "At least one of file or metadata must be supplied."); + String[] pathSegments = { "v2/projects", "collections", "documents" }; + String[] pathParameters = { addDocumentOptions.projectId(), addDocumentOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "addDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -622,9 +543,7 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (addDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = - RequestUtils.inputStreamBody( - addDocumentOptions.file(), addDocumentOptions.fileContentType()); + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(addDocumentOptions.file(), addDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", addDocumentOptions.filename(), fileBody); } if (addDocumentOptions.metadata() != null) { @@ -632,49 +551,38 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a document. * - *

Replace an existing document or add a document with a specified **document_id**. Starts - * ingesting a document with optional metadata. + * Replace an existing document or add a document with a specified **document_id**. Starts ingesting a document with + * optional metadata. * - *

If the document is uploaded to a collection that has it's data shared with another - * collection, the **X-Watson-Discovery-Force** header must be set to `true`. + * If the document is uploaded to a collection that has it's data shared with another collection, the + * **X-Watson-Discovery-Force** header must be set to `true`. * - *

**Note:** When uploading a new document with this method it automatically replaces any - * document stored with the same **document_id** if it exists. + * **Note:** When uploading a new document with this method it automatically replaces any document stored with the + * same **document_id** if it exists. * - *

**Note:** This operation only works on collections created to accept direct file uploads. It - * cannot be used to modify a collection that connects to an external source such as Microsoft - * SharePoint. + * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to + * modify a collection that connects to an external source such as Microsoft SharePoint. * - *

**Note:** If an uploaded document is segmented, all segments will be overwritten, even if - * the updated version of the document has fewer segments. + * **Note:** If an uploaded document is segmented, all segments will be overwritten, even if the updated version of + * the document has fewer segments. * - * @param updateDocumentOptions the {@link UpdateDocumentOptions} containing the options for the - * call + * @param updateDocumentOptions the {@link UpdateDocumentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall updateDocument(UpdateDocumentOptions updateDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateDocumentOptions, "updateDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); - String[] pathSegments = {"v2/projects", "collections", "documents"}; - String[] pathParameters = { - updateDocumentOptions.projectId(), - updateDocumentOptions.collectionId(), - updateDocumentOptions.documentId() - }; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateDocumentOptions, + "updateDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), "At least one of file or metadata must be supplied."); + String[] pathSegments = { "v2/projects", "collections", "documents" }; + String[] pathParameters = { updateDocumentOptions.projectId(), updateDocumentOptions.collectionId(), updateDocumentOptions.documentId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -687,9 +595,7 @@ public ServiceCall updateDocument(UpdateDocumentOptions update MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (updateDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = - RequestUtils.inputStreamBody( - updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", updateDocumentOptions.filename(), fileBody); } if (updateDocumentOptions.metadata() != null) { @@ -697,41 +603,31 @@ public ServiceCall updateDocument(UpdateDocumentOptions update } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete a document. * - *

If the given document ID is invalid, or if the document is not found, then the a success - * response is returned (HTTP status code `200`) with the status set to 'deleted'. + * If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP + * status code `200`) with the status set to 'deleted'. * - *

**Note:** This operation only works on collections created to accept direct file uploads. It - * cannot be used to modify a collection that connects to an external source such as Microsoft - * SharePoint. + * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to + * modify a collection that connects to an external source such as Microsoft SharePoint. * - *

**Note:** Segments of an uploaded document cannot be deleted individually. Delete all - * segments by deleting using the `parent_document_id` of a segment result. + * **Note:** Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using + * the `parent_document_id` of a segment result. * - * @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the - * call + * @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DeleteDocumentResponse} */ - public ServiceCall deleteDocument( - DeleteDocumentOptions deleteDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteDocumentOptions, "deleteDocumentOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections", "documents"}; - String[] pathParameters = { - deleteDocumentOptions.projectId(), - deleteDocumentOptions.collectionId(), - deleteDocumentOptions.documentId() - }; - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall deleteDocument(DeleteDocumentOptions deleteDocumentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteDocumentOptions, + "deleteDocumentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections", "documents" }; + String[] pathParameters = { deleteDocumentOptions.projectId(), deleteDocumentOptions.collectionId(), deleteDocumentOptions.documentId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -742,64 +638,52 @@ public ServiceCall deleteDocument( builder.header("X-Watson-Discovery-Force", deleteDocumentOptions.xWatsonDiscoveryForce()); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List training queries. * - *

List the training queries for the specified project. + * List the training queries for the specified project. * - * @param listTrainingQueriesOptions the {@link ListTrainingQueriesOptions} containing the options - * for the call + * @param listTrainingQueriesOptions the {@link ListTrainingQueriesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuerySet} */ - public ServiceCall listTrainingQueries( - ListTrainingQueriesOptions listTrainingQueriesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listTrainingQueriesOptions, "listTrainingQueriesOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = {listTrainingQueriesOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall listTrainingQueries(ListTrainingQueriesOptions listTrainingQueriesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listTrainingQueriesOptions, + "listTrainingQueriesOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { listTrainingQueriesOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "listTrainingQueries"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listTrainingQueries"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete training queries. * - *

Removes all training queries for the specified project. + * Removes all training queries for the specified project. * - * @param deleteTrainingQueriesOptions the {@link DeleteTrainingQueriesOptions} containing the - * options for the call + * @param deleteTrainingQueriesOptions the {@link DeleteTrainingQueriesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ - public ServiceCall deleteTrainingQueries( - DeleteTrainingQueriesOptions deleteTrainingQueriesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteTrainingQueriesOptions, "deleteTrainingQueriesOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = {deleteTrainingQueriesOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall deleteTrainingQueries(DeleteTrainingQueriesOptions deleteTrainingQueriesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteTrainingQueriesOptions, + "deleteTrainingQueriesOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { deleteTrainingQueriesOptions.projectId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "deleteTrainingQueries"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteTrainingQueries"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -811,66 +695,49 @@ public ServiceCall deleteTrainingQueries( /** * Create training query. * - *

Add a query to the training data for this project. The query can contain a filter and - * natural language query. + * Add a query to the training data for this project. The query can contain a filter and natural language query. * - * @param createTrainingQueryOptions the {@link CreateTrainingQueryOptions} containing the options - * for the call + * @param createTrainingQueryOptions the {@link CreateTrainingQueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall createTrainingQuery( - CreateTrainingQueryOptions createTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createTrainingQueryOptions, "createTrainingQueryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = {createTrainingQueryOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall createTrainingQuery(CreateTrainingQueryOptions createTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createTrainingQueryOptions, + "createTrainingQueryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { createTrainingQueryOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "createTrainingQuery"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.addProperty( - "natural_language_query", createTrainingQueryOptions.naturalLanguageQuery()); - contentJson.add( - "examples", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createTrainingQueryOptions.examples())); + contentJson.addProperty("natural_language_query", createTrainingQueryOptions.naturalLanguageQuery()); + contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createTrainingQueryOptions.examples())); if (createTrainingQueryOptions.filter() != null) { contentJson.addProperty("filter", createTrainingQueryOptions.filter()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get a training data query. * - *

Get details for a specific training data query, including the query string and all examples. + * Get details for a specific training data query, including the query string and all examples. * - * @param getTrainingQueryOptions the {@link GetTrainingQueryOptions} containing the options for - * the call + * @param getTrainingQueryOptions the {@link GetTrainingQueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall getTrainingQuery( - GetTrainingQueryOptions getTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getTrainingQueryOptions, "getTrainingQueryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = { - getTrainingQueryOptions.projectId(), getTrainingQueryOptions.queryId() - }; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getTrainingQuery(GetTrainingQueryOptions getTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getTrainingQueryOptions, + "getTrainingQueryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { getTrainingQueryOptions.projectId(), getTrainingQueryOptions.queryId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { @@ -879,72 +746,56 @@ public ServiceCall getTrainingQuery( builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a training query. * - *

Updates an existing training query and it's examples. + * Updates an existing training query and it's examples. * - * @param updateTrainingQueryOptions the {@link UpdateTrainingQueryOptions} containing the options - * for the call + * @param updateTrainingQueryOptions the {@link UpdateTrainingQueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall updateTrainingQuery( - UpdateTrainingQueryOptions updateTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateTrainingQueryOptions, "updateTrainingQueryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = { - updateTrainingQueryOptions.projectId(), updateTrainingQueryOptions.queryId() - }; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall updateTrainingQuery(UpdateTrainingQueryOptions updateTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateTrainingQueryOptions, + "updateTrainingQueryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { updateTrainingQueryOptions.projectId(), updateTrainingQueryOptions.queryId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "updateTrainingQuery"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.addProperty( - "natural_language_query", updateTrainingQueryOptions.naturalLanguageQuery()); - contentJson.add( - "examples", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateTrainingQueryOptions.examples())); + contentJson.addProperty("natural_language_query", updateTrainingQueryOptions.naturalLanguageQuery()); + contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateTrainingQueryOptions.examples())); if (updateTrainingQueryOptions.filter() != null) { contentJson.addProperty("filter", updateTrainingQueryOptions.filter()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List Enrichments. * - *

List the enrichments available to this project. + * List the enrichments available to this project. * - * @param listEnrichmentsOptions the {@link ListEnrichmentsOptions} containing the options for the - * call + * @param listEnrichmentsOptions the {@link ListEnrichmentsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Enrichments} */ public ServiceCall listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listEnrichmentsOptions, "listEnrichmentsOptions cannot be null"); - String[] pathSegments = {"v2/projects", "enrichments"}; - String[] pathParameters = {listEnrichmentsOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(listEnrichmentsOptions, + "listEnrichmentsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { listEnrichmentsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listEnrichments"); for (Entry header : sdkHeaders.entrySet()) { @@ -953,28 +804,24 @@ public ServiceCall listEnrichments(ListEnrichmentsOptions listEnric builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Create an enrichment. * - *

Create an enrichment for use with the specified project/. + * Create an enrichment for use with the specified project/. * - * @param createEnrichmentOptions the {@link CreateEnrichmentOptions} containing the options for - * the call + * @param createEnrichmentOptions the {@link CreateEnrichmentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Enrichment} */ public ServiceCall createEnrichment(CreateEnrichmentOptions createEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createEnrichmentOptions, "createEnrichmentOptions cannot be null"); - String[] pathSegments = {"v2/projects", "enrichments"}; - String[] pathParameters = {createEnrichmentOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(createEnrichmentOptions, + "createEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { createEnrichmentOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -985,36 +832,29 @@ public ServiceCall createEnrichment(CreateEnrichmentOptions createEn multipartBuilder.setType(MultipartBody.FORM); multipartBuilder.addFormDataPart("enrichment", createEnrichmentOptions.enrichment().toString()); if (createEnrichmentOptions.file() != null) { - okhttp3.RequestBody fileBody = - RequestUtils.inputStreamBody(createEnrichmentOptions.file(), "application/octet-stream"); + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(createEnrichmentOptions.file(), "application/octet-stream"); multipartBuilder.addFormDataPart("file", "filename", fileBody); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get enrichment. * - *

Get details about a specific enrichment. + * Get details about a specific enrichment. * - * @param getEnrichmentOptions the {@link GetEnrichmentOptions} containing the options for the - * call + * @param getEnrichmentOptions the {@link GetEnrichmentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Enrichment} */ public ServiceCall getEnrichment(GetEnrichmentOptions getEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getEnrichmentOptions, "getEnrichmentOptions cannot be null"); - String[] pathSegments = {"v2/projects", "enrichments"}; - String[] pathParameters = { - getEnrichmentOptions.projectId(), getEnrichmentOptions.enrichmentId() - }; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(getEnrichmentOptions, + "getEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { getEnrichmentOptions.projectId(), getEnrichmentOptions.enrichmentId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -1023,30 +863,24 @@ public ServiceCall getEnrichment(GetEnrichmentOptions getEnrichmentO builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update an enrichment. * - *

Updates an existing enrichment's name and description. + * Updates an existing enrichment's name and description. * - * @param updateEnrichmentOptions the {@link UpdateEnrichmentOptions} containing the options for - * the call + * @param updateEnrichmentOptions the {@link UpdateEnrichmentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Enrichment} */ public ServiceCall updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateEnrichmentOptions, "updateEnrichmentOptions cannot be null"); - String[] pathSegments = {"v2/projects", "enrichments"}; - String[] pathParameters = { - updateEnrichmentOptions.projectId(), updateEnrichmentOptions.enrichmentId() - }; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateEnrichmentOptions, + "updateEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { updateEnrichmentOptions.projectId(), updateEnrichmentOptions.enrichmentId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -1060,32 +894,26 @@ public ServiceCall updateEnrichment(UpdateEnrichmentOptions updateEn } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete an enrichment. * - *

Deletes an existing enrichment from the specified project. + * Deletes an existing enrichment from the specified project. * - *

**Note:** Only enrichments that have been manually created can be deleted. + * **Note:** Only enrichments that have been manually created can be deleted. * - * @param deleteEnrichmentOptions the {@link DeleteEnrichmentOptions} containing the options for - * the call + * @param deleteEnrichmentOptions the {@link DeleteEnrichmentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteEnrichmentOptions, "deleteEnrichmentOptions cannot be null"); - String[] pathSegments = {"v2/projects", "enrichments"}; - String[] pathParameters = { - deleteEnrichmentOptions.projectId(), deleteEnrichmentOptions.enrichmentId() - }; - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteEnrichmentOptions, + "deleteEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { deleteEnrichmentOptions.projectId(), deleteEnrichmentOptions.enrichmentId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -1099,33 +927,32 @@ public ServiceCall deleteEnrichment(DeleteEnrichmentOptions deleteEnrichme /** * List projects. * - *

Lists existing projects for this instance. + * Lists existing projects for this instance. * * @param listProjectsOptions the {@link ListProjectsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListProjectsResponse} */ public ServiceCall listProjects(ListProjectsOptions listProjectsOptions) { - String[] pathSegments = {"v2/projects"}; - RequestBuilder builder = - RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + String[] pathSegments = { "v2/projects" }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listProjects"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listProjectsOptions != null) {} - + if (listProjectsOptions != null) { + + } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List projects. * - *

Lists existing projects for this instance. + * Lists existing projects for this instance. * * @return a {@link ServiceCall} with a response type of {@link ListProjectsResponse} */ @@ -1136,18 +963,16 @@ public ServiceCall listProjects() { /** * Create a Project. * - *

Create a new project for this instance. + * Create a new project for this instance. * - * @param createProjectOptions the {@link CreateProjectOptions} containing the options for the - * call + * @param createProjectOptions the {@link CreateProjectOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} */ public ServiceCall createProject(CreateProjectOptions createProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createProjectOptions, "createProjectOptions cannot be null"); - String[] pathSegments = {"v2/projects"}; - RequestBuilder builder = - RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + com.ibm.cloud.sdk.core.util.Validator.notNull(createProjectOptions, + "createProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -1158,34 +983,28 @@ public ServiceCall createProject(CreateProjectOptions createProj contentJson.addProperty("name", createProjectOptions.name()); contentJson.addProperty("type", createProjectOptions.type()); if (createProjectOptions.defaultQueryParameters() != null) { - contentJson.add( - "default_query_parameters", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createProjectOptions.defaultQueryParameters())); + contentJson.add("default_query_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProjectOptions.defaultQueryParameters())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get project. * - *

Get details on the specified project. + * Get details on the specified project. * * @param getProjectOptions the {@link GetProjectOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} */ public ServiceCall getProject(GetProjectOptions getProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getProjectOptions, "getProjectOptions cannot be null"); - String[] pathSegments = {"v2/projects"}; - String[] pathParameters = {getProjectOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(getProjectOptions, + "getProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + String[] pathParameters = { getProjectOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -1194,28 +1013,24 @@ public ServiceCall getProject(GetProjectOptions getProjectOption builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a project. * - *

Update the specified project's name. + * Update the specified project's name. * - * @param updateProjectOptions the {@link UpdateProjectOptions} containing the options for the - * call + * @param updateProjectOptions the {@link UpdateProjectOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} */ public ServiceCall updateProject(UpdateProjectOptions updateProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateProjectOptions, "updateProjectOptions cannot be null"); - String[] pathSegments = {"v2/projects"}; - String[] pathParameters = {updateProjectOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateProjectOptions, + "updateProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + String[] pathParameters = { updateProjectOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -1228,31 +1043,27 @@ public ServiceCall updateProject(UpdateProjectOptions updateProj } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete a project. * - *

Deletes the specified project. + * Deletes the specified project. * - *

**Important:** Deleting a project deletes everything that is part of the specified project, - * including all collections. + * **Important:** Deleting a project deletes everything that is part of the specified project, including all + * collections. * - * @param deleteProjectOptions the {@link DeleteProjectOptions} containing the options for the - * call + * @param deleteProjectOptions the {@link DeleteProjectOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteProject(DeleteProjectOptions deleteProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteProjectOptions, "deleteProjectOptions cannot be null"); - String[] pathSegments = {"v2/projects"}; - String[] pathParameters = {deleteProjectOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProjectOptions, + "deleteProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + String[] pathParameters = { deleteProjectOptions.projectId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -1266,26 +1077,24 @@ public ServiceCall deleteProject(DeleteProjectOptions deleteProjectOptions /** * Delete labeled data. * - *

Deletes all data associated with a specified customer ID. The method has no effect if no - * data is associated with the customer ID. + * Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with + * the customer ID. * - *

You associate a customer ID with data by passing the **X-Watson-Metadata** header with a - * request that passes data. For more information about personal data and customer IDs, see - * [Information + * You associate a customer ID with data by passing the **X-Watson-Metadata** header with a request that passes data. + * For more information about personal data and customer IDs, see [Information * security](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-information-security#information-security). * - *

**Note:** This method is only supported on IBM Cloud instances of Discovery. * - * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the - * call + * **Note:** This method is only supported on IBM Cloud instances of Discovery. + * + * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteUserDataOptions, "deleteUserDataOptions cannot be null"); - String[] pathSegments = {"v2/user_data"}; - RequestBuilder builder = - RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, + "deleteUserDataOptions cannot be null"); + String[] pathSegments = { "v2/user_data" }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteUserData"); for (Entry header : sdkHeaders.entrySet()) { @@ -1295,4 +1104,5 @@ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOpti ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } + } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java index 1aecf7c55d9..038f8dce427 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -37,6 +37,8 @@ public class QueryResponse extends GenericModel { @SerializedName("table_results") protected List tableResults; + protected List passages; + /** * Gets the matchingResults. * @@ -113,4 +115,15 @@ public List getSuggestedRefinements() { public List getTableResults() { return tableResults; } + + /** + * Gets the passages. + * + *

Passages returned by Discovery. + * + * @return the passages + */ + public List getPassages() { + return passages; + } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponsePassage.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponsePassage.java new file mode 100644 index 00000000000..610724a73ae --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponsePassage.java @@ -0,0 +1,118 @@ +/* + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** A passage query response. */ +public class QueryResponsePassage extends GenericModel { + + @SerializedName("passage_text") + protected String passageText; + + @SerializedName("passage_score") + protected Double passageScore; + + @SerializedName("document_id") + protected String documentId; + + @SerializedName("collection_id") + protected String collectionId; + + @SerializedName("start_offset") + protected Long startOffset; + + @SerializedName("end_offset") + protected Long endOffset; + + protected String field; + + /** + * Gets the passageText. + * + *

The content of the extracted passage. + * + * @return the passageText + */ + public String getPassageText() { + return passageText; + } + + /** + * Gets the passageScore. + * + *

The confidence score of the passages's analysis. A higher score indicates greater + * confidence. + * + * @return the passageScore + */ + public Double getPassageScore() { + return passageScore; + } + + /** + * Gets the documentId. + * + *

The unique identifier of the ingested document. + * + * @return the documentId + */ + public String getDocumentId() { + return documentId; + } + + /** + * Gets the collectionId. + * + *

The unique identifier of the collection. + * + * @return the collectionId + */ + public String getCollectionId() { + return collectionId; + } + + /** + * Gets the startOffset. + * + *

The position of the first character of the extracted passage in the originating field. + * + * @return the startOffset + */ + public Long getStartOffset() { + return startOffset; + } + + /** + * Gets the endOffset. + * + *

The position of the last character of the extracted passage in the originating field. + * + * @return the endOffset + */ + public Long getEndOffset() { + return endOffset; + } + + /** + * Gets the field. + * + *

The label of the field from which the passage has been extracted. + * + * @return the field + */ + public String getField() { + return field; + } +} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java index 72fbe09c02c..7351da5a66a 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listDocuments options. */ -public class ListDocumentsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListDocumentsOptions listDocumentsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListDocumentsOptions. - * - * @return the listDocumentsOptions - */ - public ListDocumentsOptions build() { - return new ListDocumentsOptions(this); - } - } - - private ListDocumentsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListDocumentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListDocumentsOptions extends GenericModel {} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java index c748206cc00..6135492d374 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listIdentifiableLanguages options. */ -public class ListIdentifiableLanguagesOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListIdentifiableLanguagesOptions listIdentifiableLanguagesOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListIdentifiableLanguagesOptions. - * - * @return the listIdentifiableLanguagesOptions - */ - public ListIdentifiableLanguagesOptions build() { - return new ListIdentifiableLanguagesOptions(this); - } - } - - private ListIdentifiableLanguagesOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListIdentifiableLanguagesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListIdentifiableLanguagesOptions extends GenericModel {} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java index 51ae9393336..0ff8689f8bb 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listLanguages options. */ -public class ListLanguagesOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListLanguagesOptions listDocumentsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListDocumentsOptions. - * - * @return the listDocumentsOptions - */ - public ListLanguagesOptions build() { - return new ListLanguagesOptions(this); - } - } - - private ListLanguagesOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListDocumentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListLanguagesOptions extends GenericModel {} diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java index a24aed424d3..48327ae5557 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listClassifiers options. */ -public class ListClassifiersOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListClassifiersOptions listClassifiersOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListClassifiersOptions. - * - * @return the listClassifiersOptions - */ - public ListClassifiersOptions build() { - return new ListClassifiersOptions(this); - } - } - - private ListClassifiersOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListClassifiersOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListClassifiersOptions extends GenericModel {} diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java index 95410e1b564..3a85a2dc121 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -47,7 +47,7 @@ */ public class NaturalLanguageUnderstanding extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "natural_language_understanding"; + private static final String DEFAULT_SERVICE_NAME = "natural-language-understanding"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com"; diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java index 19f75c08a0b..d60e82ab479 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -24,13 +24,13 @@ public class CategoriesOptions extends GenericModel { protected Boolean explanation; protected Long limit; - @Deprecated protected String model; + protected String model; /** Builder. */ public static class Builder { private Boolean explanation; private Long limit; - @Deprecated private String model; + private String model; private Builder(CategoriesOptions categoriesOptions) { this.explanation = categoriesOptions.explanation; @@ -77,8 +77,6 @@ public Builder limit(long limit) { * * @param model the model * @return the CategoriesOptions builder - * @deprecated the model parameter is no longer supported by the Natural Language Understanding - * service and will be removed in the next major release */ public Builder model(String model) { this.model = model; @@ -137,8 +135,6 @@ public Long limit() { * categories models will no longer be accessible in Knowledge Studio on 17 December 2019. * * @return the model - * @deprecated the model parameter is no longer supported by the Natural Language Understanding - * service and will be removed in the next major release */ public String model() { return model; diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java index ff111c2f348..0b18313874c 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listModels options. */ -public class ListModelsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListModelsOptions listModelsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListModelsOptions. - * - * @return the listModelsOptions - */ - public ListModelsOptions build() { - return new ListModelsOptions(this); - } - } - - private ListModelsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListModelsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListModelsOptions extends GenericModel {} diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java index 2895610936b..57f8c5cec74 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -18,34 +18,4 @@ * Returns information from the document, including author name, title, RSS/ATOM feeds, prominent * page image, and publication date. Supports URL and HTML input types only. */ -public class MetadataOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(MetadataOptions metadataOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a MetadataOptions. - * - * @return the metadataOptions - */ - public MetadataOptions build() { - return new MetadataOptions(this); - } - } - - private MetadataOptions(Builder builder) {} - - /** - * New builder. - * - * @return a MetadataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class MetadataOptions extends GenericModel {} diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index 9c8c9f52788..60f98381955 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -82,11 +82,9 @@ import com.ibm.watson.speech_to_text.v1.model.UpgradeLanguageModelOptions; import com.ibm.watson.speech_to_text.v1.model.Word; import com.ibm.watson.speech_to_text.v1.model.Words; -import com.ibm.watson.speech_to_text.v1.websocket.RecognizeCallback; -import com.ibm.watson.speech_to_text.v1.websocket.SpeechToTextWebSocketListener; import java.util.Map; import java.util.Map.Entry; -import okhttp3.*; +import okhttp3.MultipartBody; /** * The IBM Watson™ Speech to Text service provides APIs that use IBM's speech-recognition @@ -416,61 +414,6 @@ public ServiceCall recognize(RecognizeOptions recogniz return createServiceCall(builder.build(), responseConverter); } - /** - * Sends audio and returns transcription results for recognition requests over a WebSocket - * connection. Requests and responses are enabled over a single TCP connection that abstracts much - * of the complexity of the request to offer efficient implementation, low latency, high - * throughput, and an asynchronous response. By default, only final results are returned for any - * request; to enable interim results, set the interimResults parameter to true. - * - *

The service imposes a data size limit of 100 MB per utterance (per recognition request). You - * can send multiple utterances over a single WebSocket connection. The service automatically - * detects the endianness of the incoming audio and, for audio that includes multiple channels, - * downmixes the audio to one-channel mono during transcoding. (For the audio/l16 format, you can - * specify the endianness.) - * - * @param recognizeOptions the recognize options - * @param callback the {@link RecognizeCallback} instance where results will be sent - * @return the {@link WebSocket} - */ - public WebSocket recognizeUsingWebSocket( - RecognizeOptions recognizeOptions, RecognizeCallback callback) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - recognizeOptions, "recognizeOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(recognizeOptions.audio(), "audio cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); - - HttpUrl.Builder urlBuilder = HttpUrl.parse(getServiceUrl() + "/v1/recognize").newBuilder(); - - if (recognizeOptions.model() != null) { - urlBuilder.addQueryParameter("model", recognizeOptions.model()); - } - if (recognizeOptions.customizationId() != null) { - urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId()); - } - if (recognizeOptions.languageCustomizationId() != null) { - urlBuilder.addQueryParameter( - "language_customization_id", recognizeOptions.languageCustomizationId()); - } - if (recognizeOptions.acousticCustomizationId() != null) { - urlBuilder.addQueryParameter( - "acoustic_customization_id", recognizeOptions.acousticCustomizationId()); - } - if (recognizeOptions.baseModelVersion() != null) { - urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion()); - } - - String url = urlBuilder.toString().replace("https://", "wss://"); - Request.Builder builder = new Request.Builder().url(url); - - setAuthentication(builder); - setDefaultHeaders(builder); - - OkHttpClient client = configureHttpClient(); - return client.newWebSocket( - builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback)); - } - /** * Register a callback. * @@ -1303,8 +1246,12 @@ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { if (addCorpusOptions.allowOverwrite() != null) { builder.query("allow_overwrite", String.valueOf(addCorpusOptions.allowOverwrite())); } - builder.body(RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain")); - + MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); + multipartBuilder.setType(MultipartBody.FORM); + okhttp3.RequestBody corpusFileBody = + RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain"); + multipartBuilder.addFormDataPart("corpus_file", "filename", corpusFileBody); + builder.body(multipartBuilder.build()); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java index 98d61bce423..b5cc8c58088 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The checkJobs options. */ -public class CheckJobsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(CheckJobsOptions checkJobsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a CheckJobsOptions. - * - * @return the checkJobsOptions - */ - public CheckJobsOptions build() { - return new CheckJobsOptions(this); - } - } - - private CheckJobsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a CheckJobsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class CheckJobsOptions extends GenericModel {} diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java index bc8e43bf79d..386903130ba 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listModels options. */ -public class ListModelsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListModelsOptions listModelsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListModelsOptions. - * - * @return the listModelsOptions - */ - public ListModelsOptions build() { - return new ListModelsOptions(this); - } - } - - private ListModelsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListModelsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListModelsOptions extends GenericModel {} diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java index e152e74a8b3..141d9727e61 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -12,7 +12,6 @@ */ package com.ibm.watson.speech_to_text.v1.model; -import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; import java.io.File; import java.io.FileInputStream; @@ -103,11 +102,8 @@ public interface Model { String ZH_CN_NARROWBANDMODEL = "zh-CN_NarrowbandModel"; } - protected transient InputStream audio; - - @SerializedName("content-type") + protected InputStream audio; protected String contentType; - protected String model; protected String languageCustomizationId; protected String acousticCustomizationId; @@ -131,9 +127,6 @@ public interface Model { protected Boolean splitTranscriptAtPhraseEnd; protected Float speechDetectorSensitivity; protected Float backgroundAudioSuppression; - private Boolean interimResults; - private Boolean processingMetrics; - private Float processingMetricsInterval; /** Builder. */ public static class Builder { @@ -162,9 +155,6 @@ public static class Builder { private Boolean splitTranscriptAtPhraseEnd; private Float speechDetectorSensitivity; private Float backgroundAudioSuppression; - private Boolean interimResults; - private Boolean processingMetrics; - private Float processingMetricsInterval; private Builder(RecognizeOptions recognizeOptions) { this.audio = recognizeOptions.audio; @@ -192,9 +182,6 @@ private Builder(RecognizeOptions recognizeOptions) { this.splitTranscriptAtPhraseEnd = recognizeOptions.splitTranscriptAtPhraseEnd; this.speechDetectorSensitivity = recognizeOptions.speechDetectorSensitivity; this.backgroundAudioSuppression = recognizeOptions.backgroundAudioSuppression; - this.interimResults = recognizeOptions.interimResults; - this.processingMetrics = recognizeOptions.processingMetrics; - this.processingMetricsInterval = recognizeOptions.processingMetricsInterval; } /** Instantiates a new builder. */ @@ -233,100 +220,6 @@ public Builder addKeyword(String keyword) { return this; } - /** - * Gets the interimResults. - * - *

If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` - * objects. By default, the service returns a single `SpeechRecognitionResults` object with - * final results only. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the interimResults - */ - public Boolean interimResults() { - return interimResults; - } - - /** - * Gets the processingMetrics. - * - *

If `true`, requests processing metrics about the service's transcription of the input - * audio. The service returns processing metrics at the interval specified by the - * `processing_metrics_interval` parameter. It also returns processing metrics for transcription - * events, for example, for final and interim results. By default, the service returns no - * processing metrics. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the processingMetrics - */ - public Boolean processingMetrics() { - return processingMetrics; - } - - /** - * Gets the processingMetricsInterval. - * - *

Specifies the interval in real wall-clock seconds at which the service is to return - * processing metrics. The parameter is ignored unless the `processing_metrics` parameter is set - * to `true`. - * - *

The parameter accepts a minimum value of 0.1 seconds. The level of precision is not - * restricted, so you can specify values such as 0.25 and 0.125. - * - *

The service does not impose a maximum value. If you want to receive processing metrics - * only for transcription events instead of at periodic intervals, set the value to a large - * number. If the value is larger than the duration of the audio, the service returns processing - * metrics only for transcription events. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the processingMetricsInterval - */ - public Float processingMetricsInterval() { - return processingMetricsInterval; - } - - /** - * Set the interimResults. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param interimResults the interimResults - * @return the interimResults - */ - public Builder interimResults(Boolean interimResults) { - this.interimResults = interimResults; - return this; - } - - /** - * Set the processingMetrics. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param processingMetrics the processingMetrics - * @return the processingMetrics - */ - public Builder processingMetrics(Boolean processingMetrics) { - this.processingMetrics = processingMetrics; - return this; - } - - /** - * Set the processingMetricsInterval. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param processingMetricsInterval the processingMetricsInterval - * @return the processingMetricsInterval - */ - public Builder processingMetricsInterval(Float processingMetricsInterval) { - this.processingMetricsInterval = processingMetricsInterval; - return this; - } - /** * Set the audio. * diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java index da4516574c9..5ee36370d52 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -21,10 +21,10 @@ public class SpeechRecognitionAlternative extends GenericModel { protected String transcript; protected Double confidence; - protected List timestamps; + protected List timestamps; @SerializedName("word_confidence") - protected List wordConfidence; + protected List wordConfidence; /** * Gets the transcript. @@ -60,7 +60,7 @@ public Double getConfidence() { * * @return the timestamps */ - public List getTimestamps() { + public List getTimestamps() { return timestamps; } @@ -74,7 +74,7 @@ public List getTimestamps() { * * @return the wordConfidence */ - public List getWordConfidence() { + public List getWordConfidence() { return wordConfidence; } } diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index 5de00f1fd7e..33601247dac 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -43,15 +43,9 @@ import com.ibm.watson.text_to_speech.v1.model.VoiceModels; import com.ibm.watson.text_to_speech.v1.model.Voices; import com.ibm.watson.text_to_speech.v1.model.Words; -import com.ibm.watson.text_to_speech.v1.websocket.SynthesizeCallback; -import com.ibm.watson.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; import java.io.InputStream; import java.util.Map; import java.util.Map.Entry; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.WebSocket; /** * The IBM Watson™ Text to Speech service provides APIs that use IBM's speech-synthesis @@ -290,53 +284,6 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) return createServiceCall(builder.build(), responseConverter); } - /** - * Synthesize audio. - * - *

Synthesizes text to audio that is spoken in the specified voice. The service bases its - * understanding of the language for the input text on the specified voice. Use a voice that - * matches the language of the input text. - * - *

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for - * the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service - * returns the synthesized audio stream as an array of bytes. - * - *

### Audio formats (accept types) - * - *

For more information about specifying an audio format, including additional details about - * some of the formats, see [Audio - * formats](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-audioFormats#audioFormats). - * - * @param synthesizeOptions the {@link SynthesizeOptions} containing the options for the call - * @param callback the {@link SynthesizeCallback} callback - * @return a {@link WebSocket} instance - */ - public WebSocket synthesizeUsingWebSocket( - SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - synthesizeOptions, "synthesizeOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); - - HttpUrl.Builder urlBuilder = HttpUrl.parse(getServiceUrl() + "/v1/synthesize").newBuilder(); - - if (synthesizeOptions.voice() != null) { - urlBuilder.addQueryParameter("voice", synthesizeOptions.voice()); - } - if (synthesizeOptions.customizationId() != null) { - urlBuilder.addQueryParameter("customization_id", synthesizeOptions.customizationId()); - } - - String url = urlBuilder.toString().replace("https://", "wss://"); - Request.Builder builder = new Request.Builder().url(url); - - setAuthentication(builder); - setDefaultHeaders(builder); - - OkHttpClient client = configureHttpClient(); - return client.newWebSocket( - builder.build(), new TextToSpeechWebSocketListener(synthesizeOptions, callback)); - } - /** * Get pronunciation. * diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java index 27518578077..d9a7628c706 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listVoices options. */ -public class ListVoicesOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListVoicesOptions listVoicesOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListVoicesOptions. - * - * @return the listVoicesOptions - */ - public ListVoicesOptions build() { - return new ListVoicesOptions(this); - } - } - - private ListVoicesOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListVoicesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListVoicesOptions extends GenericModel {} diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java index 2ab6e55da74..9b7c15f1512 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; /** The synthesize options. */ public class SynthesizeOptions extends GenericModel { @@ -114,7 +113,6 @@ public interface Voice { protected String accept; protected String voice; protected String customizationId; - protected List timings; /** Builder. */ public static class Builder { @@ -122,14 +120,12 @@ public static class Builder { private String accept; private String voice; private String customizationId; - protected List timings; private Builder(SynthesizeOptions synthesizeOptions) { this.text = synthesizeOptions.text; this.accept = synthesizeOptions.accept; this.voice = synthesizeOptions.voice; this.customizationId = synthesizeOptions.customizationId; - this.timings = synthesizeOptions.timings; } /** Instantiates a new builder. */ @@ -196,17 +192,6 @@ public Builder customizationId(String customizationId) { this.customizationId = customizationId; return this; } - - /** - * Set the timings. - * - * @param timings the timings - * @return the SynthesizeOptions builder - */ - public Builder timings(List timings) { - this.timings = timings; - return this; - } } protected SynthesizeOptions(Builder builder) { @@ -215,7 +200,6 @@ protected SynthesizeOptions(Builder builder) { accept = builder.accept; voice = builder.voice; customizationId = builder.customizationId; - timings = builder.timings; } /** @@ -275,21 +259,4 @@ public String voice() { public String customizationId() { return customizationId; } - - /** - * Gets the timings. - * - *

An array that specifies whether the service is to return word timing information for all - * strings of the input text. Specify `words` as the element of the array to request word timing - * information. The service returns the start and end time of each word of the input. Specify an - * empty array or omit the parameter to receive no word timing information. Not supported for - * Japanese input text. - * - *

NOTE: This parameter only works for the `synthesizeUsingWebSocket` method. - * - * @return the timings - */ - public List getTimings() { - return timings; - } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java index 1b1834969c7..cdf493ed924 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -47,7 +47,7 @@ */ public class VisualRecognition extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "visual_recognition"; + private static final String DEFAULT_SERVICE_NAME = "watson_vision_combined"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"; @@ -154,11 +154,14 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { multipartBuilder.addFormDataPart("threshold", String.valueOf(classifyOptions.threshold())); } if (classifyOptions.owners() != null) { - multipartBuilder.addFormDataPart("owners", RequestUtils.join(classifyOptions.owners(), ",")); + for (String item : classifyOptions.owners()) { + multipartBuilder.addFormDataPart("owners", item); + } } if (classifyOptions.classifierIds() != null) { - multipartBuilder.addFormDataPart( - "classifier_ids", RequestUtils.join(classifyOptions.classifierIds(), ",")); + for (String item : classifyOptions.classifierIds()) { + multipartBuilder.addFormDataPart("classifier_ids", item); + } } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = @@ -221,18 +224,16 @@ public ServiceCall createClassifier(CreateClassifierOptions createCl String partName = String.format("%s_positive_examples", entry.getKey()); okhttp3.RequestBody part = RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); - multipartBuilder.addFormDataPart(partName, entry.getKey() + ".zip", part); + multipartBuilder.addFormDataPart(partName, entry.getKey(), part); } if (createClassifierOptions.negativeExamples() != null) { okhttp3.RequestBody negativeExamplesBody = RequestUtils.inputStreamBody( createClassifierOptions.negativeExamples(), "application/octet-stream"); - String negativeExamplesFilename = createClassifierOptions.negativeExamplesFilename(); - if (!negativeExamplesFilename.contains(".")) { - negativeExamplesFilename += ".zip"; - } multipartBuilder.addFormDataPart( - "negative_examples", negativeExamplesFilename, negativeExamplesBody); + "negative_examples", + createClassifierOptions.negativeExamplesFilename(), + negativeExamplesBody); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java index 976a2063aa7..6e51cb6c7f4 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -70,7 +70,7 @@ */ public class VisualRecognition extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "visual_recognition"; + private static final String DEFAULT_SERVICE_NAME = "watson_vision_combined"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"; @@ -157,9 +157,12 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { builder.header("Accept", "application/json"); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - multipartBuilder.addFormDataPart( - "collection_ids", RequestUtils.join(analyzeOptions.collectionIds(), ",")); - multipartBuilder.addFormDataPart("features", RequestUtils.join(analyzeOptions.features(), ",")); + for (String item : analyzeOptions.collectionIds()) { + multipartBuilder.addFormDataPart("collection_ids", item); + } + for (String item : analyzeOptions.features()) { + multipartBuilder.addFormDataPart("features", item); + } if (analyzeOptions.imagesFile() != null) { for (FileWithMetadata item : analyzeOptions.imagesFile()) { okhttp3.RequestBody itemBody = @@ -211,13 +214,11 @@ public ServiceCall createCollection(CreateCollectionOptions createCo } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - if (createCollectionOptions != null) { - if (createCollectionOptions.name() != null) { - contentJson.addProperty("name", createCollectionOptions.name()); - } - if (createCollectionOptions.description() != null) { - contentJson.addProperty("description", createCollectionOptions.description()); - } + if (createCollectionOptions.name() != null) { + contentJson.addProperty("name", createCollectionOptions.name()); + } + if (createCollectionOptions.description() != null) { + contentJson.addProperty("description", createCollectionOptions.description()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java index bd1c284500c..5026a11d24f 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listCollections options. */ -public class ListCollectionsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListCollectionsOptions listCollectionsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListCollectionsOptions. - * - * @return the listCollectionsOptions - */ - public ListCollectionsOptions build() { - return new ListCollectionsOptions(this); - } - } - - private ListCollectionsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListCollectionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListCollectionsOptions extends GenericModel {} diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java index ef2ec2f19c5..d840ab66ddc 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java @@ -37,11 +37,9 @@ public Builder() {} * Instantiates a new builder with required properties. * * @param object the object - * @param count the count */ - public Builder(String object, Long count) { + public Builder(String object) { this.object = object; - this.count = count; } /** @@ -78,7 +76,6 @@ public Builder count(long count) { protected UpdateObjectMetadata(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notNull(builder.object, "object cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.count, "count cannot be null"); object = builder.object; count = builder.count; } From 139d33a1e198591296392bb36a29bc6512403d8e Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:50:33 -0500 Subject: [PATCH 02/27] chore(assistant-v1): manual changes --- .../src/main/java/com/ibm/watson/assistant/v1/Assistant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java index 1ada85669eb..ced1da6a2a1 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java @@ -101,7 +101,7 @@ */ public class Assistant extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "conversation"; + private static final String DEFAULT_SERVICE_NAME = "assistant"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.assistant.watson.cloud.ibm.com"; From 076e0c5d7f90f5e55fce0f5e5c67b6955ae4a98b Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:50:53 -0500 Subject: [PATCH 03/27] chore(assistant-v2): manual changes --- .../src/main/java/com/ibm/watson/assistant/v2/Assistant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java index 67794c50b02..68a567a7960 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java @@ -47,7 +47,7 @@ */ public class Assistant extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "conversation"; + private static final String DEFAULT_SERVICE_NAME = "assistant"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.assistant.watson.cloud.ibm.com"; From 03efcd4e30abb94cea9c569a106a674dcdd2e7bd Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:52:38 -0500 Subject: [PATCH 04/27] chore(language-translator-v3): manual changes --- .../v3/model/ListDocumentsOptions.java | 39 ++++++++++++++++++- .../ListIdentifiableLanguagesOptions.java | 39 ++++++++++++++++++- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java index 7351da5a66a..ca48b4f1ae2 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listDocuments options. */ -public class ListDocumentsOptions extends GenericModel {} +public class ListDocumentsOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListDocumentsOptions listDocumentsOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListDocumentsOptions. + * + * @return the listDocumentsOptions + */ + public ListDocumentsOptions build() { + return new ListDocumentsOptions(this); + } + } + + private ListDocumentsOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListDocumentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java index 6135492d374..7109ade79af 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listIdentifiableLanguages options. */ -public class ListIdentifiableLanguagesOptions extends GenericModel {} +public class ListIdentifiableLanguagesOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListIdentifiableLanguagesOptions listIdentifiableLanguagesOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListIdentifiableLanguagesOptions. + * + * @return the listIdentifiableLanguagesOptions + */ + public ListIdentifiableLanguagesOptions build() { + return new ListIdentifiableLanguagesOptions(this); + } + } + + private ListIdentifiableLanguagesOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListIdentifiableLanguagesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} From c80edaba6266bf1e0befd19f3e599660f9e7e4a4 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:53:24 -0500 Subject: [PATCH 05/27] chore(natural-language-classifier-v1): manual changes --- .../v1/model/ListClassifiersOptions.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java index 48327ae5557..68ca0d5f30d 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listClassifiers options. */ -public class ListClassifiersOptions extends GenericModel {} +public class ListClassifiersOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListClassifiersOptions listClassifiersOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListClassifiersOptions. + * + * @return the listClassifiersOptions + */ + public ListClassifiersOptions build() { + return new ListClassifiersOptions(this); + } + } + + private ListClassifiersOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListClassifiersOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} From fa3e487101e6aa3096e16840e7893241c18565aa Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:53:53 -0500 Subject: [PATCH 06/27] chore(natural-language-understanding-v1): manual changes --- .../v1/NaturalLanguageUnderstanding.java | 2 +- .../v1/model/ListModelsOptions.java | 39 ++++++++++++++++++- .../v1/model/MetadataOptions.java | 39 ++++++++++++++++++- 3 files changed, 77 insertions(+), 3 deletions(-) diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java index 3a85a2dc121..4f86908ba30 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java @@ -47,7 +47,7 @@ */ public class NaturalLanguageUnderstanding extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "natural-language-understanding"; + private static final String DEFAULT_SERVICE_NAME = "natural_language_understanding"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com"; diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java index 0b18313874c..44b5d71d861 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listModels options. */ -public class ListModelsOptions extends GenericModel {} +public class ListModelsOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListModelsOptions listModelsOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListModelsOptions. + * + * @return the listModelsOptions + */ + public ListModelsOptions build() { + return new ListModelsOptions(this); + } + } + + private ListModelsOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListModelsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java index 57f8c5cec74..4b0ea36b135 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java @@ -18,4 +18,41 @@ * Returns information from the document, including author name, title, RSS/ATOM feeds, prominent * page image, and publication date. Supports URL and HTML input types only. */ -public class MetadataOptions extends GenericModel {} +public class MetadataOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(MetadataOptions metadataOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MetadataOptions. + * + * @return the metadataOptions + */ + public MetadataOptions build() { + return new MetadataOptions(this); + } + } + + private MetadataOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a MetadataOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} From 2f04ed6f78be13a2c48911c065168d3b49092cfe Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:54:17 -0500 Subject: [PATCH 07/27] chore(speech-to-text-v1): manual changes --- .../speech_to_text/v1/SpeechToText.java | 68 ++++++++++-- .../v1/model/CheckJobsOptions.java | 39 ++++++- .../v1/model/ListModelsOptions.java | 39 ++++++- .../v1/model/RecognizeOptions.java | 104 +++++++++++++++++- .../model/SpeechRecognitionAlternative.java | 8 +- 5 files changed, 244 insertions(+), 14 deletions(-) diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index 60f98381955..2c3288d9bea 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -84,7 +84,10 @@ import com.ibm.watson.speech_to_text.v1.model.Words; import java.util.Map; import java.util.Map.Entry; -import okhttp3.MultipartBody; + +import com.ibm.watson.speech_to_text.v1.websocket.RecognizeCallback; +import com.ibm.watson.speech_to_text.v1.websocket.SpeechToTextWebSocketListener; +import okhttp3.*; /** * The IBM Watson™ Speech to Text service provides APIs that use IBM's speech-recognition @@ -414,6 +417,61 @@ public ServiceCall recognize(RecognizeOptions recogniz return createServiceCall(builder.build(), responseConverter); } + /** + * Sends audio and returns transcription results for recognition requests over a WebSocket + * connection. Requests and responses are enabled over a single TCP connection that abstracts much + * of the complexity of the request to offer efficient implementation, low latency, high + * throughput, and an asynchronous response. By default, only final results are returned for any + * request; to enable interim results, set the interimResults parameter to true. + * + *

The service imposes a data size limit of 100 MB per utterance (per recognition request). You + * can send multiple utterances over a single WebSocket connection. The service automatically + * detects the endianness of the incoming audio and, for audio that includes multiple channels, + * downmixes the audio to one-channel mono during transcoding. (For the audio/l16 format, you can + * specify the endianness.) + * + * @param recognizeOptions the recognize options + * @param callback the {@link RecognizeCallback} instance where results will be sent + * @return the {@link WebSocket} + */ + public WebSocket recognizeUsingWebSocket( + RecognizeOptions recognizeOptions, RecognizeCallback callback) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + recognizeOptions, "recognizeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(recognizeOptions.audio(), "audio cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); + + HttpUrl.Builder urlBuilder = HttpUrl.parse(getServiceUrl() + "/v1/recognize").newBuilder(); + + if (recognizeOptions.model() != null) { + urlBuilder.addQueryParameter("model", recognizeOptions.model()); + } + if (recognizeOptions.customizationId() != null) { + urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId()); + } + if (recognizeOptions.languageCustomizationId() != null) { + urlBuilder.addQueryParameter( + "language_customization_id", recognizeOptions.languageCustomizationId()); + } + if (recognizeOptions.acousticCustomizationId() != null) { + urlBuilder.addQueryParameter( + "acoustic_customization_id", recognizeOptions.acousticCustomizationId()); + } + if (recognizeOptions.baseModelVersion() != null) { + urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion()); + } + + String url = urlBuilder.toString().replace("https://", "wss://"); + Request.Builder builder = new Request.Builder().url(url); + + setAuthentication(builder); + setDefaultHeaders(builder); + + OkHttpClient client = configureHttpClient(); + return client.newWebSocket( + builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback)); + } + /** * Register a callback. * @@ -1246,12 +1304,8 @@ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { if (addCorpusOptions.allowOverwrite() != null) { builder.query("allow_overwrite", String.valueOf(addCorpusOptions.allowOverwrite())); } - MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); - multipartBuilder.setType(MultipartBody.FORM); - okhttp3.RequestBody corpusFileBody = - RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain"); - multipartBuilder.addFormDataPart("corpus_file", "filename", corpusFileBody); - builder.body(multipartBuilder.build()); + builder.body(RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain")); + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java index b5cc8c58088..737e81d0659 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The checkJobs options. */ -public class CheckJobsOptions extends GenericModel {} +public class CheckJobsOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(CheckJobsOptions checkJobsOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CheckJobsOptions. + * + * @return the checkJobsOptions + */ + public CheckJobsOptions build() { + return new CheckJobsOptions(this); + } + } + + private CheckJobsOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a CheckJobsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java index 386903130ba..96c9cdeb37f 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listModels options. */ -public class ListModelsOptions extends GenericModel {} +public class ListModelsOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListModelsOptions listModelsOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListModelsOptions. + * + * @return the listModelsOptions + */ + public ListModelsOptions build() { + return new ListModelsOptions(this); + } + } + + private ListModelsOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListModelsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java index 141d9727e61..6896f804f5b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.speech_to_text.v1.model; +import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; import java.io.File; import java.io.FileInputStream; @@ -102,7 +103,9 @@ public interface Model { String ZH_CN_NARROWBANDMODEL = "zh-CN_NarrowbandModel"; } - protected InputStream audio; + protected transient InputStream audio; + @SerializedName("content-type") + protected String contentType; protected String model; protected String languageCustomizationId; @@ -127,6 +130,9 @@ public interface Model { protected Boolean splitTranscriptAtPhraseEnd; protected Float speechDetectorSensitivity; protected Float backgroundAudioSuppression; + private Boolean interimResults; + private Boolean processingMetrics; + private Float processingMetricsInterval; /** Builder. */ public static class Builder { @@ -155,6 +161,9 @@ public static class Builder { private Boolean splitTranscriptAtPhraseEnd; private Float speechDetectorSensitivity; private Float backgroundAudioSuppression; + private Boolean interimResults; + private Boolean processingMetrics; + private Float processingMetricsInterval; private Builder(RecognizeOptions recognizeOptions) { this.audio = recognizeOptions.audio; @@ -182,6 +191,9 @@ private Builder(RecognizeOptions recognizeOptions) { this.splitTranscriptAtPhraseEnd = recognizeOptions.splitTranscriptAtPhraseEnd; this.speechDetectorSensitivity = recognizeOptions.speechDetectorSensitivity; this.backgroundAudioSuppression = recognizeOptions.backgroundAudioSuppression; + this.interimResults = recognizeOptions.interimResults; + this.processingMetrics = recognizeOptions.processingMetrics; + this.processingMetricsInterval = recognizeOptions.processingMetricsInterval; } /** Instantiates a new builder. */ @@ -220,6 +232,96 @@ public Builder addKeyword(String keyword) { return this; } + /** + * Gets the interimResults. + * + * If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` objects. By default, + * the service returns a single `SpeechRecognitionResults` object with final results only. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @return the interimResults + */ + public Boolean interimResults() { + return interimResults; + } + + /** + * Gets the processingMetrics. + * + * If `true`, requests processing metrics about the service's transcription of the input audio. The service returns + * processing metrics at the interval specified by the `processing_metrics_interval` parameter. It also returns + * processing metrics for transcription events, for example, for final and interim results. By default, the service + * returns no processing metrics. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @return the processingMetrics + */ + public Boolean processingMetrics() { + return processingMetrics; + } + + /** + * Gets the processingMetricsInterval. + * + * Specifies the interval in real wall-clock seconds at which the service is to return processing metrics. The + * parameter is ignored unless the `processing_metrics` parameter is set to `true`. + * + * The parameter accepts a minimum value of 0.1 seconds. The level of precision is not restricted, so you can + * specify values such as 0.25 and 0.125. + * + * The service does not impose a maximum value. If you want to receive processing metrics only for transcription + * events instead of at periodic intervals, set the value to a large number. If the value is larger than the + * duration of the audio, the service returns processing metrics only for transcription events. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @return the processingMetricsInterval + */ + public Float processingMetricsInterval() { + return processingMetricsInterval; + } + + /** + * Set the interimResults. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @param interimResults the interimResults + * @return the interimResults + */ + public Builder interimResults(Boolean interimResults) { + this.interimResults = interimResults; + return this; + } + + /** + * Set the processingMetrics. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @param processingMetrics the processingMetrics + * @return the processingMetrics + */ + public Builder processingMetrics(Boolean processingMetrics) { + this.processingMetrics = processingMetrics; + return this; + } + + /** + * Set the processingMetricsInterval. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @param processingMetricsInterval the processingMetricsInterval + * @return the processingMetricsInterval + */ + public Builder processingMetricsInterval(Float processingMetricsInterval) { + this.processingMetricsInterval = processingMetricsInterval; + return this; + } + /** * Set the audio. * diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java index 5ee36370d52..39e94945bbd 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java @@ -21,10 +21,10 @@ public class SpeechRecognitionAlternative extends GenericModel { protected String transcript; protected Double confidence; - protected List timestamps; + protected List timestamps; @SerializedName("word_confidence") - protected List wordConfidence; + protected List wordConfidence; /** * Gets the transcript. @@ -60,7 +60,7 @@ public Double getConfidence() { * * @return the timestamps */ - public List getTimestamps() { + public List getTimestamps() { return timestamps; } @@ -74,7 +74,7 @@ public List getTimestamps() { * * @return the wordConfidence */ - public List getWordConfidence() { + public List getWordConfidence() { return wordConfidence; } } From 0c36249ab0564fe6a28a3d82ea88e162e74a6ccc Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:54:51 -0500 Subject: [PATCH 08/27] chore(text-to-speech-v1): manual changes --- .../text_to_speech/v1/TextToSpeech.java | 54 +++++++++++++++++++ .../v1/model/ListVoicesOptions.java | 39 +++++++++++++- .../v1/model/SynthesizeOptions.java | 34 ++++++++++++ 3 files changed, 126 insertions(+), 1 deletion(-) diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index 33601247dac..05df33b5a3d 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -43,6 +43,13 @@ import com.ibm.watson.text_to_speech.v1.model.VoiceModels; import com.ibm.watson.text_to_speech.v1.model.Voices; import com.ibm.watson.text_to_speech.v1.model.Words; +import com.ibm.watson.text_to_speech.v1.websocket.SynthesizeCallback; +import com.ibm.watson.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.WebSocket; + import java.io.InputStream; import java.util.Map; import java.util.Map.Entry; @@ -284,6 +291,53 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) return createServiceCall(builder.build(), responseConverter); } + /** + * Synthesize audio. + * + *

Synthesizes text to audio that is spoken in the specified voice. The service bases its + * understanding of the language for the input text on the specified voice. Use a voice that + * matches the language of the input text. + * + *

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for + * the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service + * returns the synthesized audio stream as an array of bytes. + * + *

### Audio formats (accept types) + * + *

For more information about specifying an audio format, including additional details about + * some of the formats, see [Audio + * formats](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-audioFormats#audioFormats). + * + * @param synthesizeOptions the {@link SynthesizeOptions} containing the options for the call + * @param callback the {@link SynthesizeCallback} callback + * @return a {@link WebSocket} instance + */ + public WebSocket synthesizeUsingWebSocket( + SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + synthesizeOptions, "synthesizeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); + + HttpUrl.Builder urlBuilder = HttpUrl.parse(getServiceUrl() + "/v1/synthesize").newBuilder(); + + if (synthesizeOptions.voice() != null) { + urlBuilder.addQueryParameter("voice", synthesizeOptions.voice()); + } + if (synthesizeOptions.customizationId() != null) { + urlBuilder.addQueryParameter("customization_id", synthesizeOptions.customizationId()); + } + + String url = urlBuilder.toString().replace("https://", "wss://"); + Request.Builder builder = new Request.Builder().url(url); + + setAuthentication(builder); + setDefaultHeaders(builder); + + OkHttpClient client = configureHttpClient(); + return client.newWebSocket( + builder.build(), new TextToSpeechWebSocketListener(synthesizeOptions, callback)); + } + /** * Get pronunciation. * diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java index d9a7628c706..402a859b4ad 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listVoices options. */ -public class ListVoicesOptions extends GenericModel {} +public class ListVoicesOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListVoicesOptions listVoicesOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListVoicesOptions. + * + * @return the listVoicesOptions + */ + public ListVoicesOptions build() { + return new ListVoicesOptions(this); + } + } + + private ListVoicesOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListVoicesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java index 9b7c15f1512..f4b21cba43f 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java @@ -14,6 +14,8 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + /** The synthesize options. */ public class SynthesizeOptions extends GenericModel { @@ -113,6 +115,7 @@ public interface Voice { protected String accept; protected String voice; protected String customizationId; + protected List timings; /** Builder. */ public static class Builder { @@ -120,12 +123,14 @@ public static class Builder { private String accept; private String voice; private String customizationId; + protected List timings; private Builder(SynthesizeOptions synthesizeOptions) { this.text = synthesizeOptions.text; this.accept = synthesizeOptions.accept; this.voice = synthesizeOptions.voice; this.customizationId = synthesizeOptions.customizationId; + this.timings = synthesizeOptions.timings; } /** Instantiates a new builder. */ @@ -192,6 +197,17 @@ public Builder customizationId(String customizationId) { this.customizationId = customizationId; return this; } + + /** + * Set the timings. + * + * @param timings the timings + * @return the SynthesizeOptions builder + */ + public Builder timings(List timings) { + this.timings = timings; + return this; + } } protected SynthesizeOptions(Builder builder) { @@ -200,6 +216,7 @@ protected SynthesizeOptions(Builder builder) { accept = builder.accept; voice = builder.voice; customizationId = builder.customizationId; + timings = builder.timings; } /** @@ -259,4 +276,21 @@ public String voice() { public String customizationId() { return customizationId; } + + /** + * Gets the timings. + * + *

An array that specifies whether the service is to return word timing information for all + * strings of the input text. Specify `words` as the element of the array to request word timing + * information. The service returns the start and end time of each word of the input. Specify an + * empty array or omit the parameter to receive no word timing information. Not supported for + * Japanese input text. + * + *

NOTE: This parameter only works for the `synthesizeUsingWebSocket` method. + * + * @return the timings + */ + public List getTimings() { + return timings; + } } From 378d4c01cfa223ec65b7398e2685c9a0aadb4e45 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:55:29 -0500 Subject: [PATCH 09/27] chore(visual-recognition-v3): manual changes --- .../v3/VisualRecognition.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java index cdf493ed924..f56b47852bb 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java @@ -47,7 +47,7 @@ */ public class VisualRecognition extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "watson_vision_combined"; + private static final String DEFAULT_SERVICE_NAME = "visual_recognition"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"; @@ -154,14 +154,10 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { multipartBuilder.addFormDataPart("threshold", String.valueOf(classifyOptions.threshold())); } if (classifyOptions.owners() != null) { - for (String item : classifyOptions.owners()) { - multipartBuilder.addFormDataPart("owners", item); - } + multipartBuilder.addFormDataPart("owners", RequestUtils.join(classifyOptions.owners(), ",")); } if (classifyOptions.classifierIds() != null) { - for (String item : classifyOptions.classifierIds()) { - multipartBuilder.addFormDataPart("classifier_ids", item); - } + multipartBuilder.addFormDataPart("classifier_ids", RequestUtils.join(classifyOptions.classifierIds(), ",")); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = @@ -224,16 +220,17 @@ public ServiceCall createClassifier(CreateClassifierOptions createCl String partName = String.format("%s_positive_examples", entry.getKey()); okhttp3.RequestBody part = RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); - multipartBuilder.addFormDataPart(partName, entry.getKey(), part); + multipartBuilder.addFormDataPart(partName, entry.getKey() + ".zip", part); } if (createClassifierOptions.negativeExamples() != null) { okhttp3.RequestBody negativeExamplesBody = RequestUtils.inputStreamBody( createClassifierOptions.negativeExamples(), "application/octet-stream"); - multipartBuilder.addFormDataPart( - "negative_examples", - createClassifierOptions.negativeExamplesFilename(), - negativeExamplesBody); + String negativeExamplesFilename = createClassifierOptions.negativeExamplesFilename(); + if (!negativeExamplesFilename.contains(".")) { + negativeExamplesFilename += ".zip"; + } + multipartBuilder.addFormDataPart("negative_examples", negativeExamplesFilename, negativeExamplesBody); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = From 51251ade1655583341152ca355ca45714cd7a7ab Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 21 Aug 2020 13:55:53 -0500 Subject: [PATCH 10/27] chore(visual-recognition-v4): manual changes --- .../v4/VisualRecognition.java | 26 ++++++------- .../v4/model/ListCollectionsOptions.java | 39 ++++++++++++++++++- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java index 6e51cb6c7f4..165b10d4c89 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java @@ -70,7 +70,7 @@ */ public class VisualRecognition extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "watson_vision_combined"; + private static final String DEFAULT_SERVICE_NAME = "visual_recognition"; private static final String DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"; @@ -157,12 +157,8 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { builder.header("Accept", "application/json"); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - for (String item : analyzeOptions.collectionIds()) { - multipartBuilder.addFormDataPart("collection_ids", item); - } - for (String item : analyzeOptions.features()) { - multipartBuilder.addFormDataPart("features", item); - } + multipartBuilder.addFormDataPart("collection_ids", RequestUtils.join(analyzeOptions.collectionIds(), ",")); + multipartBuilder.addFormDataPart("features", RequestUtils.join(analyzeOptions.features(), ",")); if (analyzeOptions.imagesFile() != null) { for (FileWithMetadata item : analyzeOptions.imagesFile()) { okhttp3.RequestBody itemBody = @@ -201,8 +197,6 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { * @return a {@link ServiceCall} with a response type of {@link Collection} */ public ServiceCall createCollection(CreateCollectionOptions createCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createCollectionOptions, "createCollectionOptions cannot be null"); String[] pathSegments = {"v4/collections"}; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); @@ -214,13 +208,15 @@ public ServiceCall createCollection(CreateCollectionOptions createCo } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - if (createCollectionOptions.name() != null) { - contentJson.addProperty("name", createCollectionOptions.name()); - } - if (createCollectionOptions.description() != null) { - contentJson.addProperty("description", createCollectionOptions.description()); + if (createCollectionOptions != null) { + if (createCollectionOptions.name() != null) { + contentJson.addProperty("name", createCollectionOptions.name()); + } + if (createCollectionOptions.description() != null) { + contentJson.addProperty("description", createCollectionOptions.description()); + } } - builder.bodyJson(contentJson); + builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() {}.getType()); diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java index 5026a11d24f..caa90ee9f69 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listCollections options. */ -public class ListCollectionsOptions extends GenericModel {} +public class ListCollectionsOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListCollectionsOptions listCollectionsOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListCollectionsOptions. + * + * @return the listCollectionsOptions + */ + public ListCollectionsOptions build() { + return new ListCollectionsOptions(this); + } + } + + private ListCollectionsOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListCollectionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} From bf98effdff2629c56916a04864949a940a60642f Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Thu, 24 Sep 2020 14:04:38 -0500 Subject: [PATCH 11/27] chore(copyright dates): ran lint-copyright-dates --- .../src/main/java/com/ibm/watson/assistant/v1/Assistant.java | 2 +- .../src/main/java/com/ibm/watson/assistant/v2/Assistant.java | 2 +- .../com/ibm/watson/assistant/v2/model/MessageContextSkill.java | 2 +- .../com/ibm/watson/discovery/v1/model/CredentialDetails.java | 2 +- .../src/main/java/com/ibm/watson/discovery/v2/Discovery.java | 2 +- .../java/com/ibm/watson/discovery/v2/model/QueryResponse.java | 2 +- .../language_translator/v3/model/ListDocumentsOptions.java | 2 +- .../v3/model/ListIdentifiableLanguagesOptions.java | 2 +- .../v1/model/ListClassifiersOptions.java | 2 +- .../v1/NaturalLanguageUnderstanding.java | 2 +- .../v1/model/CategoriesOptions.java | 2 +- .../v1/model/ListModelsOptions.java | 2 +- .../v1/model/MetadataOptions.java | 2 +- .../java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | 2 +- .../ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java | 2 +- .../ibm/watson/speech_to_text/v1/model/ListModelsOptions.java | 2 +- .../ibm/watson/speech_to_text/v1/model/RecognizeOptions.java | 2 +- .../speech_to_text/v1/model/SpeechRecognitionAlternative.java | 2 +- .../java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java | 2 +- .../ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java | 2 +- .../ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java | 2 +- .../com/ibm/watson/visual_recognition/v3/VisualRecognition.java | 2 +- .../com/ibm/watson/visual_recognition/v4/VisualRecognition.java | 2 +- .../visual_recognition/v4/model/ListCollectionsOptions.java | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java index ced1da6a2a1..415c3aa3325 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java index 68a567a7960..e4e817609e5 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java index 66516baef05..171e085c44d 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java index 7d382c76295..6046a88c2dc 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java index a3d8886a0ce..74cb57b2974 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java index 038f8dce427..d31ed6b8ac9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java index ca48b4f1ae2..f20cc712a4e 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java index 7109ade79af..bfca095adfc 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2017, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java index 68ca0d5f30d..d0e0bf73830 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java index 4f86908ba30..95410e1b564 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java index d60e82ab479..dbb2b529007 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java index 44b5d71d861..7136fd4e8fc 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java index 4b0ea36b135..247d2b79095 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index 2c3288d9bea..0f837414a61 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2016, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java index 737e81d0659..29fdc74e156 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java index 96c9cdeb37f..a7ce25e5b3a 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java index 6896f804f5b..c844fc408d4 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2016, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java index 39e94945bbd..da4516574c9 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index 05df33b5a3d..f4ef644b3c6 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java index 402a859b4ad..863703cfedf 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java index f4b21cba43f..60b4efa1661 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java index f56b47852bb..aaa1fbdb618 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2016, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java index 165b10d4c89..5d545d1ede0 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java index caa90ee9f69..04b6429f732 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2020. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at From 7f19ef27fdb0d378ddcbaa8febd46036138e84c6 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Mon, 24 Aug 2020 17:13:40 -0500 Subject: [PATCH 12/27] chore(assistant-v2): post-gen manual change --- .../watson/assistant/v2/model/MessageContextSkill.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java index 171e085c44d..837fa864b2f 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java @@ -25,12 +25,13 @@ public class MessageContextSkill extends GenericModel { @SerializedName("user_defined") protected Map userDefined; - protected MessageContextSkillSystem system; + protected Map system; + /** Builder. */ public static class Builder { private Map userDefined; - private MessageContextSkillSystem system; + private Map system; private Builder(MessageContextSkill messageContextSkill) { this.userDefined = messageContextSkill.userDefined; @@ -66,7 +67,7 @@ public Builder userDefined(Map userDefined) { * @param system the system * @return the MessageContextSkill builder */ - public Builder system(MessageContextSkillSystem system) { + public Builder system(Map system) { this.system = system; return this; } @@ -104,7 +105,7 @@ public Map userDefined() { * * @return the system */ - public MessageContextSkillSystem system() { + public Map system() { return system; } } From d69fa805a51e1372f25dded631656d7615efaf73 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Tue, 25 Aug 2020 10:53:14 -0500 Subject: [PATCH 13/27] chore(discovery-v1): post-gen manual change --- .../ibm/watson/discovery/v1/model/CredentialDetails.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java index 6046a88c2dc..894ca91c0b4 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java @@ -39,7 +39,7 @@ public interface CredentialType { /** saml. */ String SAML = "saml"; /** username_password. */ - String USERNAME_PASSWORD = "username_password"; + String USERNAME_PASSWORD = "username_password"; // pragma: whitelist secret /** noauth. */ String NOAUTH = "noauth"; /** basic. */ @@ -141,7 +141,7 @@ private Builder(CredentialDetails credentialDetails) { this.publicKeyId = credentialDetails.publicKeyId; this.privateKey = credentialDetails.privateKey; this.passphrase = credentialDetails.passphrase; - this.password = credentialDetails.password; + this.password = credentialDetails.password; // pragma: whitelist secret this.gatewayId = credentialDetails.gatewayId; this.sourceVersion = credentialDetails.sourceVersion; this.webApplicationUrl = credentialDetails.webApplicationUrl; @@ -291,7 +291,7 @@ public Builder passphrase(String passphrase) { * @return the CredentialDetails builder */ public Builder password(String password) { - this.password = password; + this.password = password; // pragma: whitelist secret return this; } @@ -385,7 +385,7 @@ protected CredentialDetails(Builder builder) { publicKeyId = builder.publicKeyId; privateKey = builder.privateKey; passphrase = builder.passphrase; - password = builder.password; + password = builder.password; // pragma: whitelist secret gatewayId = builder.gatewayId; sourceVersion = builder.sourceVersion; webApplicationUrl = builder.webApplicationUrl; From 4693e586ffa015a97f9f1e8b360a60cf7eb6099f Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Tue, 25 Aug 2020 10:54:08 -0500 Subject: [PATCH 14/27] chore(language-translator-v3): post-gen manual change --- .../v3/model/ListLanguagesOptions.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java index 0ff8689f8bb..f2a88e4a91c 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java @@ -15,4 +15,41 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listLanguages options. */ -public class ListLanguagesOptions extends GenericModel {} +public class ListLanguagesOptions extends GenericModel { + + /** + * Builder. + */ + public static class Builder { + + private Builder(ListLanguagesOptions listDocumentsOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListDocumentsOptions. + * + * @return the listDocumentsOptions + */ + public ListLanguagesOptions build() { + return new ListLanguagesOptions(this); + } + } + + private ListLanguagesOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a ListDocumentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} From 06ff414947f2ba2c3b829048a2d297b987763ed5 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Tue, 25 Aug 2020 10:55:29 -0500 Subject: [PATCH 15/27] chore(natural-language-understanding-v1): post-gen manual change --- .../v1/model/CategoriesOptions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java index dbb2b529007..363a863d9f4 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java @@ -24,7 +24,7 @@ public class CategoriesOptions extends GenericModel { protected Boolean explanation; protected Long limit; - protected String model; + @Deprecated protected String model; /** Builder. */ public static class Builder { From 4153c6f545b889dd7beb3c1647575ba44ed166be Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Tue, 25 Aug 2020 10:56:13 -0500 Subject: [PATCH 16/27] chore(visual-recognition-v4): post-gen manual change --- .../ibm/watson/visual_recognition/v4/VisualRecognition.java | 2 ++ .../visual_recognition/v4/model/UpdateObjectMetadata.java | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java index 5d545d1ede0..77268d59cb1 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java @@ -197,6 +197,8 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { * @return a {@link ServiceCall} with a response type of {@link Collection} */ public ServiceCall createCollection(CreateCollectionOptions createCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + createCollectionOptions, "createCollectionOptions cannot be null"); String[] pathSegments = {"v4/collections"}; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java index d840ab66ddc..ef2ec2f19c5 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java @@ -37,9 +37,11 @@ public Builder() {} * Instantiates a new builder with required properties. * * @param object the object + * @param count the count */ - public Builder(String object) { + public Builder(String object, Long count) { this.object = object; + this.count = count; } /** @@ -76,6 +78,7 @@ public Builder count(long count) { protected UpdateObjectMetadata(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notNull(builder.object, "object cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.count, "count cannot be null"); object = builder.object; count = builder.count; } From 4f997aa84c440a0fff1825f576bfb2c921877c32 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Tue, 25 Aug 2020 11:26:02 -0500 Subject: [PATCH 17/27] chore(natural-language-understanding-v1): post-gen manual change --- .../v1/model/CategoriesOptions.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java index 363a863d9f4..19f75c08a0b 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java @@ -30,7 +30,7 @@ public class CategoriesOptions extends GenericModel { public static class Builder { private Boolean explanation; private Long limit; - private String model; + @Deprecated private String model; private Builder(CategoriesOptions categoriesOptions) { this.explanation = categoriesOptions.explanation; @@ -77,6 +77,8 @@ public Builder limit(long limit) { * * @param model the model * @return the CategoriesOptions builder + * @deprecated the model parameter is no longer supported by the Natural Language Understanding + * service and will be removed in the next major release */ public Builder model(String model) { this.model = model; @@ -135,6 +137,8 @@ public Long limit() { * categories models will no longer be accessible in Knowledge Studio on 17 December 2019. * * @return the model + * @deprecated the model parameter is no longer supported by the Natural Language Understanding + * service and will be removed in the next major release */ public String model() { return model; From 93e94790540c5ad2122f967bd5fa1b7fce1ae5d8 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Thu, 24 Sep 2020 14:08:55 -0500 Subject: [PATCH 18/27] chore(java-format-google): ran java_format_google.sh --- .../v2/model/MessageContextSkill.java | 1 - .../ibm/watson/discovery/v2/Discovery.java | 830 +++++++++++------- .../v3/model/ListDocumentsOptions.java | 17 +- .../ListIdentifiableLanguagesOptions.java | 17 +- .../v3/model/ListLanguagesOptions.java | 17 +- .../v1/model/ListClassifiersOptions.java | 17 +- .../v1/model/ListModelsOptions.java | 17 +- .../v1/model/MetadataOptions.java | 17 +- .../speech_to_text/v1/SpeechToText.java | 15 +- .../v1/model/CheckJobsOptions.java | 17 +- .../v1/model/ListModelsOptions.java | 17 +- .../v1/model/RecognizeOptions.java | 45 +- .../text_to_speech/v1/TextToSpeech.java | 13 +- .../v1/model/ListVoicesOptions.java | 17 +- .../v1/model/SynthesizeOptions.java | 1 - .../v3/VisualRecognition.java | 6 +- .../v4/VisualRecognition.java | 5 +- .../v4/model/ListCollectionsOptions.java | 17 +- 18 files changed, 605 insertions(+), 481 deletions(-) diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java index 837fa864b2f..bd0a7741b6b 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java @@ -27,7 +27,6 @@ public class MessageContextSkill extends GenericModel { protected Map system; - /** Builder. */ public static class Builder { private Map userDefined; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java index 74cb57b2974..ef5d5b8fd5d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java @@ -71,10 +71,10 @@ import okhttp3.MultipartBody; /** - * IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to - * identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and - * unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual - * filtering of results. + * IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add + * to applications to identify patterns, trends and actionable insights to drive better + * decision-making. Securely unify structured and unstructured data with pre-enriched content, and + * use a simplified query language to eliminate the need for manual filtering of results. * * @version v2 * @see Discovery @@ -83,26 +83,30 @@ public class Discovery extends BaseService { private static final String DEFAULT_SERVICE_NAME = "discovery"; - private static final String DEFAULT_SERVICE_URL = "https://api.us-south.discovery.watson.cloud.ibm.com"; + private static final String DEFAULT_SERVICE_URL = + "https://api.us-south.discovery.watson.cloud.ibm.com"; private String versionDate; -/** + /** * Constructs a new `Discovery` client using the DEFAULT_SERVICE_NAME. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value + * will keep your API calls from failing when the service introduces breaking changes. */ public Discovery(String versionDate) { - this(versionDate, DEFAULT_SERVICE_NAME, ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); + this( + versionDate, + DEFAULT_SERVICE_NAME, + ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); } /** - * Constructs a new `Discovery` client with the DEFAULT_SERVICE_NAME - * and the specified Authenticator. + * Constructs a new `Discovery` client with the DEFAULT_SERVICE_NAME and the specified + * Authenticator. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value + * will keep your API calls from failing when the service introduces breaking changes. * @param authenticator the Authenticator instance to be configured for this service */ public Discovery(String versionDate, Authenticator authenticator) { @@ -112,8 +116,8 @@ public Discovery(String versionDate, Authenticator authenticator) { /** * Constructs a new `Discovery` client with the specified serviceName. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value + * will keep your API calls from failing when the service introduces breaking changes. * @param serviceName The name of the service to configure. */ public Discovery(String versionDate, String serviceName) { @@ -121,18 +125,18 @@ public Discovery(String versionDate, String serviceName) { } /** - * Constructs a new `Discovery` client with the specified Authenticator - * and serviceName. + * Constructs a new `Discovery` client with the specified Authenticator and serviceName. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value + * will keep your API calls from failing when the service introduces breaking changes. * @param serviceName The name of the service to configure. * @param authenticator the Authenticator instance to be configured for this service */ public Discovery(String versionDate, String serviceName, Authenticator authenticator) { super(serviceName, authenticator); setServiceUrl(DEFAULT_SERVICE_URL); - com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue( + (versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); this.versionDate = versionDate; this.configureService(serviceName); } @@ -140,17 +144,21 @@ public Discovery(String versionDate, String serviceName, Authenticator authentic /** * List collections. * - * Lists existing collections for the specified project. + *

Lists existing collections for the specified project. * - * @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the call + * @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link ListCollectionsResponse} */ - public ServiceCall listCollections(ListCollectionsOptions listCollectionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listCollectionsOptions, - "listCollectionsOptions cannot be null"); - String[] pathSegments = { "v2/projects", "collections" }; - String[] pathParameters = { listCollectionsOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall listCollections( + ListCollectionsOptions listCollectionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + listCollectionsOptions, "listCollectionsOptions cannot be null"); + String[] pathSegments = {"v2/projects", "collections"}; + String[] pathParameters = {listCollectionsOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listCollections"); for (Entry header : sdkHeaders.entrySet()) { @@ -159,24 +167,29 @@ public ServiceCall listCollections(ListCollectionsOptio builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Create a collection. * - * Create a new collection in the specified project. + *

Create a new collection in the specified project. * - * @param createCollectionOptions the {@link CreateCollectionOptions} containing the options for the call + * @param createCollectionOptions the {@link CreateCollectionOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} */ - public ServiceCall createCollection(CreateCollectionOptions createCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createCollectionOptions, - "createCollectionOptions cannot be null"); - String[] pathSegments = { "v2/projects", "collections" }; - String[] pathParameters = { createCollectionOptions.projectId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall createCollection( + CreateCollectionOptions createCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + createCollectionOptions, "createCollectionOptions cannot be null"); + String[] pathSegments = {"v2/projects", "collections"}; + String[] pathParameters = {createCollectionOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -192,28 +205,37 @@ public ServiceCall createCollection(CreateCollectionOptions c contentJson.addProperty("language", createCollectionOptions.language()); } if (createCollectionOptions.enrichments() != null) { - contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createCollectionOptions.enrichments())); + contentJson.add( + "enrichments", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(createCollectionOptions.enrichments())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get collection. * - * Get details about the specified collection. + *

Get details about the specified collection. * - * @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the call + * @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} */ public ServiceCall getCollection(GetCollectionOptions getCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getCollectionOptions, - "getCollectionOptions cannot be null"); - String[] pathSegments = { "v2/projects", "collections" }; - String[] pathParameters = { getCollectionOptions.projectId(), getCollectionOptions.collectionId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + getCollectionOptions, "getCollectionOptions cannot be null"); + String[] pathSegments = {"v2/projects", "collections"}; + String[] pathParameters = { + getCollectionOptions.projectId(), getCollectionOptions.collectionId() + }; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -222,24 +244,31 @@ public ServiceCall getCollection(GetCollectionOptions getColl builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a collection. * - * Updates the specified collection's name, description, and enrichments. + *

Updates the specified collection's name, description, and enrichments. * - * @param updateCollectionOptions the {@link UpdateCollectionOptions} containing the options for the call + * @param updateCollectionOptions the {@link UpdateCollectionOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} */ - public ServiceCall updateCollection(UpdateCollectionOptions updateCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateCollectionOptions, - "updateCollectionOptions cannot be null"); - String[] pathSegments = { "v2/projects", "collections" }; - String[] pathParameters = { updateCollectionOptions.projectId(), updateCollectionOptions.collectionId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall updateCollection( + UpdateCollectionOptions updateCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + updateCollectionOptions, "updateCollectionOptions cannot be null"); + String[] pathSegments = {"v2/projects", "collections"}; + String[] pathParameters = { + updateCollectionOptions.projectId(), updateCollectionOptions.collectionId() + }; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -254,29 +283,38 @@ public ServiceCall updateCollection(UpdateCollectionOptions u contentJson.addProperty("description", updateCollectionOptions.description()); } if (updateCollectionOptions.enrichments() != null) { - contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateCollectionOptions.enrichments())); + contentJson.add( + "enrichments", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(updateCollectionOptions.enrichments())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete a collection. * - * Deletes the specified collection from the project. All documents stored in the specified collection and not shared - * is also deleted. + *

Deletes the specified collection from the project. All documents stored in the specified + * collection and not shared is also deleted. * - * @param deleteCollectionOptions the {@link DeleteCollectionOptions} containing the options for the call + * @param deleteCollectionOptions the {@link DeleteCollectionOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteCollection(DeleteCollectionOptions deleteCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCollectionOptions, - "deleteCollectionOptions cannot be null"); - String[] pathSegments = { "v2/projects", "collections" }; - String[] pathParameters = { deleteCollectionOptions.projectId(), deleteCollectionOptions.collectionId() }; - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + deleteCollectionOptions, "deleteCollectionOptions cannot be null"); + String[] pathSegments = {"v2/projects", "collections"}; + String[] pathParameters = { + deleteCollectionOptions.projectId(), deleteCollectionOptions.collectionId() + }; + RequestBuilder builder = + RequestBuilder.delete( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteCollection"); for (Entry header : sdkHeaders.entrySet()) { @@ -290,22 +328,23 @@ public ServiceCall deleteCollection(DeleteCollectionOptions deleteCollecti /** * Query a project. * - * By using this method, you can construct queries. For details, see the [Discovery - * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). The default query - * parameters are defined by the settings for this project, see the [Discovery - * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults) for an overview of - * the standard default settings, and see [the Projects API documentation](#create-project) for details about how to - * set custom default query settings. + *

By using this method, you can construct queries. For details, see the [Discovery + * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). + * The default query parameters are defined by the settings for this project, see the [Discovery + * documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults) + * for an overview of the standard default settings, and see [the Projects API + * documentation](#create-project) for details about how to set custom default query settings. * * @param queryOptions the {@link QueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link QueryResponse} */ public ServiceCall query(QueryOptions queryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, - "queryOptions cannot be null"); - String[] pathSegments = { "v2/projects", "query" }; - String[] pathParameters = { queryOptions.projectId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, "queryOptions cannot be null"); + String[] pathSegments = {"v2/projects", "query"}; + String[] pathParameters = {queryOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "query"); for (Entry header : sdkHeaders.entrySet()) { @@ -314,7 +353,10 @@ public ServiceCall query(QueryOptions queryOptions) { builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (queryOptions.collectionIds() != null) { - contentJson.add("collection_ids", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.collectionIds())); + contentJson.add( + "collection_ids", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(queryOptions.collectionIds())); } if (queryOptions.filter() != null) { contentJson.addProperty("filter", queryOptions.filter()); @@ -332,7 +374,9 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("count", queryOptions.count()); } if (queryOptions.xReturn() != null) { - contentJson.add("return", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.xReturn())); + contentJson.add( + "return", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.xReturn())); } if (queryOptions.offset() != null) { contentJson.addProperty("offset", queryOptions.offset()); @@ -347,43 +391,58 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("spelling_suggestions", queryOptions.spellingSuggestions()); } if (queryOptions.tableResults() != null) { - contentJson.add("table_results", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.tableResults())); + contentJson.add( + "table_results", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(queryOptions.tableResults())); } if (queryOptions.suggestedRefinements() != null) { - contentJson.add("suggested_refinements", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.suggestedRefinements())); + contentJson.add( + "suggested_refinements", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(queryOptions.suggestedRefinements())); } if (queryOptions.passages() != null) { - contentJson.add("passages", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.passages())); + contentJson.add( + "passages", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.passages())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get Autocomplete Suggestions. * - * Returns completion query suggestions for the specified prefix. + *

Returns completion query suggestions for the specified prefix. * - * @param getAutocompletionOptions the {@link GetAutocompletionOptions} containing the options for the call + * @param getAutocompletionOptions the {@link GetAutocompletionOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of {@link Completions} */ - public ServiceCall getAutocompletion(GetAutocompletionOptions getAutocompletionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getAutocompletionOptions, - "getAutocompletionOptions cannot be null"); - String[] pathSegments = { "v2/projects", "autocompletion" }; - String[] pathParameters = { getAutocompletionOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getAutocompletion( + GetAutocompletionOptions getAutocompletionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + getAutocompletionOptions, "getAutocompletionOptions cannot be null"); + String[] pathSegments = {"v2/projects", "autocompletion"}; + String[] pathParameters = {getAutocompletionOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getAutocompletion"); + Map sdkHeaders = + SdkCommon.getSdkHeaders("discovery", "v2", "getAutocompletion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); builder.query("prefix", getAutocompletionOptions.prefix()); if (getAutocompletionOptions.collectionIds() != null) { - builder.query("collection_ids", RequestUtils.join(getAutocompletionOptions.collectionIds(), ",")); + builder.query( + "collection_ids", RequestUtils.join(getAutocompletionOptions.collectionIds(), ",")); } if (getAutocompletionOptions.field() != null) { builder.query("field", getAutocompletionOptions.field()); @@ -392,25 +451,28 @@ public ServiceCall getAutocompletion(GetAutocompletionOptions getAu builder.query("count", String.valueOf(getAutocompletionOptions.count())); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Query system notices. * - * Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when - * ingesting documents and performing relevance training. + *

Queries for notices (errors or warnings) that might have been generated by the system. + * Notices are generated when ingesting documents and performing relevance training. * * @param queryNoticesOptions the {@link QueryNoticesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link QueryNoticesResponse} */ public ServiceCall queryNotices(QueryNoticesOptions queryNoticesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(queryNoticesOptions, - "queryNoticesOptions cannot be null"); - String[] pathSegments = { "v2/projects", "notices" }; - String[] pathParameters = { queryNoticesOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + queryNoticesOptions, "queryNoticesOptions cannot be null"); + String[] pathSegments = {"v2/projects", "notices"}; + String[] pathParameters = {queryNoticesOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "queryNotices"); for (Entry header : sdkHeaders.entrySet()) { @@ -433,24 +495,27 @@ public ServiceCall queryNotices(QueryNoticesOptions queryN builder.query("offset", String.valueOf(queryNoticesOptions.offset())); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List fields. * - * Gets a list of the unique fields (and their types) stored in the the specified collections. + *

Gets a list of the unique fields (and their types) stored in the the specified collections. * * @param listFieldsOptions the {@link ListFieldsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListFieldsResponse} */ public ServiceCall listFields(ListFieldsOptions listFieldsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listFieldsOptions, - "listFieldsOptions cannot be null"); - String[] pathSegments = { "v2/projects", "fields" }; - String[] pathParameters = { listFieldsOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + listFieldsOptions, "listFieldsOptions cannot be null"); + String[] pathSegments = {"v2/projects", "fields"}; + String[] pathParameters = {listFieldsOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listFields"); for (Entry header : sdkHeaders.entrySet()) { @@ -461,76 +526,90 @@ public ServiceCall listFields(ListFieldsOptions listFieldsOp builder.query("collection_ids", RequestUtils.join(listFieldsOptions.collectionIds(), ",")); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List component settings. * - * Returns default configuration settings for components. + *

Returns default configuration settings for components. * - * @param getComponentSettingsOptions the {@link GetComponentSettingsOptions} containing the options for the call + * @param getComponentSettingsOptions the {@link GetComponentSettingsOptions} containing the + * options for the call * @return a {@link ServiceCall} with a response type of {@link ComponentSettingsResponse} */ - public ServiceCall getComponentSettings(GetComponentSettingsOptions getComponentSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getComponentSettingsOptions, - "getComponentSettingsOptions cannot be null"); - String[] pathSegments = { "v2/projects", "component_settings" }; - String[] pathParameters = { getComponentSettingsOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getComponentSettings( + GetComponentSettingsOptions getComponentSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + getComponentSettingsOptions, "getComponentSettingsOptions cannot be null"); + String[] pathSegments = {"v2/projects", "component_settings"}; + String[] pathParameters = {getComponentSettingsOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getComponentSettings"); + Map sdkHeaders = + SdkCommon.getSdkHeaders("discovery", "v2", "getComponentSettings"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Add a document. * - * Add a document to a collection with optional metadata. + *

Add a document to a collection with optional metadata. * - * Returns immediately after the system has accepted the document for processing. + *

Returns immediately after the system has accepted the document for processing. * - * * The user must provide document content, metadata, or both. If the request is missing both document content and - * metadata, it is rejected. + *

* The user must provide document content, metadata, or both. If the request is missing both + * document content and metadata, it is rejected. * - * * The user can set the **Content-Type** parameter on the **file** part to indicate the media type of the - * document. If the **Content-Type** parameter is missing or is one of the generic media types (for example, - * `application/octet-stream`), then the service attempts to automatically detect the document's media type. + *

* The user can set the **Content-Type** parameter on the **file** part to indicate the media + * type of the document. If the **Content-Type** parameter is missing or is one of the generic + * media types (for example, `application/octet-stream`), then the service attempts to + * automatically detect the document's media type. * - * * The following field names are reserved and will be filtered out if present after normalization: `id`, `score`, - * `highlight`, and any field with the prefix of: `_`, `+`, or `-` + *

* The following field names are reserved and will be filtered out if present after + * normalization: `id`, `score`, `highlight`, and any field with the prefix of: `_`, `+`, or `-` * - * * Fields with empty name values after normalization are filtered out before indexing. + *

* Fields with empty name values after normalization are filtered out before indexing. * - * * Fields containing the following characters after normalization are filtered out before indexing: `#` and `,` + *

* Fields containing the following characters after normalization are filtered out before + * indexing: `#` and `,` * - * If the document is uploaded to a collection that has it's data shared with another collection, the - * **X-Watson-Discovery-Force** header must be set to `true`. + *

If the document is uploaded to a collection that has it's data shared with another + * collection, the **X-Watson-Discovery-Force** header must be set to `true`. * - * **Note:** Documents can be added with a specific **document_id** by using the + *

**Note:** Documents can be added with a specific **document_id** by using the * **_/v2/projects/{project_id}/collections/{collection_id}/documents** method. * - * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to - * modify a collection that connects to an external source such as Microsoft SharePoint. + *

**Note:** This operation only works on collections created to accept direct file uploads. It + * cannot be used to modify a collection that connects to an external source such as Microsoft + * SharePoint. * * @param addDocumentOptions the {@link AddDocumentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall addDocument(AddDocumentOptions addDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(addDocumentOptions, - "addDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue((addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), "At least one of file or metadata must be supplied."); - String[] pathSegments = { "v2/projects", "collections", "documents" }; - String[] pathParameters = { addDocumentOptions.projectId(), addDocumentOptions.collectionId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + addDocumentOptions, "addDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue( + (addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), + "At least one of file or metadata must be supplied."); + String[] pathSegments = {"v2/projects", "collections", "documents"}; + String[] pathParameters = {addDocumentOptions.projectId(), addDocumentOptions.collectionId()}; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "addDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -543,7 +622,9 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (addDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(addDocumentOptions.file(), addDocumentOptions.fileContentType()); + okhttp3.RequestBody fileBody = + RequestUtils.inputStreamBody( + addDocumentOptions.file(), addDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", addDocumentOptions.filename(), fileBody); } if (addDocumentOptions.metadata() != null) { @@ -551,38 +632,49 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a document. * - * Replace an existing document or add a document with a specified **document_id**. Starts ingesting a document with - * optional metadata. + *

Replace an existing document or add a document with a specified **document_id**. Starts + * ingesting a document with optional metadata. * - * If the document is uploaded to a collection that has it's data shared with another collection, the - * **X-Watson-Discovery-Force** header must be set to `true`. + *

If the document is uploaded to a collection that has it's data shared with another + * collection, the **X-Watson-Discovery-Force** header must be set to `true`. * - * **Note:** When uploading a new document with this method it automatically replaces any document stored with the - * same **document_id** if it exists. + *

**Note:** When uploading a new document with this method it automatically replaces any + * document stored with the same **document_id** if it exists. * - * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to - * modify a collection that connects to an external source such as Microsoft SharePoint. + *

**Note:** This operation only works on collections created to accept direct file uploads. It + * cannot be used to modify a collection that connects to an external source such as Microsoft + * SharePoint. * - * **Note:** If an uploaded document is segmented, all segments will be overwritten, even if the updated version of - * the document has fewer segments. + *

**Note:** If an uploaded document is segmented, all segments will be overwritten, even if + * the updated version of the document has fewer segments. * - * @param updateDocumentOptions the {@link UpdateDocumentOptions} containing the options for the call + * @param updateDocumentOptions the {@link UpdateDocumentOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall updateDocument(UpdateDocumentOptions updateDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateDocumentOptions, - "updateDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue((updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), "At least one of file or metadata must be supplied."); - String[] pathSegments = { "v2/projects", "collections", "documents" }; - String[] pathParameters = { updateDocumentOptions.projectId(), updateDocumentOptions.collectionId(), updateDocumentOptions.documentId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + updateDocumentOptions, "updateDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue( + (updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), + "At least one of file or metadata must be supplied."); + String[] pathSegments = {"v2/projects", "collections", "documents"}; + String[] pathParameters = { + updateDocumentOptions.projectId(), + updateDocumentOptions.collectionId(), + updateDocumentOptions.documentId() + }; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -595,7 +687,9 @@ public ServiceCall updateDocument(UpdateDocumentOptions update MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (updateDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); + okhttp3.RequestBody fileBody = + RequestUtils.inputStreamBody( + updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", updateDocumentOptions.filename(), fileBody); } if (updateDocumentOptions.metadata() != null) { @@ -603,31 +697,41 @@ public ServiceCall updateDocument(UpdateDocumentOptions update } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete a document. * - * If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP - * status code `200`) with the status set to 'deleted'. + *

If the given document ID is invalid, or if the document is not found, then the a success + * response is returned (HTTP status code `200`) with the status set to 'deleted'. * - * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to - * modify a collection that connects to an external source such as Microsoft SharePoint. + *

**Note:** This operation only works on collections created to accept direct file uploads. It + * cannot be used to modify a collection that connects to an external source such as Microsoft + * SharePoint. * - * **Note:** Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using - * the `parent_document_id` of a segment result. + *

**Note:** Segments of an uploaded document cannot be deleted individually. Delete all + * segments by deleting using the `parent_document_id` of a segment result. * - * @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the call + * @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link DeleteDocumentResponse} */ - public ServiceCall deleteDocument(DeleteDocumentOptions deleteDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteDocumentOptions, - "deleteDocumentOptions cannot be null"); - String[] pathSegments = { "v2/projects", "collections", "documents" }; - String[] pathParameters = { deleteDocumentOptions.projectId(), deleteDocumentOptions.collectionId(), deleteDocumentOptions.documentId() }; - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall deleteDocument( + DeleteDocumentOptions deleteDocumentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + deleteDocumentOptions, "deleteDocumentOptions cannot be null"); + String[] pathSegments = {"v2/projects", "collections", "documents"}; + String[] pathParameters = { + deleteDocumentOptions.projectId(), + deleteDocumentOptions.collectionId(), + deleteDocumentOptions.documentId() + }; + RequestBuilder builder = + RequestBuilder.delete( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -638,52 +742,64 @@ public ServiceCall deleteDocument(DeleteDocumentOptions builder.header("X-Watson-Discovery-Force", deleteDocumentOptions.xWatsonDiscoveryForce()); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List training queries. * - * List the training queries for the specified project. + *

List the training queries for the specified project. * - * @param listTrainingQueriesOptions the {@link ListTrainingQueriesOptions} containing the options for the call + * @param listTrainingQueriesOptions the {@link ListTrainingQueriesOptions} containing the options + * for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuerySet} */ - public ServiceCall listTrainingQueries(ListTrainingQueriesOptions listTrainingQueriesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listTrainingQueriesOptions, - "listTrainingQueriesOptions cannot be null"); - String[] pathSegments = { "v2/projects", "training_data/queries" }; - String[] pathParameters = { listTrainingQueriesOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall listTrainingQueries( + ListTrainingQueriesOptions listTrainingQueriesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + listTrainingQueriesOptions, "listTrainingQueriesOptions cannot be null"); + String[] pathSegments = {"v2/projects", "training_data/queries"}; + String[] pathParameters = {listTrainingQueriesOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listTrainingQueries"); + Map sdkHeaders = + SdkCommon.getSdkHeaders("discovery", "v2", "listTrainingQueries"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete training queries. * - * Removes all training queries for the specified project. + *

Removes all training queries for the specified project. * - * @param deleteTrainingQueriesOptions the {@link DeleteTrainingQueriesOptions} containing the options for the call + * @param deleteTrainingQueriesOptions the {@link DeleteTrainingQueriesOptions} containing the + * options for the call * @return a {@link ServiceCall} with a response type of Void */ - public ServiceCall deleteTrainingQueries(DeleteTrainingQueriesOptions deleteTrainingQueriesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteTrainingQueriesOptions, - "deleteTrainingQueriesOptions cannot be null"); - String[] pathSegments = { "v2/projects", "training_data/queries" }; - String[] pathParameters = { deleteTrainingQueriesOptions.projectId() }; - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall deleteTrainingQueries( + DeleteTrainingQueriesOptions deleteTrainingQueriesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + deleteTrainingQueriesOptions, "deleteTrainingQueriesOptions cannot be null"); + String[] pathSegments = {"v2/projects", "training_data/queries"}; + String[] pathParameters = {deleteTrainingQueriesOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.delete( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteTrainingQueries"); + Map sdkHeaders = + SdkCommon.getSdkHeaders("discovery", "v2", "deleteTrainingQueries"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -695,49 +811,66 @@ public ServiceCall deleteTrainingQueries(DeleteTrainingQueriesOptions dele /** * Create training query. * - * Add a query to the training data for this project. The query can contain a filter and natural language query. + *

Add a query to the training data for this project. The query can contain a filter and + * natural language query. * - * @param createTrainingQueryOptions the {@link CreateTrainingQueryOptions} containing the options for the call + * @param createTrainingQueryOptions the {@link CreateTrainingQueryOptions} containing the options + * for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall createTrainingQuery(CreateTrainingQueryOptions createTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createTrainingQueryOptions, - "createTrainingQueryOptions cannot be null"); - String[] pathSegments = { "v2/projects", "training_data/queries" }; - String[] pathParameters = { createTrainingQueryOptions.projectId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall createTrainingQuery( + CreateTrainingQueryOptions createTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + createTrainingQueryOptions, "createTrainingQueryOptions cannot be null"); + String[] pathSegments = {"v2/projects", "training_data/queries"}; + String[] pathParameters = {createTrainingQueryOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createTrainingQuery"); + Map sdkHeaders = + SdkCommon.getSdkHeaders("discovery", "v2", "createTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("natural_language_query", createTrainingQueryOptions.naturalLanguageQuery()); - contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createTrainingQueryOptions.examples())); + contentJson.addProperty( + "natural_language_query", createTrainingQueryOptions.naturalLanguageQuery()); + contentJson.add( + "examples", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(createTrainingQueryOptions.examples())); if (createTrainingQueryOptions.filter() != null) { contentJson.addProperty("filter", createTrainingQueryOptions.filter()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get a training data query. * - * Get details for a specific training data query, including the query string and all examples. + *

Get details for a specific training data query, including the query string and all examples. * - * @param getTrainingQueryOptions the {@link GetTrainingQueryOptions} containing the options for the call + * @param getTrainingQueryOptions the {@link GetTrainingQueryOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall getTrainingQuery(GetTrainingQueryOptions getTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getTrainingQueryOptions, - "getTrainingQueryOptions cannot be null"); - String[] pathSegments = { "v2/projects", "training_data/queries" }; - String[] pathParameters = { getTrainingQueryOptions.projectId(), getTrainingQueryOptions.queryId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getTrainingQuery( + GetTrainingQueryOptions getTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + getTrainingQueryOptions, "getTrainingQueryOptions cannot be null"); + String[] pathSegments = {"v2/projects", "training_data/queries"}; + String[] pathParameters = { + getTrainingQueryOptions.projectId(), getTrainingQueryOptions.queryId() + }; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { @@ -746,56 +879,72 @@ public ServiceCall getTrainingQuery(GetTrainingQueryOptions getTr builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a training query. * - * Updates an existing training query and it's examples. + *

Updates an existing training query and it's examples. * - * @param updateTrainingQueryOptions the {@link UpdateTrainingQueryOptions} containing the options for the call + * @param updateTrainingQueryOptions the {@link UpdateTrainingQueryOptions} containing the options + * for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall updateTrainingQuery(UpdateTrainingQueryOptions updateTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateTrainingQueryOptions, - "updateTrainingQueryOptions cannot be null"); - String[] pathSegments = { "v2/projects", "training_data/queries" }; - String[] pathParameters = { updateTrainingQueryOptions.projectId(), updateTrainingQueryOptions.queryId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall updateTrainingQuery( + UpdateTrainingQueryOptions updateTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + updateTrainingQueryOptions, "updateTrainingQueryOptions cannot be null"); + String[] pathSegments = {"v2/projects", "training_data/queries"}; + String[] pathParameters = { + updateTrainingQueryOptions.projectId(), updateTrainingQueryOptions.queryId() + }; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateTrainingQuery"); + Map sdkHeaders = + SdkCommon.getSdkHeaders("discovery", "v2", "updateTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("natural_language_query", updateTrainingQueryOptions.naturalLanguageQuery()); - contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateTrainingQueryOptions.examples())); + contentJson.addProperty( + "natural_language_query", updateTrainingQueryOptions.naturalLanguageQuery()); + contentJson.add( + "examples", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(updateTrainingQueryOptions.examples())); if (updateTrainingQueryOptions.filter() != null) { contentJson.addProperty("filter", updateTrainingQueryOptions.filter()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List Enrichments. * - * List the enrichments available to this project. + *

List the enrichments available to this project. * - * @param listEnrichmentsOptions the {@link ListEnrichmentsOptions} containing the options for the call + * @param listEnrichmentsOptions the {@link ListEnrichmentsOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link Enrichments} */ public ServiceCall listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listEnrichmentsOptions, - "listEnrichmentsOptions cannot be null"); - String[] pathSegments = { "v2/projects", "enrichments" }; - String[] pathParameters = { listEnrichmentsOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + listEnrichmentsOptions, "listEnrichmentsOptions cannot be null"); + String[] pathSegments = {"v2/projects", "enrichments"}; + String[] pathParameters = {listEnrichmentsOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listEnrichments"); for (Entry header : sdkHeaders.entrySet()) { @@ -804,24 +953,28 @@ public ServiceCall listEnrichments(ListEnrichmentsOptions listEnric builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Create an enrichment. * - * Create an enrichment for use with the specified project/. + *

Create an enrichment for use with the specified project/. * - * @param createEnrichmentOptions the {@link CreateEnrichmentOptions} containing the options for the call + * @param createEnrichmentOptions the {@link CreateEnrichmentOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of {@link Enrichment} */ public ServiceCall createEnrichment(CreateEnrichmentOptions createEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createEnrichmentOptions, - "createEnrichmentOptions cannot be null"); - String[] pathSegments = { "v2/projects", "enrichments" }; - String[] pathParameters = { createEnrichmentOptions.projectId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + createEnrichmentOptions, "createEnrichmentOptions cannot be null"); + String[] pathSegments = {"v2/projects", "enrichments"}; + String[] pathParameters = {createEnrichmentOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -832,29 +985,36 @@ public ServiceCall createEnrichment(CreateEnrichmentOptions createEn multipartBuilder.setType(MultipartBody.FORM); multipartBuilder.addFormDataPart("enrichment", createEnrichmentOptions.enrichment().toString()); if (createEnrichmentOptions.file() != null) { - okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(createEnrichmentOptions.file(), "application/octet-stream"); + okhttp3.RequestBody fileBody = + RequestUtils.inputStreamBody(createEnrichmentOptions.file(), "application/octet-stream"); multipartBuilder.addFormDataPart("file", "filename", fileBody); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get enrichment. * - * Get details about a specific enrichment. + *

Get details about a specific enrichment. * - * @param getEnrichmentOptions the {@link GetEnrichmentOptions} containing the options for the call + * @param getEnrichmentOptions the {@link GetEnrichmentOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link Enrichment} */ public ServiceCall getEnrichment(GetEnrichmentOptions getEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getEnrichmentOptions, - "getEnrichmentOptions cannot be null"); - String[] pathSegments = { "v2/projects", "enrichments" }; - String[] pathParameters = { getEnrichmentOptions.projectId(), getEnrichmentOptions.enrichmentId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + getEnrichmentOptions, "getEnrichmentOptions cannot be null"); + String[] pathSegments = {"v2/projects", "enrichments"}; + String[] pathParameters = { + getEnrichmentOptions.projectId(), getEnrichmentOptions.enrichmentId() + }; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -863,24 +1023,30 @@ public ServiceCall getEnrichment(GetEnrichmentOptions getEnrichmentO builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update an enrichment. * - * Updates an existing enrichment's name and description. + *

Updates an existing enrichment's name and description. * - * @param updateEnrichmentOptions the {@link UpdateEnrichmentOptions} containing the options for the call + * @param updateEnrichmentOptions the {@link UpdateEnrichmentOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of {@link Enrichment} */ public ServiceCall updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateEnrichmentOptions, - "updateEnrichmentOptions cannot be null"); - String[] pathSegments = { "v2/projects", "enrichments" }; - String[] pathParameters = { updateEnrichmentOptions.projectId(), updateEnrichmentOptions.enrichmentId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + updateEnrichmentOptions, "updateEnrichmentOptions cannot be null"); + String[] pathSegments = {"v2/projects", "enrichments"}; + String[] pathParameters = { + updateEnrichmentOptions.projectId(), updateEnrichmentOptions.enrichmentId() + }; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -894,26 +1060,32 @@ public ServiceCall updateEnrichment(UpdateEnrichmentOptions updateEn } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete an enrichment. * - * Deletes an existing enrichment from the specified project. + *

Deletes an existing enrichment from the specified project. * - * **Note:** Only enrichments that have been manually created can be deleted. + *

**Note:** Only enrichments that have been manually created can be deleted. * - * @param deleteEnrichmentOptions the {@link DeleteEnrichmentOptions} containing the options for the call + * @param deleteEnrichmentOptions the {@link DeleteEnrichmentOptions} containing the options for + * the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteEnrichmentOptions, - "deleteEnrichmentOptions cannot be null"); - String[] pathSegments = { "v2/projects", "enrichments" }; - String[] pathParameters = { deleteEnrichmentOptions.projectId(), deleteEnrichmentOptions.enrichmentId() }; - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + deleteEnrichmentOptions, "deleteEnrichmentOptions cannot be null"); + String[] pathSegments = {"v2/projects", "enrichments"}; + String[] pathParameters = { + deleteEnrichmentOptions.projectId(), deleteEnrichmentOptions.enrichmentId() + }; + RequestBuilder builder = + RequestBuilder.delete( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteEnrichment"); for (Entry header : sdkHeaders.entrySet()) { @@ -927,32 +1099,33 @@ public ServiceCall deleteEnrichment(DeleteEnrichmentOptions deleteEnrichme /** * List projects. * - * Lists existing projects for this instance. + *

Lists existing projects for this instance. * * @param listProjectsOptions the {@link ListProjectsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListProjectsResponse} */ public ServiceCall listProjects(ListProjectsOptions listProjectsOptions) { - String[] pathSegments = { "v2/projects" }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + String[] pathSegments = {"v2/projects"}; + RequestBuilder builder = + RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listProjects"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listProjectsOptions != null) { - - } + if (listProjectsOptions != null) {} + ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List projects. * - * Lists existing projects for this instance. + *

Lists existing projects for this instance. * * @return a {@link ServiceCall} with a response type of {@link ListProjectsResponse} */ @@ -963,16 +1136,18 @@ public ServiceCall listProjects() { /** * Create a Project. * - * Create a new project for this instance. + *

Create a new project for this instance. * - * @param createProjectOptions the {@link CreateProjectOptions} containing the options for the call + * @param createProjectOptions the {@link CreateProjectOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} */ public ServiceCall createProject(CreateProjectOptions createProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createProjectOptions, - "createProjectOptions cannot be null"); - String[] pathSegments = { "v2/projects" }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + createProjectOptions, "createProjectOptions cannot be null"); + String[] pathSegments = {"v2/projects"}; + RequestBuilder builder = + RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -983,28 +1158,34 @@ public ServiceCall createProject(CreateProjectOptions createProj contentJson.addProperty("name", createProjectOptions.name()); contentJson.addProperty("type", createProjectOptions.type()); if (createProjectOptions.defaultQueryParameters() != null) { - contentJson.add("default_query_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProjectOptions.defaultQueryParameters())); + contentJson.add( + "default_query_parameters", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(createProjectOptions.defaultQueryParameters())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get project. * - * Get details on the specified project. + *

Get details on the specified project. * * @param getProjectOptions the {@link GetProjectOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} */ public ServiceCall getProject(GetProjectOptions getProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getProjectOptions, - "getProjectOptions cannot be null"); - String[] pathSegments = { "v2/projects" }; - String[] pathParameters = { getProjectOptions.projectId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + getProjectOptions, "getProjectOptions cannot be null"); + String[] pathSegments = {"v2/projects"}; + String[] pathParameters = {getProjectOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -1013,24 +1194,28 @@ public ServiceCall getProject(GetProjectOptions getProjectOption builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a project. * - * Update the specified project's name. + *

Update the specified project's name. * - * @param updateProjectOptions the {@link UpdateProjectOptions} containing the options for the call + * @param updateProjectOptions the {@link UpdateProjectOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} */ public ServiceCall updateProject(UpdateProjectOptions updateProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateProjectOptions, - "updateProjectOptions cannot be null"); - String[] pathSegments = { "v2/projects" }; - String[] pathParameters = { updateProjectOptions.projectId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + updateProjectOptions, "updateProjectOptions cannot be null"); + String[] pathSegments = {"v2/projects"}; + String[] pathParameters = {updateProjectOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -1043,27 +1228,31 @@ public ServiceCall updateProject(UpdateProjectOptions updateProj } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete a project. * - * Deletes the specified project. + *

Deletes the specified project. * - * **Important:** Deleting a project deletes everything that is part of the specified project, including all - * collections. + *

**Important:** Deleting a project deletes everything that is part of the specified project, + * including all collections. * - * @param deleteProjectOptions the {@link DeleteProjectOptions} containing the options for the call + * @param deleteProjectOptions the {@link DeleteProjectOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteProject(DeleteProjectOptions deleteProjectOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProjectOptions, - "deleteProjectOptions cannot be null"); - String[] pathSegments = { "v2/projects" }; - String[] pathParameters = { deleteProjectOptions.projectId() }; - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + deleteProjectOptions, "deleteProjectOptions cannot be null"); + String[] pathSegments = {"v2/projects"}; + String[] pathParameters = {deleteProjectOptions.projectId()}; + RequestBuilder builder = + RequestBuilder.delete( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteProject"); for (Entry header : sdkHeaders.entrySet()) { @@ -1077,24 +1266,26 @@ public ServiceCall deleteProject(DeleteProjectOptions deleteProjectOptions /** * Delete labeled data. * - * Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with - * the customer ID. + *

Deletes all data associated with a specified customer ID. The method has no effect if no + * data is associated with the customer ID. * - * You associate a customer ID with data by passing the **X-Watson-Metadata** header with a request that passes data. - * For more information about personal data and customer IDs, see [Information + *

You associate a customer ID with data by passing the **X-Watson-Metadata** header with a + * request that passes data. For more information about personal data and customer IDs, see + * [Information * security](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-information-security#information-security). * + *

**Note:** This method is only supported on IBM Cloud instances of Discovery. * - * **Note:** This method is only supported on IBM Cloud instances of Discovery. - * - * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call + * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the + * call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, - "deleteUserDataOptions cannot be null"); - String[] pathSegments = { "v2/user_data" }; - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + com.ibm.cloud.sdk.core.util.Validator.notNull( + deleteUserDataOptions, "deleteUserDataOptions cannot be null"); + String[] pathSegments = {"v2/user_data"}; + RequestBuilder builder = + RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteUserData"); for (Entry header : sdkHeaders.entrySet()) { @@ -1104,5 +1295,4 @@ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOpti ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } - } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java index f20cc712a4e..72fbe09c02c 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java @@ -17,19 +17,13 @@ /** The listDocuments options. */ public class ListDocumentsOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListDocumentsOptions listDocumentsOptions) { - } + private Builder(ListDocumentsOptions listDocumentsOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListDocumentsOptions. @@ -41,8 +35,7 @@ public ListDocumentsOptions build() { } } - private ListDocumentsOptions(Builder builder) { - } + private ListDocumentsOptions(Builder builder) {} /** * New builder. diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java index bfca095adfc..c748206cc00 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java @@ -17,19 +17,13 @@ /** The listIdentifiableLanguages options. */ public class ListIdentifiableLanguagesOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListIdentifiableLanguagesOptions listIdentifiableLanguagesOptions) { - } + private Builder(ListIdentifiableLanguagesOptions listIdentifiableLanguagesOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListIdentifiableLanguagesOptions. @@ -41,8 +35,7 @@ public ListIdentifiableLanguagesOptions build() { } } - private ListIdentifiableLanguagesOptions(Builder builder) { - } + private ListIdentifiableLanguagesOptions(Builder builder) {} /** * New builder. diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java index f2a88e4a91c..51ae9393336 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java @@ -17,19 +17,13 @@ /** The listLanguages options. */ public class ListLanguagesOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListLanguagesOptions listDocumentsOptions) { - } + private Builder(ListLanguagesOptions listDocumentsOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListDocumentsOptions. @@ -41,8 +35,7 @@ public ListLanguagesOptions build() { } } - private ListLanguagesOptions(Builder builder) { - } + private ListLanguagesOptions(Builder builder) {} /** * New builder. diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java index d0e0bf73830..a24aed424d3 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java @@ -17,19 +17,13 @@ /** The listClassifiers options. */ public class ListClassifiersOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListClassifiersOptions listClassifiersOptions) { - } + private Builder(ListClassifiersOptions listClassifiersOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListClassifiersOptions. @@ -41,8 +35,7 @@ public ListClassifiersOptions build() { } } - private ListClassifiersOptions(Builder builder) { - } + private ListClassifiersOptions(Builder builder) {} /** * New builder. diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java index 7136fd4e8fc..ff111c2f348 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java @@ -17,19 +17,13 @@ /** The listModels options. */ public class ListModelsOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListModelsOptions listModelsOptions) { - } + private Builder(ListModelsOptions listModelsOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListModelsOptions. @@ -41,8 +35,7 @@ public ListModelsOptions build() { } } - private ListModelsOptions(Builder builder) { - } + private ListModelsOptions(Builder builder) {} /** * New builder. diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java index 247d2b79095..2895610936b 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java @@ -20,19 +20,13 @@ */ public class MetadataOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(MetadataOptions metadataOptions) { - } + private Builder(MetadataOptions metadataOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a MetadataOptions. @@ -44,8 +38,7 @@ public MetadataOptions build() { } } - private MetadataOptions(Builder builder) { - } + private MetadataOptions(Builder builder) {} /** * New builder. diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index 0f837414a61..9c8c9f52788 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -82,11 +82,10 @@ import com.ibm.watson.speech_to_text.v1.model.UpgradeLanguageModelOptions; import com.ibm.watson.speech_to_text.v1.model.Word; import com.ibm.watson.speech_to_text.v1.model.Words; -import java.util.Map; -import java.util.Map.Entry; - import com.ibm.watson.speech_to_text.v1.websocket.RecognizeCallback; import com.ibm.watson.speech_to_text.v1.websocket.SpeechToTextWebSocketListener; +import java.util.Map; +import java.util.Map.Entry; import okhttp3.*; /** @@ -435,9 +434,9 @@ public ServiceCall recognize(RecognizeOptions recogniz * @return the {@link WebSocket} */ public WebSocket recognizeUsingWebSocket( - RecognizeOptions recognizeOptions, RecognizeCallback callback) { + RecognizeOptions recognizeOptions, RecognizeCallback callback) { com.ibm.cloud.sdk.core.util.Validator.notNull( - recognizeOptions, "recognizeOptions cannot be null"); + recognizeOptions, "recognizeOptions cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(recognizeOptions.audio(), "audio cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); @@ -451,11 +450,11 @@ public WebSocket recognizeUsingWebSocket( } if (recognizeOptions.languageCustomizationId() != null) { urlBuilder.addQueryParameter( - "language_customization_id", recognizeOptions.languageCustomizationId()); + "language_customization_id", recognizeOptions.languageCustomizationId()); } if (recognizeOptions.acousticCustomizationId() != null) { urlBuilder.addQueryParameter( - "acoustic_customization_id", recognizeOptions.acousticCustomizationId()); + "acoustic_customization_id", recognizeOptions.acousticCustomizationId()); } if (recognizeOptions.baseModelVersion() != null) { urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion()); @@ -469,7 +468,7 @@ public WebSocket recognizeUsingWebSocket( OkHttpClient client = configureHttpClient(); return client.newWebSocket( - builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback)); + builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback)); } /** diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java index 29fdc74e156..98d61bce423 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java @@ -17,19 +17,13 @@ /** The checkJobs options. */ public class CheckJobsOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(CheckJobsOptions checkJobsOptions) { - } + private Builder(CheckJobsOptions checkJobsOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a CheckJobsOptions. @@ -41,8 +35,7 @@ public CheckJobsOptions build() { } } - private CheckJobsOptions(Builder builder) { - } + private CheckJobsOptions(Builder builder) {} /** * New builder. diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java index a7ce25e5b3a..bc8e43bf79d 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java @@ -17,19 +17,13 @@ /** The listModels options. */ public class ListModelsOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListModelsOptions listModelsOptions) { - } + private Builder(ListModelsOptions listModelsOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListModelsOptions. @@ -41,8 +35,7 @@ public ListModelsOptions build() { } } - private ListModelsOptions(Builder builder) { - } + private ListModelsOptions(Builder builder) {} /** * New builder. diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java index c844fc408d4..e152e74a8b3 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java @@ -104,9 +104,10 @@ public interface Model { } protected transient InputStream audio; - @SerializedName("content-type") + @SerializedName("content-type") protected String contentType; + protected String model; protected String languageCustomizationId; protected String acousticCustomizationId; @@ -235,10 +236,11 @@ public Builder addKeyword(String keyword) { /** * Gets the interimResults. * - * If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` objects. By default, - * the service returns a single `SpeechRecognitionResults` object with final results only. + *

If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` + * objects. By default, the service returns a single `SpeechRecognitionResults` object with + * final results only. * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. * * @return the interimResults */ @@ -249,12 +251,13 @@ public Boolean interimResults() { /** * Gets the processingMetrics. * - * If `true`, requests processing metrics about the service's transcription of the input audio. The service returns - * processing metrics at the interval specified by the `processing_metrics_interval` parameter. It also returns - * processing metrics for transcription events, for example, for final and interim results. By default, the service - * returns no processing metrics. + *

If `true`, requests processing metrics about the service's transcription of the input + * audio. The service returns processing metrics at the interval specified by the + * `processing_metrics_interval` parameter. It also returns processing metrics for transcription + * events, for example, for final and interim results. By default, the service returns no + * processing metrics. * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. * * @return the processingMetrics */ @@ -265,17 +268,19 @@ public Boolean processingMetrics() { /** * Gets the processingMetricsInterval. * - * Specifies the interval in real wall-clock seconds at which the service is to return processing metrics. The - * parameter is ignored unless the `processing_metrics` parameter is set to `true`. + *

Specifies the interval in real wall-clock seconds at which the service is to return + * processing metrics. The parameter is ignored unless the `processing_metrics` parameter is set + * to `true`. * - * The parameter accepts a minimum value of 0.1 seconds. The level of precision is not restricted, so you can - * specify values such as 0.25 and 0.125. + *

The parameter accepts a minimum value of 0.1 seconds. The level of precision is not + * restricted, so you can specify values such as 0.25 and 0.125. * - * The service does not impose a maximum value. If you want to receive processing metrics only for transcription - * events instead of at periodic intervals, set the value to a large number. If the value is larger than the - * duration of the audio, the service returns processing metrics only for transcription events. + *

The service does not impose a maximum value. If you want to receive processing metrics + * only for transcription events instead of at periodic intervals, set the value to a large + * number. If the value is larger than the duration of the audio, the service returns processing + * metrics only for transcription events. * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. * * @return the processingMetricsInterval */ @@ -286,7 +291,7 @@ public Float processingMetricsInterval() { /** * Set the interimResults. * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. * * @param interimResults the interimResults * @return the interimResults @@ -299,7 +304,7 @@ public Builder interimResults(Boolean interimResults) { /** * Set the processingMetrics. * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. * * @param processingMetrics the processingMetrics * @return the processingMetrics @@ -312,7 +317,7 @@ public Builder processingMetrics(Boolean processingMetrics) { /** * Set the processingMetricsInterval. * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. * * @param processingMetricsInterval the processingMetricsInterval * @return the processingMetricsInterval diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index f4ef644b3c6..5de00f1fd7e 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -45,15 +45,14 @@ import com.ibm.watson.text_to_speech.v1.model.Words; import com.ibm.watson.text_to_speech.v1.websocket.SynthesizeCallback; import com.ibm.watson.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; +import java.io.InputStream; +import java.util.Map; +import java.util.Map.Entry; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.WebSocket; -import java.io.InputStream; -import java.util.Map; -import java.util.Map.Entry; - /** * The IBM Watson™ Text to Speech service provides APIs that use IBM's speech-synthesis * capabilities to synthesize text into natural-sounding speech in a variety of languages, dialects, @@ -313,9 +312,9 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) * @return a {@link WebSocket} instance */ public WebSocket synthesizeUsingWebSocket( - SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { + SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { com.ibm.cloud.sdk.core.util.Validator.notNull( - synthesizeOptions, "synthesizeOptions cannot be null"); + synthesizeOptions, "synthesizeOptions cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); HttpUrl.Builder urlBuilder = HttpUrl.parse(getServiceUrl() + "/v1/synthesize").newBuilder(); @@ -335,7 +334,7 @@ public WebSocket synthesizeUsingWebSocket( OkHttpClient client = configureHttpClient(); return client.newWebSocket( - builder.build(), new TextToSpeechWebSocketListener(synthesizeOptions, callback)); + builder.build(), new TextToSpeechWebSocketListener(synthesizeOptions, callback)); } /** diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java index 863703cfedf..27518578077 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java @@ -17,19 +17,13 @@ /** The listVoices options. */ public class ListVoicesOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListVoicesOptions listVoicesOptions) { - } + private Builder(ListVoicesOptions listVoicesOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListVoicesOptions. @@ -41,8 +35,7 @@ public ListVoicesOptions build() { } } - private ListVoicesOptions(Builder builder) { - } + private ListVoicesOptions(Builder builder) {} /** * New builder. diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java index 60b4efa1661..2ab6e55da74 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; - import java.util.List; /** The synthesize options. */ diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java index aaa1fbdb618..1b1834969c7 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java @@ -157,7 +157,8 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { multipartBuilder.addFormDataPart("owners", RequestUtils.join(classifyOptions.owners(), ",")); } if (classifyOptions.classifierIds() != null) { - multipartBuilder.addFormDataPart("classifier_ids", RequestUtils.join(classifyOptions.classifierIds(), ",")); + multipartBuilder.addFormDataPart( + "classifier_ids", RequestUtils.join(classifyOptions.classifierIds(), ",")); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = @@ -230,7 +231,8 @@ public ServiceCall createClassifier(CreateClassifierOptions createCl if (!negativeExamplesFilename.contains(".")) { negativeExamplesFilename += ".zip"; } - multipartBuilder.addFormDataPart("negative_examples", negativeExamplesFilename, negativeExamplesBody); + multipartBuilder.addFormDataPart( + "negative_examples", negativeExamplesFilename, negativeExamplesBody); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java index 77268d59cb1..976a2063aa7 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java @@ -157,7 +157,8 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { builder.header("Accept", "application/json"); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - multipartBuilder.addFormDataPart("collection_ids", RequestUtils.join(analyzeOptions.collectionIds(), ",")); + multipartBuilder.addFormDataPart( + "collection_ids", RequestUtils.join(analyzeOptions.collectionIds(), ",")); multipartBuilder.addFormDataPart("features", RequestUtils.join(analyzeOptions.features(), ",")); if (analyzeOptions.imagesFile() != null) { for (FileWithMetadata item : analyzeOptions.imagesFile()) { @@ -218,7 +219,7 @@ public ServiceCall createCollection(CreateCollectionOptions createCo contentJson.addProperty("description", createCollectionOptions.description()); } } - builder.bodyJson(contentJson); + builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() {}.getType()); diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java index 04b6429f732..bd1c284500c 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java @@ -17,19 +17,13 @@ /** The listCollections options. */ public class ListCollectionsOptions extends GenericModel { - /** - * Builder. - */ + /** Builder. */ public static class Builder { - private Builder(ListCollectionsOptions listCollectionsOptions) { - } + private Builder(ListCollectionsOptions listCollectionsOptions) {} - /** - * Instantiates a new builder. - */ - public Builder() { - } + /** Instantiates a new builder. */ + public Builder() {} /** * Builds a ListCollectionsOptions. @@ -41,8 +35,7 @@ public ListCollectionsOptions build() { } } - private ListCollectionsOptions(Builder builder) { - } + private ListCollectionsOptions(Builder builder) {} /** * New builder. From 6457b78a12ce3b16bc6bd5cc6a399dd5a19e3800 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Thu, 24 Sep 2020 14:55:20 -0500 Subject: [PATCH 19/27] test(discovery-v2): add tests for PassagesPerDocument --- .../ibm/watson/discovery/v2/DiscoveryIT.java | 56 ++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java index 1279bf50e54..cf4d4052636 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java @@ -22,6 +22,7 @@ import com.ibm.cloud.sdk.core.http.Response; import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.BasicAuthenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.discovery.query.AggregationType; @@ -32,6 +33,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.List; import java.util.UUID; import org.junit.Assume; import org.junit.Before; @@ -40,13 +42,13 @@ import org.junit.runner.RunWith; /** The Class DiscoveryIT. */ -@Ignore @RunWith(RetryRunner.class) +@Ignore public class DiscoveryIT extends WatsonServiceTest { private static final String VERSION = "2019-11-22"; private static final String RESOURCE = "src/test/resources/discovery/v2/"; - private static final String PROJECT_ID = "9558dc01-8554-4d18-b0a5-70196f9f2fe6"; - private static final String COLLECTION_ID = "161d1e47-9651-e657-0000-016e8e939caf"; + private static final String PROJECT_ID = "571ec4f7-c413-4928-b7f9-3c69045ed27a"; + private static final String COLLECTION_ID = "d02b9aa7-903e-2ea1-0000-017410e684bd"; private Discovery service; @@ -64,12 +66,9 @@ public class DiscoveryIT extends WatsonServiceTest { @Before public void setUp() throws Exception { super.setUp(); - String bearerToken = getProperty("discovery_v2.bearer_token"); - Assume.assumeFalse("config.properties doesn't have valid credentials.", (bearerToken == null)); - // Authenticator authenticator = new BearerTokenAuthenticator(bearerToken); String apiKey = getProperty("discovery.apikey"); - Authenticator authenticator = new BasicAuthenticator("apikey", apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey, "https://iam.test.cloud.ibm.com/identity/token", null, null, false, null); service = new Discovery(VERSION, authenticator); service.setDefaultHeaders(getDefaultHeaders()); service.setServiceUrl(getProperty("discovery_v2.url")); @@ -1103,4 +1102,47 @@ public void testDeleteUserData() { assertNotNull(deleteResponse); assertTrue(deleteResponse.getStatusCode() == 204); } + + /** Test query passages per document true. */ + @Test + public void TestQueryPassagesPerDocumentTrue() { + ListIds = new ArrayList<>(); + Ids.add(COLLECTION_ID); + QueryLargePassages queryLargePassages = + new QueryLargePassages.Builder() + .perDocument(true).build(); + + QueryOptions queryOptions = + new QueryOptions.Builder() + .projectId(PROJECT_ID) + .collectionIds(Ids) + .passages(queryLargePassages) + .query("text:IBM") + .count(2).build(); + QueryResponse queryResult = service.query(queryOptions).execute().getResult(); + assertNotNull(queryResult.getResults().get(0).getDocumentPassages().get(0).getPassageText()); + } + + /** Test query passages per document false. */ + @Test + public void TestQueryPassagesPerDocumentFalse() { + ListIds = new ArrayList<>(); + Ids.add(COLLECTION_ID); + QueryLargePassages queryLargePassages = + new QueryLargePassages.Builder() + .perDocument(false).build(); + + QueryOptions queryOptions = + new QueryOptions.Builder() + .projectId(PROJECT_ID) + .collectionIds(Ids) + .passages(queryLargePassages) + .query("text:IBM") + .count(2).build(); + QueryResponse queryResult = service.query(queryOptions).execute().getResult(); + assertNotNull(queryResult); + assertNotNull(queryResult.getPassages().get(0).getCollectionId()); + assertNotNull(queryResult.getPassages().get(0).getPassageText()); + assertNotNull(queryResult.getPassages().get(0).getDocumentId()); + } } From 289a9e6f59fb143a6937e1fb341bf02116539f3a Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Thu, 24 Sep 2020 14:55:53 -0500 Subject: [PATCH 20/27] chore(java-format-google): ran java_format_google.sh --- .../ibm/watson/discovery/v2/DiscoveryIT.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java index cf4d4052636..9e83e198333 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryIT.java @@ -21,7 +21,6 @@ import com.ibm.cloud.sdk.core.http.HttpMediaType; import com.ibm.cloud.sdk.core.http.Response; import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.BasicAuthenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; @@ -35,7 +34,6 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import org.junit.Assume; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -68,7 +66,9 @@ public void setUp() throws Exception { super.setUp(); String apiKey = getProperty("discovery.apikey"); - Authenticator authenticator = new IamAuthenticator(apiKey, "https://iam.test.cloud.ibm.com/identity/token", null, null, false, null); + Authenticator authenticator = + new IamAuthenticator( + apiKey, "https://iam.test.cloud.ibm.com/identity/token", null, null, false, null); service = new Discovery(VERSION, authenticator); service.setDefaultHeaders(getDefaultHeaders()); service.setServiceUrl(getProperty("discovery_v2.url")); @@ -1106,11 +1106,10 @@ public void testDeleteUserData() { /** Test query passages per document true. */ @Test public void TestQueryPassagesPerDocumentTrue() { - ListIds = new ArrayList<>(); + List Ids = new ArrayList<>(); Ids.add(COLLECTION_ID); QueryLargePassages queryLargePassages = - new QueryLargePassages.Builder() - .perDocument(true).build(); + new QueryLargePassages.Builder().perDocument(true).build(); QueryOptions queryOptions = new QueryOptions.Builder() @@ -1118,7 +1117,8 @@ public void TestQueryPassagesPerDocumentTrue() { .collectionIds(Ids) .passages(queryLargePassages) .query("text:IBM") - .count(2).build(); + .count(2) + .build(); QueryResponse queryResult = service.query(queryOptions).execute().getResult(); assertNotNull(queryResult.getResults().get(0).getDocumentPassages().get(0).getPassageText()); } @@ -1126,19 +1126,19 @@ public void TestQueryPassagesPerDocumentTrue() { /** Test query passages per document false. */ @Test public void TestQueryPassagesPerDocumentFalse() { - ListIds = new ArrayList<>(); + List Ids = new ArrayList<>(); Ids.add(COLLECTION_ID); QueryLargePassages queryLargePassages = - new QueryLargePassages.Builder() - .perDocument(false).build(); + new QueryLargePassages.Builder().perDocument(false).build(); QueryOptions queryOptions = - new QueryOptions.Builder() - .projectId(PROJECT_ID) - .collectionIds(Ids) - .passages(queryLargePassages) - .query("text:IBM") - .count(2).build(); + new QueryOptions.Builder() + .projectId(PROJECT_ID) + .collectionIds(Ids) + .passages(queryLargePassages) + .query("text:IBM") + .count(2) + .build(); QueryResponse queryResult = service.query(queryOptions).execute().getResult(); assertNotNull(queryResult); assertNotNull(queryResult.getPassages().get(0).getCollectionId()); From bb87b55ee26a1ec2b5bf66e706823a716319bdd9 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 25 Sep 2020 16:30:50 -0500 Subject: [PATCH 21/27] test(disco-v1): update test badCredentialsThrowsException --- .../com/ibm/watson/discovery/v1/DiscoveryServiceIT.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index 90136b2d78d..79b816b7b7f 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -28,10 +28,7 @@ import com.ibm.cloud.sdk.core.security.BasicAuthenticator; import com.ibm.cloud.sdk.core.security.BearerTokenAuthenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; -import com.ibm.cloud.sdk.core.service.exception.BadRequestException; -import com.ibm.cloud.sdk.core.service.exception.ForbiddenException; -import com.ibm.cloud.sdk.core.service.exception.InternalServerErrorException; -import com.ibm.cloud.sdk.core.service.exception.NotFoundException; +import com.ibm.cloud.sdk.core.service.exception.*; import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WaitFor; @@ -354,7 +351,7 @@ public void pingIsSuccessful() { } /** Bad credentials throws exception. */ - @Test(expected = ForbiddenException.class) + @Test(expected = UnauthorizedException.class) public void badCredentialsThrowsException() { Discovery badService = new Discovery("2019-04-30", new BasicAuthenticator("foo", "bar")); badService.listEnvironments(null).execute().getResult(); From 5e60f1bbe21f076127dafaadf9858ae36ed8d4fd Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Fri, 25 Sep 2020 17:08:48 -0500 Subject: [PATCH 22/27] test(language-translator): update test testDocumentTranslation --- .../ibm/watson/language_translator/v3/LanguageTranslatorIT.java | 1 - 1 file changed, 1 deletion(-) diff --git a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java index 032ea3a24fa..c4a190f8f0f 100644 --- a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java +++ b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java @@ -230,7 +230,6 @@ public void testDocumentTranslation() throws FileNotFoundException, InterruptedE new TranslateDocumentOptions.Builder() .file(new File("src/test/resources/language_translation/document_to_translate.txt")) .fileContentType(HttpMediaType.TEXT_PLAIN) - .filename("java-integration-test-file") .source("en") .target("es") .build(); From ab1458bd09a14bf7acf3aee6d83ef7d44de7478a Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Sun, 27 Sep 2020 22:54:04 -0500 Subject: [PATCH 23/27] test(discovery-v1): update service url in IT tests --- .../java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index 79b816b7b7f..900b8d16b6a 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -143,7 +143,7 @@ public static void cleanupClass() throws Exception { public void setup() throws Exception { super.setUp(); String apiKey = getProperty("discovery.apikey"); - String url = getProperty("discovery.url"); + String url = "https://api.us-south.discovery.watson.cloud.ibm.com"; Authenticator authenticator = new IamAuthenticator(apiKey); discovery = new Discovery("2019-04-30", authenticator); discovery.setServiceUrl(url); From 21d51b2468da4a549065c4f692b25c79a8984634 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Mon, 28 Sep 2020 10:39:39 -0500 Subject: [PATCH 24/27] test(discovery-v1): increase timout on createCollection and output transaction id --- .../discovery/v1/DiscoveryServiceIT.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index 900b8d16b6a..3d1a78da541 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -24,6 +24,7 @@ import com.google.gson.internal.LazilyParsedNumber; import com.ibm.cloud.sdk.core.http.HttpConfigOptions; import com.ibm.cloud.sdk.core.http.HttpMediaType; +import com.ibm.cloud.sdk.core.http.Response; import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.BasicAuthenticator; import com.ibm.cloud.sdk.core.security.BearerTokenAuthenticator; @@ -37,6 +38,8 @@ import com.ibm.watson.discovery.query.Operator; import com.ibm.watson.discovery.v1.model.*; import com.ibm.watson.discovery.v1.model.NormalizationOperation.Operation; + +import java.awt.*; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -2134,7 +2137,21 @@ private Configuration createTestConfig() { } private Collection createCollection(CreateCollectionOptions createOptions) { - Collection createResponse = discovery.createCollection(createOptions).execute().getResult(); + + Collection createResponse = null; + try { + // In a successful case, you can grab the ID with the following code. + Response collectionResponse = discovery.createCollection(createOptions).execute(); + createResponse = collectionResponse.getResult(); + + String transactionId = collectionResponse.getHeaders().values("x-global-transaction-id").get(0); + System.out.println("x-global-transcation-id: "+transactionId); + } catch (ServiceResponseException e) { + // This is how you get the ID from a failed request. + // Make sure to use the ServiceResponseException class or one of its subclasses! + String transactionId = e.getHeaders().values("x-global-transaction-id").get(0); + System.out.println("x-global-transcation-id: "+transactionId); + } collectionIds.add(createResponse.getCollectionId()); return createResponse; } @@ -2179,7 +2196,7 @@ private DocumentAccepted createTestDocument(String json, String filename, String DocumentAccepted createResponse = discovery.addDocument(builder.build()).execute().getResult(); WaitFor.Condition documentAccepted = new WaitForDocumentAccepted(environmentId, collectionId, createResponse.getDocumentId()); - WaitFor.waitFor(documentAccepted, 5, TimeUnit.SECONDS, 500); + WaitFor.waitFor(documentAccepted, 10, TimeUnit.SECONDS, 500); return createResponse; } @@ -2205,7 +2222,7 @@ private synchronized String setupTestDocuments() { WaitFor.Condition collectionAvailable = new WaitForCollectionAvailable(environmentId, collectionId); - WaitFor.waitFor(collectionAvailable, 5, TimeUnit.SECONDS, 500); + WaitFor.waitFor(collectionAvailable, 10, TimeUnit.SECONDS, 500); return collectionId; } From 9e934caf91b87993db861cedcfc204227d8def5b Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Mon, 28 Sep 2020 11:39:41 -0500 Subject: [PATCH 25/27] test(discovery-v1): increate timeout for createDocument and print transaction id --- .../discovery/v1/DiscoveryServiceIT.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index 3d1a78da541..7bb267cbe8c 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -2222,7 +2222,7 @@ private synchronized String setupTestDocuments() { WaitFor.Condition collectionAvailable = new WaitForCollectionAvailable(environmentId, collectionId); - WaitFor.waitFor(collectionAvailable, 10, TimeUnit.SECONDS, 500); + WaitFor.waitFor(collectionAvailable, 1, TimeUnit.MINUTES, 500); return collectionId; } @@ -2316,9 +2316,20 @@ private class WaitForCollectionAvailable implements WaitFor.Condition { @Override public boolean isSatisfied() { - GetCollectionOptions getOptions = - new GetCollectionOptions.Builder(environmentId, collectionId).build(); - String status = discovery.getCollection(getOptions).execute().getResult().getStatus(); + String status = ""; + try { + // In a successful case, you can grab the ID with the following code. + GetCollectionOptions getOptions = + new GetCollectionOptions.Builder(environmentId, collectionId).build(); + Collection collectionResult = discovery.getCollection(getOptions).execute().getResult(); + status = collectionResult.getStatus(); + } catch (ServiceResponseException e) { + // This is how you get the ID from a failed request. + // Make sure to use the ServiceResponseException class or one of its subclasses! + String transactionId = e.getHeaders().values("x-global-transaction-id").get(0); + System.out.println("x-global-transcation-id: "+transactionId); + System.err.println("x-global-transcation-id: "+transactionId); + } return status.equals(Collection.Status.ACTIVE); } From 35267d9924084258bed343f60730e9f6415af1b5 Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Mon, 28 Sep 2020 15:01:26 -0500 Subject: [PATCH 26/27] test(discovery-v1): remove unnecesary changes --- .../discovery/v1/DiscoveryServiceIT.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index 7bb267cbe8c..82ce662b1b6 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -2222,7 +2222,7 @@ private synchronized String setupTestDocuments() { WaitFor.Condition collectionAvailable = new WaitForCollectionAvailable(environmentId, collectionId); - WaitFor.waitFor(collectionAvailable, 1, TimeUnit.MINUTES, 500); + WaitFor.waitFor(collectionAvailable, 10, TimeUnit.SECONDS, 500); return collectionId; } @@ -2316,20 +2316,10 @@ private class WaitForCollectionAvailable implements WaitFor.Condition { @Override public boolean isSatisfied() { - String status = ""; - try { - // In a successful case, you can grab the ID with the following code. - GetCollectionOptions getOptions = - new GetCollectionOptions.Builder(environmentId, collectionId).build(); - Collection collectionResult = discovery.getCollection(getOptions).execute().getResult(); - status = collectionResult.getStatus(); - } catch (ServiceResponseException e) { - // This is how you get the ID from a failed request. - // Make sure to use the ServiceResponseException class or one of its subclasses! - String transactionId = e.getHeaders().values("x-global-transaction-id").get(0); - System.out.println("x-global-transcation-id: "+transactionId); - System.err.println("x-global-transcation-id: "+transactionId); - } + GetCollectionOptions getOptions = + new GetCollectionOptions.Builder(environmentId, collectionId).build(); + Collection collectionResult = discovery.getCollection(getOptions).execute().getResult(); + String status = collectionResult.getStatus(); return status.equals(Collection.Status.ACTIVE); } From b66e5d40c76cf6fdd9e53c4e08060d4b70dfc3cf Mon Sep 17 00:00:00 2001 From: Kevin Kowalski Date: Mon, 28 Sep 2020 15:25:13 -0500 Subject: [PATCH 27/27] test(discovery-v1): revert previous changes --- .../discovery/v1/DiscoveryServiceIT.java | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index 82ce662b1b6..f86ab6f90df 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -146,7 +146,7 @@ public static void cleanupClass() throws Exception { public void setup() throws Exception { super.setUp(); String apiKey = getProperty("discovery.apikey"); - String url = "https://api.us-south.discovery.watson.cloud.ibm.com"; + String url = getProperty("discovery.url"); Authenticator authenticator = new IamAuthenticator(apiKey); discovery = new Discovery("2019-04-30", authenticator); discovery.setServiceUrl(url); @@ -2137,21 +2137,7 @@ private Configuration createTestConfig() { } private Collection createCollection(CreateCollectionOptions createOptions) { - - Collection createResponse = null; - try { - // In a successful case, you can grab the ID with the following code. - Response collectionResponse = discovery.createCollection(createOptions).execute(); - createResponse = collectionResponse.getResult(); - - String transactionId = collectionResponse.getHeaders().values("x-global-transaction-id").get(0); - System.out.println("x-global-transcation-id: "+transactionId); - } catch (ServiceResponseException e) { - // This is how you get the ID from a failed request. - // Make sure to use the ServiceResponseException class or one of its subclasses! - String transactionId = e.getHeaders().values("x-global-transaction-id").get(0); - System.out.println("x-global-transcation-id: "+transactionId); - } + Collection createResponse = discovery.createCollection(createOptions).execute().getResult(); collectionIds.add(createResponse.getCollectionId()); return createResponse; } @@ -2196,7 +2182,7 @@ private DocumentAccepted createTestDocument(String json, String filename, String DocumentAccepted createResponse = discovery.addDocument(builder.build()).execute().getResult(); WaitFor.Condition documentAccepted = new WaitForDocumentAccepted(environmentId, collectionId, createResponse.getDocumentId()); - WaitFor.waitFor(documentAccepted, 10, TimeUnit.SECONDS, 500); + WaitFor.waitFor(documentAccepted, 5, TimeUnit.SECONDS, 500); return createResponse; } @@ -2222,7 +2208,7 @@ private synchronized String setupTestDocuments() { WaitFor.Condition collectionAvailable = new WaitForCollectionAvailable(environmentId, collectionId); - WaitFor.waitFor(collectionAvailable, 10, TimeUnit.SECONDS, 500); + WaitFor.waitFor(collectionAvailable, 5, TimeUnit.SECONDS, 500); return collectionId; }