From d0439bb3305cd34174922b6f14986fd172c66410 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:34:29 -0500 Subject: [PATCH 01/26] fix(Assistant v1): Make InputData model dynamic --- .../assistant/v1/model/InputData.java | 82 ++++--------------- 1 file changed, 16 insertions(+), 66 deletions(-) diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java index f5e3252583b..62af2ea42f4 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java @@ -12,85 +12,35 @@ */ package com.ibm.watson.developer_cloud.assistant.v1.model; -import com.ibm.watson.developer_cloud.service.model.GenericModel; +import java.lang.reflect.Type; + +import com.google.gson.reflect.TypeToken; +import com.ibm.watson.developer_cloud.service.model.DynamicModel; +import com.ibm.watson.developer_cloud.util.GsonSerializationHelper; import com.ibm.watson.developer_cloud.util.Validator; /** * An input object that includes the input text. */ -public class InputData extends GenericModel { - - private String text; - - /** - * Builder. - */ - public static class Builder { - private String text; - - private Builder(InputData inputData) { - text = inputData.text; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - */ - public Builder(String text) { - this.text = text; - } - - /** - * Builds a InputData. - * - * @return the inputData - */ - public InputData build() { - return new InputData(this); - } - - /** - * Set the text. - * - * @param text the text - * @return the InputData builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - } - - private InputData(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); - text = builder.text; - } +public class InputData extends DynamicModel { + private Type textType = new TypeToken() { + }.getType(); /** - * New builder. + * Gets the text. * - * @return a InputData builder + * @return the text */ - public Builder newBuilder() { - return new Builder(this); + public String text() { + return GsonSerializationHelper.serializeDynamicModelProperty(this.get("text"), textType); } /** - * Gets the text. - * - * The text of the user input. This string cannot contain carriage return, newline, or tab characters, and it must be - * no longer than 2048 characters. + * Sets the text. * - * @return the text + * @param text the new text */ - public String text() { - return text; + public void setText(final String text) { + this.put("text", text); } } From 619708cd9de3266fcf300e5c1727f7062e0afd6a Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:35:02 -0500 Subject: [PATCH 02/26] fix(Assistant v1): Remove unnecessary dynamic status from MessageResponse model --- .../assistant/v1/model/MessageResponse.java | 60 +++++++++++-------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageResponse.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageResponse.java index c9721dd0cd8..ca381913e25 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageResponse.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageResponse.java @@ -12,92 +12,100 @@ */ package com.ibm.watson.developer_cloud.assistant.v1.model; -import java.lang.reflect.Type; import java.util.List; -import com.google.gson.reflect.TypeToken; -import com.ibm.watson.developer_cloud.service.model.DynamicModel; -import com.ibm.watson.developer_cloud.util.GsonSerializationHelper; +import com.google.gson.annotations.SerializedName; +import com.ibm.watson.developer_cloud.service.model.GenericModel; /** * The response sent by the workspace, including the output text, detected intents and entities, and context. */ -public class MessageResponse extends DynamicModel { - private Type inputType = new TypeToken() { - }.getType(); - private Type intentsType = new TypeToken>() { - }.getType(); - private Type entitiesType = new TypeToken>() { - }.getType(); - private Type alternateIntentsType = new TypeToken() { - }.getType(); - private Type contextType = new TypeToken() { - }.getType(); - private Type outputType = new TypeToken() { - }.getType(); - private Type actionsType = new TypeToken>() { - }.getType(); +public class MessageResponse extends GenericModel { + + private MessageInput input; + private List intents; + private List entities; + @SerializedName("alternate_intents") + private Boolean alternateIntents; + private Context context; + private OutputData output; + private List actions; /** * Gets the input. * + * The text of the user input. + * * @return the input */ public MessageInput getInput() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("input"), inputType); + return input; } /** * Gets the intents. * + * An array of intents recognized in the user input, sorted in descending order of confidence. + * * @return the intents */ public List getIntents() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("intents"), intentsType); + return intents; } /** * Gets the entities. * + * An array of entities identified in the user input. + * * @return the entities */ public List getEntities() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("entities"), entitiesType); + return entities; } /** * Gets the alternateIntents. * + * Whether to return more than one intent. A value of `true` indicates that all matching intents are returned. + * * @return the alternateIntents */ public Boolean isAlternateIntents() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("alternate_intents"), alternateIntentsType); + return alternateIntents; } /** * Gets the context. * + * State information for the conversation. To maintain state, include the context from the previous response. + * * @return the context */ public Context getContext() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("context"), contextType); + return context; } /** * Gets the output. * + * An output object that includes the response to the user, the dialog nodes that were triggered, and messages from + * the log. + * * @return the output */ public OutputData getOutput() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("output"), outputType); + return output; } /** * Gets the actions. * + * An array of objects describing any actions requested by the dialog node. + * * @return the actions */ public List getActions() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("actions"), actionsType); + return actions; } } From 603670ea2cf0d907a94ba07c0e3561ac3ff76aab Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:40:16 -0500 Subject: [PATCH 03/26] chore(Assistant v1): Apply manual changes --- .../assistant/v1/model/InputData.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java index 62af2ea42f4..38a44170599 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java @@ -43,4 +43,55 @@ public String text() { public void setText(final String text) { this.put("text", text); } + + /** + * Builder. + */ + public static class Builder { + private String text; + + private Builder(InputData inputData) { + text = inputData.text(); + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param text the text + */ + public Builder(String text) { + this.text = text; + } + + /** + * Builds a InputData. + * + * @return the inputData + */ + public InputData build() { + return new InputData(this); + } + + /** + * Set the text. + * + * @param text the text + * @return the InputData builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + } + + private InputData(Builder builder) { + Validator.notNull(builder.text, "text cannot be null"); + setText(builder.text); + } } From 937ec1f78033bae20280f1629487073ca0b01540 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:44:05 -0500 Subject: [PATCH 04/26] docs(Compare and Comply): Update code comments --- .../compare_comply/v1/CompareComply.java | 30 +++++++++---------- .../v1/model/DeleteFeedbackOptions.java | 2 +- .../compare_comply/v1/model/Document.java | 3 +- .../v1/model/GetFeedbackOptions.java | 2 +- .../v1/model/LeadingSentence.java | 2 +- .../v1/model/SectionTitles.java | 2 +- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComply.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComply.java index 9bdc2b9971d..cf3715ece2a 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComply.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComply.java @@ -95,7 +95,7 @@ public CompareComply(String versionDate, IamOptions iamOptions) { /** * Convert file to HTML. * - * Uploads an input file. The response includes an HTML version of the document. + * Convert an uploaded file to HTML. * * @param convertToHtmlOptions the {@link ConvertToHtmlOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link HTMLReturn} @@ -122,7 +122,7 @@ public ServiceCall convertToHtml(ConvertToHtmlOptions convertToHtmlO /** * Classify the elements of a document. * - * Uploads a file. The response includes an analysis of the document's structural and semantic elements. + * Analyze an uploaded file's structural and semantic elements. * * @param classifyElementsOptions the {@link ClassifyElementsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ClassifyReturn} @@ -149,7 +149,7 @@ public ServiceCall classifyElements(ClassifyElementsOptions clas /** * Extract a document's tables. * - * Uploads a file. The response includes an analysis of the document's tables. + * Extract and analyze an uploaded file's tables. * * @param extractTablesOptions the {@link ExtractTablesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TableReturn} @@ -176,8 +176,7 @@ public ServiceCall extractTables(ExtractTablesOptions extractTables /** * Compare two documents. * - * Uploads two input files. The response includes JSON comparing the two documents. Uploaded files must be in the same - * file format. + * Compare two uploaded input files. Uploaded files must be in the same file format. * * @param compareDocumentsOptions the {@link CompareDocumentsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link CompareReturn} @@ -360,10 +359,9 @@ public ServiceCall listFeedback() { * * Run Compare and Comply methods over a collection of input documents. * **Important:** Batch processing requires the use of the [IBM Cloud Object Storage - * service] - * (https://console.bluemix.net/docs/services/cloud-object-storage/about-cos.html#about-ibm-cloud-object-storage). + * service](https://cloud.ibm.com/docs/services/cloud-object-storage/about-cos.html#about-ibm-cloud-object-storage). * The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using batch - * processing](https://console.bluemix.net/docs/services/compare-comply/batching.html#before-you-batch). + * processing](https://cloud.ibm.com/docs/services/compare-comply/batching.html#before-you-batch). * * @param createBatchOptions the {@link CreateBatchOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link BatchStatus} @@ -398,9 +396,9 @@ public ServiceCall createBatch(CreateBatchOptions createBatchOption } /** - * Gets information about a specific batch-processing request. + * Get information about a specific batch-processing request. * - * Gets information about a batch-processing request with a specified ID. + * Get information about a batch-processing request with a specified ID. * * @param getBatchOptions the {@link GetBatchOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link BatchStatus} @@ -417,9 +415,9 @@ public ServiceCall getBatch(GetBatchOptions getBatchOptions) { } /** - * Gets the list of submitted batch-processing jobs. + * List submitted batch-processing jobs. * - * Gets the list of batch-processing jobs submitted by users. + * List the batch-processing jobs submitted by users. * * @param listBatchesOptions the {@link ListBatchesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Batches} @@ -436,9 +434,9 @@ public ServiceCall listBatches(ListBatchesOptions listBatchesOptions) { } /** - * Gets the list of submitted batch-processing jobs. + * List submitted batch-processing jobs. * - * Gets the list of batch-processing jobs submitted by users. + * List the batch-processing jobs submitted by users. * * @return a {@link ServiceCall} with a response type of {@link Batches} */ @@ -447,9 +445,9 @@ public ServiceCall listBatches() { } /** - * Updates a pending or active batch-processing request. + * Update a pending or active batch-processing request. * - * Updates a pending or active batch-processing request. You can rescan the input bucket to check for new documents or + * Update a pending or active batch-processing request. You can rescan the input bucket to check for new documents or * cancel a request. * * @param updateBatchOptions the {@link UpdateBatchOptions} containing the options for the call diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/DeleteFeedbackOptions.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/DeleteFeedbackOptions.java index fbe0ad76090..cedaad30586 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/DeleteFeedbackOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/DeleteFeedbackOptions.java @@ -112,7 +112,7 @@ public Builder newBuilder() { /** * Gets the feedbackId. * - * An string that specifies the feedback entry to be deleted from the document. + * A string that specifies the feedback entry to be deleted from the document. * * @return the feedbackId */ diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Document.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Document.java index 9f0fcbb770a..35dbfa3467d 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Document.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Document.java @@ -60,7 +60,8 @@ public String getHash() { /** * Gets the label. * - * The label applied to the input document with the calling method's `file1_label` or `file2_label` value. + * The label applied to the input document with the calling method's `file_1_label` or `file_2_label` value. This + * field is specified only in the output of the **Comparing two documents** method. * * @return the label */ diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/GetFeedbackOptions.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/GetFeedbackOptions.java index e0f641030d0..622193084b3 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/GetFeedbackOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/GetFeedbackOptions.java @@ -112,7 +112,7 @@ public Builder newBuilder() { /** * Gets the feedbackId. * - * An string that specifies the feedback entry to be included in the output. + * A string that specifies the feedback entry to be included in the output. * * @return the feedbackId */ diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/LeadingSentence.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/LeadingSentence.java index f58ff18b611..f5b483cd78b 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/LeadingSentence.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/LeadingSentence.java @@ -53,7 +53,7 @@ public Location getLocation() { /** * Gets the elementLocations. * - * An array of `location` objects listing the locations of detected leading sentences. + * An array of `location` objects that lists the locations of detected leading sentences. * * @return the elementLocations */ diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/SectionTitles.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/SectionTitles.java index bfd40e4a06f..35379aa666d 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/SectionTitles.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/SectionTitles.java @@ -68,7 +68,7 @@ public Long getLevel() { /** * Gets the elementLocations. * - * An array of `location` objects listing the locations of detected leading sentences. + * An array of `location` objects that lists the locations of detected section titles. * * @return the elementLocations */ From 6c2bcf7f7fa70af30d2b7f3d628e85a5e411ec01 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:44:43 -0500 Subject: [PATCH 05/26] feat(Compare and Comply): Add attributes property to BodyCells model --- .../compare_comply/v1/model/BodyCells.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/BodyCells.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/BodyCells.java index 59623db8859..e0f1ec7eb0a 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/BodyCells.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/BodyCells.java @@ -46,6 +46,7 @@ public class BodyCells extends GenericModel { private List columnHeaderTexts; @SerializedName("column_header_texts_normalized") private List columnHeaderTextsNormalized; + private List attributes; /** * Gets the cellId. @@ -193,4 +194,13 @@ public List getColumnHeaderTexts() { public List getColumnHeaderTextsNormalized() { return columnHeaderTextsNormalized; } + + /** + * Gets the attributes. + * + * @return the attributes + */ + public List getAttributes() { + return attributes; + } } From e1f75e43411fdb52e2676a7b396e8eb15d6f2c3d Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:45:22 -0500 Subject: [PATCH 06/26] feat(Compare and Comply): Add ADDRESS enum to Attribute model --- .../developer_cloud/compare_comply/v1/model/Attribute.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Attribute.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Attribute.java index 1f1a17bb3db..ebfaff8d0cb 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Attribute.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Attribute.java @@ -20,9 +20,11 @@ public class Attribute extends GenericModel { /** - * The type of attribute. Possible values are `Currency`, `DateTime`, `Location`, `Organization`, and `Person`. + * The type of attribute. */ public interface Type { + /** Address. */ + String ADDRESS = "Address"; /** Currency. */ String CURRENCY = "Currency"; /** DateTime. */ @@ -42,7 +44,7 @@ public interface Type { /** * Gets the type. * - * The type of attribute. Possible values are `Currency`, `DateTime`, `Location`, `Organization`, and `Person`. + * The type of attribute. * * @return the type */ From 341c24f5d4265516f95e5223f96d4aa12b68209c Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:46:20 -0500 Subject: [PATCH 07/26] feat(Compare and Comply): Add confidenceLevel property to ContractAmts, EffectiveDates, and Terminat --- .../compare_comply/v1/model/ContractAmts.java | 26 +++++++++++++++++++ .../v1/model/EffectiveDates.java | 26 +++++++++++++++++++ .../v1/model/TerminationDates.java | 26 +++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/ContractAmts.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/ContractAmts.java index e23f11724ac..6ccb480f2be 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/ContractAmts.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/ContractAmts.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.developer_cloud.compare_comply.v1.model; +import com.google.gson.annotations.SerializedName; import com.ibm.watson.developer_cloud.service.model.GenericModel; /** @@ -19,7 +20,21 @@ */ public class ContractAmts extends GenericModel { + /** + * The confidence level in the identification of the contract amount. + */ + public interface ConfidenceLevel { + /** High. */ + String HIGH = "High"; + /** Medium. */ + String MEDIUM = "Medium"; + /** Low. */ + String LOW = "Low"; + } + private String text; + @SerializedName("confidence_level") + private String confidenceLevel; private Location location; /** @@ -33,6 +48,17 @@ public String getText() { return text; } + /** + * Gets the confidenceLevel. + * + * The confidence level in the identification of the contract amount. + * + * @return the confidenceLevel + */ + public String getConfidenceLevel() { + return confidenceLevel; + } + /** * Gets the location. * diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/EffectiveDates.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/EffectiveDates.java index a7d644c543c..c3e78c26034 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/EffectiveDates.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/EffectiveDates.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.developer_cloud.compare_comply.v1.model; +import com.google.gson.annotations.SerializedName; import com.ibm.watson.developer_cloud.service.model.GenericModel; /** @@ -19,7 +20,21 @@ */ public class EffectiveDates extends GenericModel { + /** + * The confidence level in the identification of the effective date. + */ + public interface ConfidenceLevel { + /** High. */ + String HIGH = "High"; + /** Medium. */ + String MEDIUM = "Medium"; + /** Low. */ + String LOW = "Low"; + } + private String text; + @SerializedName("confidence_level") + private String confidenceLevel; private Location location; /** @@ -33,6 +48,17 @@ public String getText() { return text; } + /** + * Gets the confidenceLevel. + * + * The confidence level in the identification of the effective date. + * + * @return the confidenceLevel + */ + public String getConfidenceLevel() { + return confidenceLevel; + } + /** * Gets the location. * diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/TerminationDates.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/TerminationDates.java index 84a1bbaa74b..5ad325a1f88 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/TerminationDates.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/TerminationDates.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.developer_cloud.compare_comply.v1.model; +import com.google.gson.annotations.SerializedName; import com.ibm.watson.developer_cloud.service.model.GenericModel; /** @@ -19,7 +20,21 @@ */ public class TerminationDates extends GenericModel { + /** + * The confidence level in the identification of the termination date. + */ + public interface ConfidenceLevel { + /** High. */ + String HIGH = "High"; + /** Medium. */ + String MEDIUM = "Medium"; + /** Low. */ + String LOW = "Low"; + } + private String text; + @SerializedName("confidence_level") + private String confidenceLevel; private Location location; /** @@ -33,6 +48,17 @@ public String getText() { return text; } + /** + * Gets the confidenceLevel. + * + * The confidence level in the identification of the termination date. + * + * @return the confidenceLevel + */ + public String getConfidenceLevel() { + return confidenceLevel; + } + /** * Gets the location. * From 7116e3cbc9526629364d254b03e6c8a57bb22720 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:46:43 -0500 Subject: [PATCH 08/26] feat(Compare and Comply): Add importance property to Parties model --- .../compare_comply/v1/model/Parties.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Parties.java b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Parties.java index 009e05457ac..3bda007b78a 100644 --- a/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Parties.java +++ b/compare-comply/src/main/java/com/ibm/watson/developer_cloud/compare_comply/v1/model/Parties.java @@ -21,7 +21,18 @@ */ public class Parties extends GenericModel { + /** + * A string that identifies the importance of the party. + */ + public interface Importance { + /** Primary. */ + String PRIMARY = "Primary"; + /** Unknown. */ + String UNKNOWN = "Unknown"; + } + private String party; + private String importance; private String role; private List
addresses; private List contacts; @@ -37,6 +48,17 @@ public String getParty() { return party; } + /** + * Gets the importance. + * + * A string that identifies the importance of the party. + * + * @return the importance + */ + public String getImportance() { + return importance; + } + /** * Gets the role. * From ae9d5ea8ef85fe59b15338c17a01c14124a64455 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:53:16 -0500 Subject: [PATCH 09/26] feat(Discovery): Add getStopwordListStatus method --- .../discovery/v1/Discovery.java | 51 ++-- .../v1/model/CreateEnvironmentOptions.java | 7 - .../discovery/v1/model/CredentialDetails.java | 2 + .../discovery/v1/model/DocumentAccepted.java | 8 +- .../discovery/v1/model/DocumentCounts.java | 12 + .../discovery/v1/model/DocumentStatus.java | 2 + .../v1/model/FederatedQueryOptions.java | 238 +----------------- .../discovery/v1/model/Field.java | 12 +- .../discovery/v1/model/GetGatewayOptions.java | 2 +- .../model/GetStopwordListStatusOptions.java | 124 +++++++++ .../v1/model/ListGatewaysOptions.java | 2 +- .../discovery/v1/model/QueryAggregation.java | 3 - .../discovery/v1/model/QueryOptions.java | 238 +----------------- 13 files changed, 214 insertions(+), 487 deletions(-) create mode 100644 discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetStopwordListStatusOptions.java diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java index 7c89fe7eeba..85cb338f4d7 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java @@ -57,12 +57,12 @@ import com.ibm.watson.developer_cloud.discovery.v1.model.GetDocumentStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetEnvironmentOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetGatewayOptions; -import com.ibm.watson.developer_cloud.discovery.v1.model.ListGatewaysOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsEventRateOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsQueryEventOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsQueryNoResultsOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsQueryOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsQueryTokenEventOptions; +import com.ibm.watson.developer_cloud.discovery.v1.model.GetStopwordListStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTokenizationDictionaryStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTrainingDataOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTrainingExampleOptions; @@ -77,6 +77,7 @@ import com.ibm.watson.developer_cloud.discovery.v1.model.ListEnvironmentsResponse; import com.ibm.watson.developer_cloud.discovery.v1.model.ListExpansionsOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.ListFieldsOptions; +import com.ibm.watson.developer_cloud.discovery.v1.model.ListGatewaysOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.ListTrainingDataOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.ListTrainingExamplesOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.LogQueryResponse; @@ -114,7 +115,6 @@ import com.ibm.watson.developer_cloud.util.Validator; import okhttp3.MultipartBody; import okhttp3.RequestBody; -import org.apache.commons.lang3.StringUtils; /** * The IBM Watson™ Discovery Service is a cognitive search and content analytics engine that you can add to @@ -823,6 +823,28 @@ public ServiceCall deleteTokenizationDictionary( return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); } + /** + * Get stopword list status. + * + * Returns the current status of the stopword list for the specified collection. + * + * @param getStopwordListStatusOptions the {@link GetStopwordListStatusOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link TokenDictStatusResponse} + */ + public ServiceCall getStopwordListStatus( + GetStopwordListStatusOptions getStopwordListStatusOptions) { + Validator.notNull(getStopwordListStatusOptions, "getStopwordListStatusOptions cannot be null"); + String[] pathSegments = { "v1/environments", "collections", "word_lists/stopwords" }; + String[] pathParameters = { getStopwordListStatusOptions.environmentId(), getStopwordListStatusOptions + .collectionId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, + pathParameters)); + builder.query(VERSION, versionDate); + builder.header("X-IBMCloud-SDK-Analytics", + "service_name=discovery;service_version=v1;operation_id=getStopwordListStatus"); + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TokenDictStatusResponse.class)); + } + /** * Get tokenization dictionary status. * @@ -1034,19 +1056,19 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated contentJson.addProperty("count", federatedQueryOptions.count()); } if (federatedQueryOptions.returnFields() != null) { - contentJson.addProperty("return", StringUtils.join(federatedQueryOptions.returnFields(), ",")); + contentJson.addProperty("return", federatedQueryOptions.returnFields()); } if (federatedQueryOptions.offset() != null) { contentJson.addProperty("offset", federatedQueryOptions.offset()); } if (federatedQueryOptions.sort() != null) { - contentJson.addProperty("sort", StringUtils.join(federatedQueryOptions.sort(), ",")); + contentJson.addProperty("sort", federatedQueryOptions.sort()); } if (federatedQueryOptions.highlight() != null) { contentJson.addProperty("highlight", federatedQueryOptions.highlight()); } if (federatedQueryOptions.passagesFields() != null) { - contentJson.addProperty("passages.fields", StringUtils.join(federatedQueryOptions.passagesFields(), ",")); + contentJson.addProperty("passages.fields", federatedQueryOptions.passagesFields()); } if (federatedQueryOptions.passagesCount() != null) { contentJson.addProperty("passages.count", federatedQueryOptions.passagesCount()); @@ -1061,17 +1083,16 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated contentJson.addProperty("deduplicate.field", federatedQueryOptions.deduplicateField()); } if (federatedQueryOptions.collectionIds() != null) { - contentJson.addProperty("collection_ids", StringUtils.join(federatedQueryOptions.collectionIds(), ",")); + contentJson.addProperty("collection_ids", federatedQueryOptions.collectionIds()); } if (federatedQueryOptions.similar() != null) { contentJson.addProperty("similar", federatedQueryOptions.similar()); } if (federatedQueryOptions.similarDocumentIds() != null) { - contentJson.addProperty("similar.document_ids", StringUtils.join(federatedQueryOptions.similarDocumentIds(), - ",")); + contentJson.addProperty("similar.document_ids", federatedQueryOptions.similarDocumentIds()); } if (federatedQueryOptions.similarFields() != null) { - contentJson.addProperty("similar.fields", StringUtils.join(federatedQueryOptions.similarFields(), ",")); + contentJson.addProperty("similar.fields", federatedQueryOptions.similarFields()); } if (federatedQueryOptions.bias() != null) { contentJson.addProperty("bias", federatedQueryOptions.bias()); @@ -1185,19 +1206,19 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("count", queryOptions.count()); } if (queryOptions.returnFields() != null) { - contentJson.addProperty("return", StringUtils.join(queryOptions.returnFields(), ",")); + contentJson.addProperty("return", queryOptions.returnFields()); } if (queryOptions.offset() != null) { contentJson.addProperty("offset", queryOptions.offset()); } if (queryOptions.sort() != null) { - contentJson.addProperty("sort", StringUtils.join(queryOptions.sort(), ",")); + contentJson.addProperty("sort", queryOptions.sort()); } if (queryOptions.highlight() != null) { contentJson.addProperty("highlight", queryOptions.highlight()); } if (queryOptions.passagesFields() != null) { - contentJson.addProperty("passages.fields", StringUtils.join(queryOptions.passagesFields(), ",")); + contentJson.addProperty("passages.fields", queryOptions.passagesFields()); } if (queryOptions.passagesCount() != null) { contentJson.addProperty("passages.count", queryOptions.passagesCount()); @@ -1212,16 +1233,16 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("deduplicate.field", queryOptions.deduplicateField()); } if (queryOptions.collectionIds() != null) { - contentJson.addProperty("collection_ids", StringUtils.join(queryOptions.collectionIds(), ",")); + contentJson.addProperty("collection_ids", queryOptions.collectionIds()); } if (queryOptions.similar() != null) { contentJson.addProperty("similar", queryOptions.similar()); } if (queryOptions.similarDocumentIds() != null) { - contentJson.addProperty("similar.document_ids", StringUtils.join(queryOptions.similarDocumentIds(), ",")); + contentJson.addProperty("similar.document_ids", queryOptions.similarDocumentIds()); } if (queryOptions.similarFields() != null) { - contentJson.addProperty("similar.fields", StringUtils.join(queryOptions.similarFields(), ",")); + contentJson.addProperty("similar.fields", queryOptions.similarFields()); } if (queryOptions.bias() != null) { contentJson.addProperty("bias", queryOptions.bias()); diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java index 932faf8ca0e..9e92fb86370 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java @@ -121,13 +121,6 @@ public Builder size(String size) { this.size = size; return this; } - - /** - * @deprecated This method no longer has an effect on the created environment. Please use the String method. - */ - public Builder size(Long size) { - return this; - } } private CreateEnvironmentOptions(Builder builder) { diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java index 04ca5c099d7..d8fb4ee77d9 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java @@ -53,6 +53,8 @@ public interface CredentialType { public interface SourceVersion { /** online. */ String ONLINE = "online"; + /** 2016. */ + String 2016 = "2016"; } @SerializedName("credential_type") diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentAccepted.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentAccepted.java index 7f5e3a83563..b4306ef8733 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentAccepted.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentAccepted.java @@ -23,11 +23,14 @@ public class DocumentAccepted extends GenericModel { /** - * Status of the document in the ingestion process. + * Status of the document in the ingestion process. A status of `processing` is returned for documents that are + * ingested with a *version* date before `2019-01-01`. The `pending` status is returned for all others. */ public interface Status { /** processing. */ String PROCESSING = "processing"; + /** pending. */ + String PENDING = "pending"; } @SerializedName("document_id") @@ -49,7 +52,8 @@ public String getDocumentId() { /** * Gets the status. * - * Status of the document in the ingestion process. + * Status of the document in the ingestion process. A status of `processing` is returned for documents that are + * ingested with a *version* date before `2019-01-01`. The `pending` status is returned for all others. * * @return the status */ diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentCounts.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentCounts.java index cc7d91bd5a8..91efe393388 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentCounts.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentCounts.java @@ -22,6 +22,7 @@ public class DocumentCounts extends GenericModel { private Long available; private Long processing; private Long failed; + private Long pending; /** * Gets the available. @@ -55,4 +56,15 @@ public Long getProcessing() { public Long getFailed() { return failed; } + + /** + * Gets the pending. + * + * The number of documents that have been uploaded to the collection, but have not yet started processing. + * + * @return the pending + */ + public Long getPending() { + return pending; + } } diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentStatus.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentStatus.java index c330533bb2a..1b78c1f9a35 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentStatus.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/DocumentStatus.java @@ -35,6 +35,8 @@ public interface Status { String FAILED = "failed"; /** processing. */ String PROCESSING = "processing"; + /** pending. */ + String PENDING = "pending"; } /** diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java index 6e7a043f5fb..a0ce2d3246a 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java @@ -14,10 +14,6 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.Validator; -import org.apache.commons.lang3.StringUtils; - -import java.util.Arrays; -import java.util.List; /** * The federatedQuery options. @@ -123,108 +119,6 @@ public FederatedQueryOptions build() { return new FederatedQueryOptions(this); } - /** - * Adds an returnField to returnFields. - * - * @param returnField the new returnField - * @return the FederatedQueryOptions builder - * @deprecated returnFields is now of type String, so this method will be removed in the next major release - */ - public Builder addReturnField(String returnField) { - Validator.notNull(returnField, "returnField cannot be null"); - if (this.returnFields == null) { - this.returnFields = returnField; - } else { - this.returnFields += String.format(",%s", returnField); - } - return this; - } - - /** - * Adds an sort to sort. - * - * @param sort the new sort - * @return the FederatedQueryOptions builder - * @deprecated sort is now of type String, so this method will be removed in the next major release - */ - public Builder addSort(String sort) { - Validator.notNull(sort, "sort cannot be null"); - if (this.sort == null) { - this.sort = sort; - } else { - this.sort += String.format(",%s", sort); - } - return this; - } - - /** - * Adds an passagesFields to passagesFields. - * - * @param passagesFields the new passagesFields - * @return the FederatedQueryOptions builder - * @deprecated passagesFields is now of type String, so this method will be removed in the next major release - */ - public Builder addPassagesFields(String passagesFields) { - Validator.notNull(passagesFields, "passagesFields cannot be null"); - if (this.passagesFields == null) { - this.passagesFields = passagesFields; - } else { - this.passagesFields += String.format(",%s", passagesFields); - } - return this; - } - - /** - * Adds an collectionIds to collectionIds. - * - * @param collectionIds the new collectionIds - * @return the FederatedQueryOptions builder - * @deprecated collectionIds is now of type String, so this method will be removed in the next major release - */ - public Builder addCollectionIds(String collectionIds) { - Validator.notNull(collectionIds, "collectionIds cannot be null"); - if (this.collectionIds == null) { - this.collectionIds = collectionIds; - } else { - this.collectionIds += String.format(",%s", collectionIds); - } - return this; - } - - /** - * Adds an similarDocumentIds to similarDocumentIds. - * - * @param similarDocumentIds the new similarDocumentIds - * @return the FederatedQueryOptions builder - * @deprecated similarDocumentIds is now of type String, so this method will be removed in the next major release - */ - public Builder addSimilarDocumentIds(String similarDocumentIds) { - Validator.notNull(similarDocumentIds, "similarDocumentIds cannot be null"); - if (this.similarDocumentIds == null) { - this.similarDocumentIds = similarDocumentIds; - } else { - this.similarDocumentIds += String.format(",%s", similarDocumentIds); - } - return this; - } - - /** - * Adds an similarFields to similarFields. - * - * @param similarFields the new similarFields - * @return the FederatedQueryOptions builder - * @deprecated similarFields is now of type String, so this method will be removed in the next major release - */ - public Builder addSimilarFields(String similarFields) { - Validator.notNull(similarFields, "similarFields cannot be null"); - if (this.similarFields == null) { - this.similarFields = similarFields; - } else { - this.similarFields += String.format(",%s", similarFields); - } - return this; - } - /** * Set the environmentId. * @@ -313,19 +207,6 @@ public Builder returnFields(String returnFields) { return this; } - /** - * Set the returnFields. - * - * @param returnFields the returnFields - * @return the FederatedQueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder returnFields(List returnFields) { - this.returnFields = StringUtils.join(returnFields, ','); - return this; - } - /** * Set the offset. * @@ -348,19 +229,6 @@ public Builder sort(String sort) { return this; } - /** - * Set the sort. - * - * @param sort the sort - * @return the FederatedQueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder sort(List sort) { - this.sort = StringUtils.join(sort, ','); - return this; - } - /** * Set the highlight. * @@ -383,19 +251,6 @@ public Builder passagesFields(String passagesFields) { return this; } - /** - * Set the passagesFields. - * - * @param passagesFields the passagesFields - * @return the FederatedQueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder passagesFields(List passagesFields) { - this.passagesFields = StringUtils.join(passagesFields, ','); - return this; - } - /** * Set the passagesCount. * @@ -451,19 +306,6 @@ public Builder collectionIds(String collectionIds) { return this; } - /** - * Set the collectionIds. - * - * @param collectionIds the collectionIds - * @return the FederatedQueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder collectionIds(List collectionIds) { - this.collectionIds = StringUtils.join(collectionIds, ','); - return this; - } - /** * Set the similar. * @@ -486,19 +328,6 @@ public Builder similarDocumentIds(String similarDocumentIds) { return this; } - /** - * Set the similarDocumentIds. - * - * @param similarDocumentIds the similarDocumentIds - * @return the FederatedQueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder similarDocumentIds(List similarDocumentIds) { - this.similarDocumentIds = StringUtils.join(similarDocumentIds, ','); - return this; - } - /** * Set the similarFields. * @@ -510,19 +339,6 @@ public Builder similarFields(String similarFields) { return this; } - /** - * Set the similarFields. - * - * @param similarFields the similarFields - * @return the FederatedQueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder similarFields(List similarFields) { - this.similarFields = StringUtils.join(similarFields, ','); - return this; - } - /** * Set the bias. * @@ -669,14 +485,9 @@ public Long count() { * A comma-separated list of the portion of the document hierarchy to return. * * @return the returnFields - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List returnFields() { - if (returnFields != null) { - return Arrays.asList(returnFields.split(",")); - } else { - return null; - } + public String returnFields() { + return returnFields; } /** @@ -699,14 +510,9 @@ public Long offset() { * prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. * * @return the sort - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List sort() { - if (sort != null) { - return Arrays.asList(sort.split(",")); - } else { - return null; - } + public String sort() { + return sort; } /** @@ -728,14 +534,9 @@ public Boolean highlight() { * fields are included. * * @return the passagesFields - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List passagesFields() { - if (passagesFields != null) { - return Arrays.asList(passagesFields.split(",")); - } else { - return null; - } + public String passagesFields() { + return passagesFields; } /** @@ -794,14 +595,9 @@ public String deduplicateField() { * invalid when performing a single collection query. * * @return the collectionIds - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List collectionIds() { - if (collectionIds != null) { - return Arrays.asList(collectionIds.split(",")); - } else { - return null; - } + public String collectionIds() { + return collectionIds; } /** @@ -826,14 +622,9 @@ public Boolean similar() { * and reduce the scope. * * @return the similarDocumentIds - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List similarDocumentIds() { - if (similarDocumentIds != null) { - return Arrays.asList(similarDocumentIds.split(",")); - } else { - return null; - } + public String similarDocumentIds() { + return similarDocumentIds; } /** @@ -843,14 +634,9 @@ public List similarDocumentIds() { * specified, the entire document is used for comparison. * * @return the similarFields - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List similarFields() { - if (similarFields != null) { - return Arrays.asList(similarFields.split(",")); - } else { - return null; - } + public String similarFields() { + return similarFields; } /** diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java index ac719ff8d92..399b8e8f37f 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java @@ -31,19 +31,19 @@ public interface FieldType { /** date. */ String DATE = "date"; /** long. */ - String LONG = "long"; + String XLONG = "long"; /** integer. */ String INTEGER = "integer"; /** short. */ - String SHORT = "short"; + String XSHORT = "short"; /** byte. */ - String BYTE = "byte"; + String XBYTE = "byte"; /** double. */ - String DOUBLE = "double"; + String XDOUBLE = "double"; /** float. */ - String FLOAT = "float"; + String XFLOAT = "float"; /** boolean. */ - String BOOLEAN = "boolean"; + String XBOOLEAN = "boolean"; /** binary. */ String BINARY = "binary"; } diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetGatewayOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetGatewayOptions.java index 6711ce3126d..11b6a0a31a6 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetGatewayOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetGatewayOptions.java @@ -55,7 +55,7 @@ public Builder(String environmentId, String gatewayId) { /** * Builds a GetGatewayOptions. * - * @return the getGatewayDetailsOptions + * @return the getGatewayOptions */ public GetGatewayOptions build() { return new GetGatewayOptions(this); diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetStopwordListStatusOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetStopwordListStatusOptions.java new file mode 100644 index 00000000000..b6918ce8c3d --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/GetStopwordListStatusOptions.java @@ -0,0 +1,124 @@ +/* + * Copyright 2018 IBM Corp. All Rights Reserved. + * + * 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.developer_cloud.discovery.v1.model; + +import com.ibm.watson.developer_cloud.service.model.GenericModel; +import com.ibm.watson.developer_cloud.util.Validator; + +/** + * The getStopwordListStatus options. + */ +public class GetStopwordListStatusOptions extends GenericModel { + + private String environmentId; + private String collectionId; + + /** + * Builder. + */ + public static class Builder { + private String environmentId; + private String collectionId; + + private Builder(GetStopwordListStatusOptions getStopwordListStatusOptions) { + environmentId = getStopwordListStatusOptions.environmentId; + collectionId = getStopwordListStatusOptions.collectionId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param environmentId the environmentId + * @param collectionId the collectionId + */ + public Builder(String environmentId, String collectionId) { + this.environmentId = environmentId; + this.collectionId = collectionId; + } + + /** + * Builds a GetStopwordListStatusOptions. + * + * @return the getStopwordListStatusOptions + */ + public GetStopwordListStatusOptions build() { + return new GetStopwordListStatusOptions(this); + } + + /** + * Set the environmentId. + * + * @param environmentId the environmentId + * @return the GetStopwordListStatusOptions builder + */ + public Builder environmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the GetStopwordListStatusOptions builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + } + + private GetStopwordListStatusOptions(Builder builder) { + Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + environmentId = builder.environmentId; + collectionId = builder.collectionId; + } + + /** + * New builder. + * + * @return a GetStopwordListStatusOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the environmentId. + * + * The ID of the environment. + * + * @return the environmentId + */ + public String environmentId() { + return environmentId; + } + + /** + * Gets the collectionId. + * + * The ID of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/ListGatewaysOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/ListGatewaysOptions.java index e92cf8fc449..ebd8fdfc374 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/ListGatewaysOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/ListGatewaysOptions.java @@ -50,7 +50,7 @@ public Builder(String environmentId) { /** * Builds a ListGatewaysOptions. * - * @return the getGatewayListOptions + * @return the listGatewaysOptions */ public ListGatewaysOptions build() { return new ListGatewaysOptions(this); diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java index ab40cc85239..a3f0f1f1f81 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java @@ -14,15 +14,12 @@ import java.util.List; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.discovery.v1.query.AggregationDeserializer; import com.ibm.watson.developer_cloud.service.model.GenericModel; /** * An aggregation produced by the Discovery service to analyze the input provided. */ -@JsonAdapter(AggregationDeserializer.class) public class QueryAggregation extends GenericModel { private String type; diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java index 58877e2a520..7afb688779c 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java @@ -14,10 +14,6 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.Validator; -import org.apache.commons.lang3.StringUtils; - -import java.util.Arrays; -import java.util.List; /** * The query options. @@ -128,108 +124,6 @@ public QueryOptions build() { return new QueryOptions(this); } - /** - * Adds an returnField to returnFields. - * - * @param returnField the new returnField - * @return the QueryOptions builder - * @deprecated returnFields is now of type String, so this method will be removed in the next major release - */ - public Builder addReturnField(String returnField) { - Validator.notNull(returnField, "returnField cannot be null"); - if (this.returnFields == null) { - this.returnFields = returnField; - } else { - this.returnFields += String.format(",%s", returnField); - } - return this; - } - - /** - * Adds an sort to sort. - * - * @param sort the new sort - * @return the QueryOptions builder - * @deprecated sort is now of type String, so this method will be removed in the next major release - */ - public Builder addSort(String sort) { - Validator.notNull(sort, "sort cannot be null"); - if (this.sort == null) { - this.sort = sort; - } else { - this.sort += String.format(",%s", sort); - } - return this; - } - - /** - * Adds an passagesFields to passagesFields. - * - * @param passagesFields the new passagesFields - * @return the QueryOptions builder - * @deprecated passagesFields is now of type String, so this method will be removed in the next major release - */ - public Builder addPassagesFields(String passagesFields) { - Validator.notNull(passagesFields, "passagesFields cannot be null"); - if (this.passagesFields == null) { - this.passagesFields = passagesFields; - } else { - this.passagesFields += String.format(",%s", passagesFields); - } - return this; - } - - /** - * Adds an collectionIds to collectionIds. - * - * @param collectionIds the new collectionIds - * @return the QueryOptions builder - * @deprecated collectionIds is now of type String, so this method will be removed in the next major release - */ - public Builder addCollectionIds(String collectionIds) { - Validator.notNull(collectionIds, "collectionIds cannot be null"); - if (this.collectionIds == null) { - this.collectionIds = collectionIds; - } else { - this.collectionIds += String.format(",%s", collectionIds); - } - return this; - } - - /** - * Adds an similarDocumentIds to similarDocumentIds. - * - * @param similarDocumentIds the new similarDocumentIds - * @return the QueryOptions builder - * @deprecated similarDocumentIds is now of type String, so this method will be removed in the next major release - */ - public Builder addSimilarDocumentIds(String similarDocumentIds) { - Validator.notNull(similarDocumentIds, "similarDocumentIds cannot be null"); - if (this.similarDocumentIds == null) { - this.similarDocumentIds = similarDocumentIds; - } else { - this.similarDocumentIds += String.format(",%s", similarDocumentIds); - } - return this; - } - - /** - * Adds an similarFields to similarFields. - * - * @param similarFields the new similarFields - * @return the QueryOptions builder - * @deprecated similarFields is now of type String, so this method will be removed in the next major release - */ - public Builder addSimilarFields(String similarFields) { - Validator.notNull(similarFields, "similarFields cannot be null"); - if (this.similarFields == null) { - this.similarFields = similarFields; - } else { - this.similarFields += String.format(",%s", similarFields); - } - return this; - } - /** * Set the environmentId. * @@ -329,19 +223,6 @@ public Builder returnFields(String returnFields) { return this; } - /** - * Set the returnFields. - * - * @param returnFields the returnFields - * @return the QueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder returnFields(List returnFields) { - this.returnFields = StringUtils.join(returnFields, ','); - return this; - } - /** * Set the offset. * @@ -364,19 +245,6 @@ public Builder sort(String sort) { return this; } - /** - * Set the sort. - * - * @param sort the sort - * @return the QueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder sort(List sort) { - this.sort = StringUtils.join(sort, ','); - return this; - } - /** * Set the highlight. * @@ -399,19 +267,6 @@ public Builder passagesFields(String passagesFields) { return this; } - /** - * Set the passagesFields. - * - * @param passagesFields the passagesFields - * @return the QueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder passagesFields(List passagesFields) { - this.passagesFields = StringUtils.join(passagesFields, ','); - return this; - } - /** * Set the passagesCount. * @@ -467,19 +322,6 @@ public Builder collectionIds(String collectionIds) { return this; } - /** - * Set the collectionIds. - * - * @param collectionIds the collectionIds - * @return the QueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder collectionIds(List collectionIds) { - this.collectionIds = StringUtils.join(collectionIds, ','); - return this; - } - /** * Set the similar. * @@ -502,19 +344,6 @@ public Builder similarDocumentIds(String similarDocumentIds) { return this; } - /** - * Set the similarDocumentIds. - * - * @param similarDocumentIds the similarDocumentIds - * @return the QueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder similarDocumentIds(List similarDocumentIds) { - this.similarDocumentIds = StringUtils.join(similarDocumentIds, ','); - return this; - } - /** * Set the similarFields. * @@ -526,19 +355,6 @@ public Builder similarFields(String similarFields) { return this; } - /** - * Set the similarFields. - * - * @param similarFields the similarFields - * @return the QueryOptions builder - * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with - * the other setter. - */ - public Builder similarFields(List similarFields) { - this.similarFields = StringUtils.join(similarFields, ','); - return this; - } - /** * Set the bias. * @@ -698,14 +514,9 @@ public Long count() { * A comma-separated list of the portion of the document hierarchy to return. * * @return the returnFields - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List returnFields() { - if (returnFields != null) { - return Arrays.asList(returnFields.split(",")); - } else { - return null; - } + public String returnFields() { + return returnFields; } /** @@ -728,14 +539,9 @@ public Long offset() { * prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. * * @return the sort - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List sort() { - if (sort != null) { - return Arrays.asList(sort.split(",")); - } else { - return null; - } + public String sort() { + return sort; } /** @@ -757,14 +563,9 @@ public Boolean highlight() { * fields are included. * * @return the passagesFields - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List passagesFields() { - if (passagesFields != null) { - return Arrays.asList(passagesFields.split(",")); - } else { - return null; - } + public String passagesFields() { + return passagesFields; } /** @@ -823,14 +624,9 @@ public String deduplicateField() { * invalid when performing a single collection query. * * @return the collectionIds - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List collectionIds() { - if (collectionIds != null) { - return Arrays.asList(collectionIds.split(",")); - } else { - return null; - } + public String collectionIds() { + return collectionIds; } /** @@ -855,14 +651,9 @@ public Boolean similar() { * and reduce the scope. * * @return the similarDocumentIds - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List similarDocumentIds() { - if (similarDocumentIds != null) { - return Arrays.asList(similarDocumentIds.split(",")); - } else { - return null; - } + public String similarDocumentIds() { + return similarDocumentIds; } /** @@ -872,14 +663,9 @@ public List similarDocumentIds() { * specified, the entire document is used for comparison. * * @return the similarFields - * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public List similarFields() { - if (similarFields != null) { - return Arrays.asList(similarFields.split(",")); - } else { - return null; - } + public String similarFields() { + return similarFields; } /** From 93cd657f2be2897d866fbae8a82dd4aa28a20d5a Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 11:55:07 -0500 Subject: [PATCH 10/26] chore(Discovery): Apply manual changes --- .../discovery/v1/Discovery.java | 26 +- .../v1/model/CreateEnvironmentOptions.java | 7 + .../discovery/v1/model/CredentialDetails.java | 2 - .../v1/model/FederatedQueryOptions.java | 238 +++++++++++++++++- .../discovery/v1/model/Field.java | 12 +- .../discovery/v1/model/QueryAggregation.java | 3 + .../discovery/v1/model/QueryOptions.java | 238 +++++++++++++++++- 7 files changed, 482 insertions(+), 44 deletions(-) diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java index 85cb338f4d7..82c719c4664 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java @@ -115,6 +115,7 @@ import com.ibm.watson.developer_cloud.util.Validator; import okhttp3.MultipartBody; import okhttp3.RequestBody; +import org.apache.commons.lang3.StringUtils; /** * The IBM Watson™ Discovery Service is a cognitive search and content analytics engine that you can add to @@ -1056,19 +1057,19 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated contentJson.addProperty("count", federatedQueryOptions.count()); } if (federatedQueryOptions.returnFields() != null) { - contentJson.addProperty("return", federatedQueryOptions.returnFields()); + contentJson.addProperty("return", StringUtils.join(federatedQueryOptions.returnFields(), ",")); } if (federatedQueryOptions.offset() != null) { contentJson.addProperty("offset", federatedQueryOptions.offset()); } if (federatedQueryOptions.sort() != null) { - contentJson.addProperty("sort", federatedQueryOptions.sort()); + contentJson.addProperty("sort", StringUtils.join(federatedQueryOptions.sort(), ",")); } if (federatedQueryOptions.highlight() != null) { contentJson.addProperty("highlight", federatedQueryOptions.highlight()); } if (federatedQueryOptions.passagesFields() != null) { - contentJson.addProperty("passages.fields", federatedQueryOptions.passagesFields()); + contentJson.addProperty("passages.fields", StringUtils.join(federatedQueryOptions.passagesFields(), ",")); } if (federatedQueryOptions.passagesCount() != null) { contentJson.addProperty("passages.count", federatedQueryOptions.passagesCount()); @@ -1083,16 +1084,17 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated contentJson.addProperty("deduplicate.field", federatedQueryOptions.deduplicateField()); } if (federatedQueryOptions.collectionIds() != null) { - contentJson.addProperty("collection_ids", federatedQueryOptions.collectionIds()); + contentJson.addProperty("collection_ids", StringUtils.join(federatedQueryOptions.collectionIds(), ",")); } if (federatedQueryOptions.similar() != null) { contentJson.addProperty("similar", federatedQueryOptions.similar()); } if (federatedQueryOptions.similarDocumentIds() != null) { - contentJson.addProperty("similar.document_ids", federatedQueryOptions.similarDocumentIds()); + contentJson.addProperty("similar.document_ids", StringUtils.join(federatedQueryOptions.similarDocumentIds(), + ",")); } if (federatedQueryOptions.similarFields() != null) { - contentJson.addProperty("similar.fields", federatedQueryOptions.similarFields()); + contentJson.addProperty("similar.fields", StringUtils.join(federatedQueryOptions.similarFields(), ",")); } if (federatedQueryOptions.bias() != null) { contentJson.addProperty("bias", federatedQueryOptions.bias()); @@ -1206,19 +1208,19 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("count", queryOptions.count()); } if (queryOptions.returnFields() != null) { - contentJson.addProperty("return", queryOptions.returnFields()); + contentJson.addProperty("return", StringUtils.join(queryOptions.returnFields(), ",")); } if (queryOptions.offset() != null) { contentJson.addProperty("offset", queryOptions.offset()); } if (queryOptions.sort() != null) { - contentJson.addProperty("sort", queryOptions.sort()); + contentJson.addProperty("sort", StringUtils.join(queryOptions.sort(), ",")); } if (queryOptions.highlight() != null) { contentJson.addProperty("highlight", queryOptions.highlight()); } if (queryOptions.passagesFields() != null) { - contentJson.addProperty("passages.fields", queryOptions.passagesFields()); + contentJson.addProperty("passages.fields", StringUtils.join(queryOptions.passagesFields(), ",")); } if (queryOptions.passagesCount() != null) { contentJson.addProperty("passages.count", queryOptions.passagesCount()); @@ -1233,16 +1235,16 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("deduplicate.field", queryOptions.deduplicateField()); } if (queryOptions.collectionIds() != null) { - contentJson.addProperty("collection_ids", queryOptions.collectionIds()); + contentJson.addProperty("collection_ids", StringUtils.join(queryOptions.collectionIds(), ",")); } if (queryOptions.similar() != null) { contentJson.addProperty("similar", queryOptions.similar()); } if (queryOptions.similarDocumentIds() != null) { - contentJson.addProperty("similar.document_ids", queryOptions.similarDocumentIds()); + contentJson.addProperty("similar.document_ids", StringUtils.join(queryOptions.similarDocumentIds(), ",")); } if (queryOptions.similarFields() != null) { - contentJson.addProperty("similar.fields", queryOptions.similarFields()); + contentJson.addProperty("similar.fields", StringUtils.join(queryOptions.similarFields(), ",")); } if (queryOptions.bias() != null) { contentJson.addProperty("bias", queryOptions.bias()); diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java index 9e92fb86370..932faf8ca0e 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CreateEnvironmentOptions.java @@ -121,6 +121,13 @@ public Builder size(String size) { this.size = size; return this; } + + /** + * @deprecated This method no longer has an effect on the created environment. Please use the String method. + */ + public Builder size(Long size) { + return this; + } } private CreateEnvironmentOptions(Builder builder) { diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java index d8fb4ee77d9..04ca5c099d7 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/CredentialDetails.java @@ -53,8 +53,6 @@ public interface CredentialType { public interface SourceVersion { /** online. */ String ONLINE = "online"; - /** 2016. */ - String 2016 = "2016"; } @SerializedName("credential_type") diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java index a0ce2d3246a..6e7a043f5fb 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/FederatedQueryOptions.java @@ -14,6 +14,10 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.Validator; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.List; /** * The federatedQuery options. @@ -119,6 +123,108 @@ public FederatedQueryOptions build() { return new FederatedQueryOptions(this); } + /** + * Adds an returnField to returnFields. + * + * @param returnField the new returnField + * @return the FederatedQueryOptions builder + * @deprecated returnFields is now of type String, so this method will be removed in the next major release + */ + public Builder addReturnField(String returnField) { + Validator.notNull(returnField, "returnField cannot be null"); + if (this.returnFields == null) { + this.returnFields = returnField; + } else { + this.returnFields += String.format(",%s", returnField); + } + return this; + } + + /** + * Adds an sort to sort. + * + * @param sort the new sort + * @return the FederatedQueryOptions builder + * @deprecated sort is now of type String, so this method will be removed in the next major release + */ + public Builder addSort(String sort) { + Validator.notNull(sort, "sort cannot be null"); + if (this.sort == null) { + this.sort = sort; + } else { + this.sort += String.format(",%s", sort); + } + return this; + } + + /** + * Adds an passagesFields to passagesFields. + * + * @param passagesFields the new passagesFields + * @return the FederatedQueryOptions builder + * @deprecated passagesFields is now of type String, so this method will be removed in the next major release + */ + public Builder addPassagesFields(String passagesFields) { + Validator.notNull(passagesFields, "passagesFields cannot be null"); + if (this.passagesFields == null) { + this.passagesFields = passagesFields; + } else { + this.passagesFields += String.format(",%s", passagesFields); + } + return this; + } + + /** + * Adds an collectionIds to collectionIds. + * + * @param collectionIds the new collectionIds + * @return the FederatedQueryOptions builder + * @deprecated collectionIds is now of type String, so this method will be removed in the next major release + */ + public Builder addCollectionIds(String collectionIds) { + Validator.notNull(collectionIds, "collectionIds cannot be null"); + if (this.collectionIds == null) { + this.collectionIds = collectionIds; + } else { + this.collectionIds += String.format(",%s", collectionIds); + } + return this; + } + + /** + * Adds an similarDocumentIds to similarDocumentIds. + * + * @param similarDocumentIds the new similarDocumentIds + * @return the FederatedQueryOptions builder + * @deprecated similarDocumentIds is now of type String, so this method will be removed in the next major release + */ + public Builder addSimilarDocumentIds(String similarDocumentIds) { + Validator.notNull(similarDocumentIds, "similarDocumentIds cannot be null"); + if (this.similarDocumentIds == null) { + this.similarDocumentIds = similarDocumentIds; + } else { + this.similarDocumentIds += String.format(",%s", similarDocumentIds); + } + return this; + } + + /** + * Adds an similarFields to similarFields. + * + * @param similarFields the new similarFields + * @return the FederatedQueryOptions builder + * @deprecated similarFields is now of type String, so this method will be removed in the next major release + */ + public Builder addSimilarFields(String similarFields) { + Validator.notNull(similarFields, "similarFields cannot be null"); + if (this.similarFields == null) { + this.similarFields = similarFields; + } else { + this.similarFields += String.format(",%s", similarFields); + } + return this; + } + /** * Set the environmentId. * @@ -207,6 +313,19 @@ public Builder returnFields(String returnFields) { return this; } + /** + * Set the returnFields. + * + * @param returnFields the returnFields + * @return the FederatedQueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder returnFields(List returnFields) { + this.returnFields = StringUtils.join(returnFields, ','); + return this; + } + /** * Set the offset. * @@ -229,6 +348,19 @@ public Builder sort(String sort) { return this; } + /** + * Set the sort. + * + * @param sort the sort + * @return the FederatedQueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder sort(List sort) { + this.sort = StringUtils.join(sort, ','); + return this; + } + /** * Set the highlight. * @@ -251,6 +383,19 @@ public Builder passagesFields(String passagesFields) { return this; } + /** + * Set the passagesFields. + * + * @param passagesFields the passagesFields + * @return the FederatedQueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder passagesFields(List passagesFields) { + this.passagesFields = StringUtils.join(passagesFields, ','); + return this; + } + /** * Set the passagesCount. * @@ -306,6 +451,19 @@ public Builder collectionIds(String collectionIds) { return this; } + /** + * Set the collectionIds. + * + * @param collectionIds the collectionIds + * @return the FederatedQueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder collectionIds(List collectionIds) { + this.collectionIds = StringUtils.join(collectionIds, ','); + return this; + } + /** * Set the similar. * @@ -328,6 +486,19 @@ public Builder similarDocumentIds(String similarDocumentIds) { return this; } + /** + * Set the similarDocumentIds. + * + * @param similarDocumentIds the similarDocumentIds + * @return the FederatedQueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder similarDocumentIds(List similarDocumentIds) { + this.similarDocumentIds = StringUtils.join(similarDocumentIds, ','); + return this; + } + /** * Set the similarFields. * @@ -339,6 +510,19 @@ public Builder similarFields(String similarFields) { return this; } + /** + * Set the similarFields. + * + * @param similarFields the similarFields + * @return the FederatedQueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder similarFields(List similarFields) { + this.similarFields = StringUtils.join(similarFields, ','); + return this; + } + /** * Set the bias. * @@ -485,9 +669,14 @@ public Long count() { * A comma-separated list of the portion of the document hierarchy to return. * * @return the returnFields + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String returnFields() { - return returnFields; + public List returnFields() { + if (returnFields != null) { + return Arrays.asList(returnFields.split(",")); + } else { + return null; + } } /** @@ -510,9 +699,14 @@ public Long offset() { * prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. * * @return the sort + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String sort() { - return sort; + public List sort() { + if (sort != null) { + return Arrays.asList(sort.split(",")); + } else { + return null; + } } /** @@ -534,9 +728,14 @@ public Boolean highlight() { * fields are included. * * @return the passagesFields + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String passagesFields() { - return passagesFields; + public List passagesFields() { + if (passagesFields != null) { + return Arrays.asList(passagesFields.split(",")); + } else { + return null; + } } /** @@ -595,9 +794,14 @@ public String deduplicateField() { * invalid when performing a single collection query. * * @return the collectionIds + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String collectionIds() { - return collectionIds; + public List collectionIds() { + if (collectionIds != null) { + return Arrays.asList(collectionIds.split(",")); + } else { + return null; + } } /** @@ -622,9 +826,14 @@ public Boolean similar() { * and reduce the scope. * * @return the similarDocumentIds + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String similarDocumentIds() { - return similarDocumentIds; + public List similarDocumentIds() { + if (similarDocumentIds != null) { + return Arrays.asList(similarDocumentIds.split(",")); + } else { + return null; + } } /** @@ -634,9 +843,14 @@ public String similarDocumentIds() { * specified, the entire document is used for comparison. * * @return the similarFields + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String similarFields() { - return similarFields; + public List similarFields() { + if (similarFields != null) { + return Arrays.asList(similarFields.split(",")); + } else { + return null; + } } /** diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java index 399b8e8f37f..ac719ff8d92 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/Field.java @@ -31,19 +31,19 @@ public interface FieldType { /** date. */ String DATE = "date"; /** long. */ - String XLONG = "long"; + String LONG = "long"; /** integer. */ String INTEGER = "integer"; /** short. */ - String XSHORT = "short"; + String SHORT = "short"; /** byte. */ - String XBYTE = "byte"; + String BYTE = "byte"; /** double. */ - String XDOUBLE = "double"; + String DOUBLE = "double"; /** float. */ - String XFLOAT = "float"; + String FLOAT = "float"; /** boolean. */ - String XBOOLEAN = "boolean"; + String BOOLEAN = "boolean"; /** binary. */ String BINARY = "binary"; } diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java index a3f0f1f1f81..ab40cc85239 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryAggregation.java @@ -14,12 +14,15 @@ import java.util.List; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.ibm.watson.developer_cloud.discovery.v1.query.AggregationDeserializer; import com.ibm.watson.developer_cloud.service.model.GenericModel; /** * An aggregation produced by the Discovery service to analyze the input provided. */ +@JsonAdapter(AggregationDeserializer.class) public class QueryAggregation extends GenericModel { private String type; diff --git a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java index 7afb688779c..58877e2a520 100644 --- a/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/QueryOptions.java @@ -14,6 +14,10 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.Validator; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.List; /** * The query options. @@ -124,6 +128,108 @@ public QueryOptions build() { return new QueryOptions(this); } + /** + * Adds an returnField to returnFields. + * + * @param returnField the new returnField + * @return the QueryOptions builder + * @deprecated returnFields is now of type String, so this method will be removed in the next major release + */ + public Builder addReturnField(String returnField) { + Validator.notNull(returnField, "returnField cannot be null"); + if (this.returnFields == null) { + this.returnFields = returnField; + } else { + this.returnFields += String.format(",%s", returnField); + } + return this; + } + + /** + * Adds an sort to sort. + * + * @param sort the new sort + * @return the QueryOptions builder + * @deprecated sort is now of type String, so this method will be removed in the next major release + */ + public Builder addSort(String sort) { + Validator.notNull(sort, "sort cannot be null"); + if (this.sort == null) { + this.sort = sort; + } else { + this.sort += String.format(",%s", sort); + } + return this; + } + + /** + * Adds an passagesFields to passagesFields. + * + * @param passagesFields the new passagesFields + * @return the QueryOptions builder + * @deprecated passagesFields is now of type String, so this method will be removed in the next major release + */ + public Builder addPassagesFields(String passagesFields) { + Validator.notNull(passagesFields, "passagesFields cannot be null"); + if (this.passagesFields == null) { + this.passagesFields = passagesFields; + } else { + this.passagesFields += String.format(",%s", passagesFields); + } + return this; + } + + /** + * Adds an collectionIds to collectionIds. + * + * @param collectionIds the new collectionIds + * @return the QueryOptions builder + * @deprecated collectionIds is now of type String, so this method will be removed in the next major release + */ + public Builder addCollectionIds(String collectionIds) { + Validator.notNull(collectionIds, "collectionIds cannot be null"); + if (this.collectionIds == null) { + this.collectionIds = collectionIds; + } else { + this.collectionIds += String.format(",%s", collectionIds); + } + return this; + } + + /** + * Adds an similarDocumentIds to similarDocumentIds. + * + * @param similarDocumentIds the new similarDocumentIds + * @return the QueryOptions builder + * @deprecated similarDocumentIds is now of type String, so this method will be removed in the next major release + */ + public Builder addSimilarDocumentIds(String similarDocumentIds) { + Validator.notNull(similarDocumentIds, "similarDocumentIds cannot be null"); + if (this.similarDocumentIds == null) { + this.similarDocumentIds = similarDocumentIds; + } else { + this.similarDocumentIds += String.format(",%s", similarDocumentIds); + } + return this; + } + + /** + * Adds an similarFields to similarFields. + * + * @param similarFields the new similarFields + * @return the QueryOptions builder + * @deprecated similarFields is now of type String, so this method will be removed in the next major release + */ + public Builder addSimilarFields(String similarFields) { + Validator.notNull(similarFields, "similarFields cannot be null"); + if (this.similarFields == null) { + this.similarFields = similarFields; + } else { + this.similarFields += String.format(",%s", similarFields); + } + return this; + } + /** * Set the environmentId. * @@ -223,6 +329,19 @@ public Builder returnFields(String returnFields) { return this; } + /** + * Set the returnFields. + * + * @param returnFields the returnFields + * @return the QueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder returnFields(List returnFields) { + this.returnFields = StringUtils.join(returnFields, ','); + return this; + } + /** * Set the offset. * @@ -245,6 +364,19 @@ public Builder sort(String sort) { return this; } + /** + * Set the sort. + * + * @param sort the sort + * @return the QueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder sort(List sort) { + this.sort = StringUtils.join(sort, ','); + return this; + } + /** * Set the highlight. * @@ -267,6 +399,19 @@ public Builder passagesFields(String passagesFields) { return this; } + /** + * Set the passagesFields. + * + * @param passagesFields the passagesFields + * @return the QueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder passagesFields(List passagesFields) { + this.passagesFields = StringUtils.join(passagesFields, ','); + return this; + } + /** * Set the passagesCount. * @@ -322,6 +467,19 @@ public Builder collectionIds(String collectionIds) { return this; } + /** + * Set the collectionIds. + * + * @param collectionIds the collectionIds + * @return the QueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder collectionIds(List collectionIds) { + this.collectionIds = StringUtils.join(collectionIds, ','); + return this; + } + /** * Set the similar. * @@ -344,6 +502,19 @@ public Builder similarDocumentIds(String similarDocumentIds) { return this; } + /** + * Set the similarDocumentIds. + * + * @param similarDocumentIds the similarDocumentIds + * @return the QueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder similarDocumentIds(List similarDocumentIds) { + this.similarDocumentIds = StringUtils.join(similarDocumentIds, ','); + return this; + } + /** * Set the similarFields. * @@ -355,6 +526,19 @@ public Builder similarFields(String similarFields) { return this; } + /** + * Set the similarFields. + * + * @param similarFields the similarFields + * @return the QueryOptions builder + * @deprecated This parameter is now officially of type String. Please set this as a comma-separated String with + * the other setter. + */ + public Builder similarFields(List similarFields) { + this.similarFields = StringUtils.join(similarFields, ','); + return this; + } + /** * Set the bias. * @@ -514,9 +698,14 @@ public Long count() { * A comma-separated list of the portion of the document hierarchy to return. * * @return the returnFields + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String returnFields() { - return returnFields; + public List returnFields() { + if (returnFields != null) { + return Arrays.asList(returnFields.split(",")); + } else { + return null; + } } /** @@ -539,9 +728,14 @@ public Long offset() { * prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. * * @return the sort + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String sort() { - return sort; + public List sort() { + if (sort != null) { + return Arrays.asList(sort.split(",")); + } else { + return null; + } } /** @@ -563,9 +757,14 @@ public Boolean highlight() { * fields are included. * * @return the passagesFields + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String passagesFields() { - return passagesFields; + public List passagesFields() { + if (passagesFields != null) { + return Arrays.asList(passagesFields.split(",")); + } else { + return null; + } } /** @@ -624,9 +823,14 @@ public String deduplicateField() { * invalid when performing a single collection query. * * @return the collectionIds + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String collectionIds() { - return collectionIds; + public List collectionIds() { + if (collectionIds != null) { + return Arrays.asList(collectionIds.split(",")); + } else { + return null; + } } /** @@ -651,9 +855,14 @@ public Boolean similar() { * and reduce the scope. * * @return the similarDocumentIds + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String similarDocumentIds() { - return similarDocumentIds; + public List similarDocumentIds() { + if (similarDocumentIds != null) { + return Arrays.asList(similarDocumentIds.split(",")); + } else { + return null; + } } /** @@ -663,9 +872,14 @@ public String similarDocumentIds() { * specified, the entire document is used for comparison. * * @return the similarFields + * @deprecated This parameter is now officially of type String and will be returned as such in the next major release. */ - public String similarFields() { - return similarFields; + public List similarFields() { + if (similarFields != null) { + return Arrays.asList(similarFields.split(",")); + } else { + return null; + } } /** From 5d4ee8215380a67dfbcbca0ba89873d51e378af1 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 12:17:31 -0500 Subject: [PATCH 11/26] test(Discovery): Add tests for new method --- .../discovery/v1/DiscoveryServiceIT.java | 22 +++++-------- .../discovery/v1/DiscoveryServiceTest.java | 33 +++++++++++++++++++ .../token_dict_status_resp_stopwords.json | 4 +++ 3 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 discovery/src/test/resources/discovery/token_dict_status_resp_stopwords.json diff --git a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java index b6cb067e6fa..ef2a0cc2298 100644 --- a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java @@ -66,6 +66,7 @@ import com.ibm.watson.developer_cloud.discovery.v1.model.GetDocumentStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetEnvironmentOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetGatewayOptions; +import com.ibm.watson.developer_cloud.discovery.v1.model.GetStopwordListStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTokenizationDictionaryStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTrainingDataOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTrainingExampleOptions; @@ -1048,20 +1049,6 @@ public void queryWithOffsetIsSuccessful() { assertEquals(5, queryResponse.getResults().size()); } - @Test - public void queryWithReturnFieldsIsSuccessful() { - String collectionId = setupTestDocuments(); - createTestDocument("{\"field_2\":\"value_2\"}", collectionId); - - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - List fieldNames = new ArrayList<>(); - fieldNames.add("field"); - queryBuilder.returnFields(fieldNames); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute(); - String[] expected = new String[] { "id", "result_metadata", "field" }; - assertTrue(queryResponse.getResults().get(0).keySet().containsAll(Arrays.asList(expected))); - } - @Ignore @Test public void queryWithQueryIsSuccessful() { @@ -1989,6 +1976,13 @@ public void stopwordListOperationsAreSuccessful() throws FileNotFoundException, TokenDictStatusResponse createResponse = discovery.createStopwordList(createStopwordListOptions).execute(); assertEquals("stopwords", createResponse.getType()); + GetStopwordListStatusOptions getStopwordListStatusOptions = new GetStopwordListStatusOptions.Builder() + .environmentId(environmentId) + .collectionId(testCollectionId) + .build(); + TokenDictStatusResponse getResponse = discovery.getStopwordListStatus(getStopwordListStatusOptions).execute(); + assertEquals("stopwords", getResponse.getType()); + DeleteStopwordListOptions deleteStopwordListOptions = new DeleteStopwordListOptions.Builder() .environmentId(environmentId) .collectionId(testCollectionId) diff --git a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java index 0e671077d61..c83c4a1b4ea 100644 --- a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java +++ b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java @@ -72,6 +72,7 @@ import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsQueryNoResultsOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsQueryOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetMetricsQueryTokenEventOptions; +import com.ibm.watson.developer_cloud.discovery.v1.model.GetStopwordListStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTokenizationDictionaryStatusOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTrainingDataOptions; import com.ibm.watson.developer_cloud.discovery.v1.model.GetTrainingExampleOptions; @@ -272,6 +273,7 @@ public class DiscoveryServiceTest extends WatsonServiceUnitTest { private MetricTokenResponse metricTokenResp; private LogQueryResponse logQueryResp; private TokenDictStatusResponse tokenDictStatusResponse; + private TokenDictStatusResponse tokenDictStatusResponseStopwords; private Gateway gatewayResponse; private GatewayList listGatewaysResponse; @@ -335,6 +337,8 @@ public void setup() throws Exception { metricTokenResp = loadFixture(RESOURCE + "metric_token_resp.json", MetricTokenResponse.class); logQueryResp = loadFixture(RESOURCE + "log_query_resp.json", LogQueryResponse.class); tokenDictStatusResponse = loadFixture(RESOURCE + "token_dict_status_resp.json", TokenDictStatusResponse.class); + tokenDictStatusResponseStopwords = loadFixture(RESOURCE + "token_dict_status_resp_stopwords.json", + TokenDictStatusResponse.class); gatewayResponse = loadFixture(RESOURCE + "gateway_resp.json", Gateway.class); listGatewaysResponse = loadFixture(RESOURCE + "list_gateways_resp.json", GatewayList.class); } @@ -1740,6 +1744,35 @@ public void testDeleteStopwordList() throws InterruptedException { assertEquals(DELETE, request.getMethod()); } + @Test + public void testGetStopwordListStatusOptions() { + GetStopwordListStatusOptions getStopwordListStatusOptions = new GetStopwordListStatusOptions.Builder() + .environmentId(environmentId) + .collectionId(collectionId) + .build(); + + assertEquals(environmentId, getStopwordListStatusOptions.environmentId()); + assertEquals(collectionId, getStopwordListStatusOptions.collectionId()); + } + + @Test + public void testGetStopwordListStatus() throws InterruptedException { + server.enqueue(jsonResponse(tokenDictStatusResponseStopwords)); + + String type = "stopwords"; + + GetStopwordListStatusOptions getStopwordListStatusOptions = new GetStopwordListStatusOptions.Builder() + .environmentId(environmentId) + .collectionId(collectionId) + .build(); + TokenDictStatusResponse response = discoveryService.getStopwordListStatus(getStopwordListStatusOptions).execute(); + RecordedRequest request = server.takeRequest(); + + assertEquals(GET, request.getMethod()); + assertEquals(TokenDictStatusResponse.Status.ACTIVE, response.getStatus()); + assertEquals(type, response.getType()); + } + @Test public void testCreateGatewayOptions() { String name = "name"; diff --git a/discovery/src/test/resources/discovery/token_dict_status_resp_stopwords.json b/discovery/src/test/resources/discovery/token_dict_status_resp_stopwords.json new file mode 100644 index 00000000000..1d08a5d7605 --- /dev/null +++ b/discovery/src/test/resources/discovery/token_dict_status_resp_stopwords.json @@ -0,0 +1,4 @@ +{ + "status" : "active", + "type" : "stopwords" +} \ No newline at end of file From df4031f0343f5b392be853b597b6b10bf58e9d46 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 12:19:52 -0500 Subject: [PATCH 12/26] docs(Natural Language Classifier): Update code comments --- .../v1/model/CreateClassifierOptions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/model/CreateClassifierOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/model/CreateClassifierOptions.java index da1909a4cc2..4d0eba3c984 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/model/CreateClassifierOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/model/CreateClassifierOptions.java @@ -194,7 +194,7 @@ public String metadataFilename() { * * Training data in CSV format. Each text value must have at least one class. The data can include up to 3,000 classes * and 20,000 records. For details, see [Data - * preparation](https://console.bluemix.net/docs/services/natural-language-classifier/using-your-data.html). + * preparation](https://cloud.ibm.com/docs/services/natural-language-classifier/using-your-data.html). * * @return the trainingData */ From 419d735df9459ea27700ea103b78a41836f358fc Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 13:46:55 -0500 Subject: [PATCH 13/26] docs(Natural Language Understanding): Update code comments --- .../v1/NaturalLanguageUnderstanding.java | 17 ++++++++--------- .../v1/model/AnalyzeOptions.java | 6 +++--- .../v1/model/CategoriesOptions.java | 1 - .../v1/model/CategoriesResult.java | 4 ++-- .../v1/model/ConceptsOptions.java | 2 +- .../v1/model/DeleteModelOptions.java | 2 +- .../v1/model/EntitiesOptions.java | 4 ++-- .../v1/model/Features.java | 4 ++-- .../v1/model/ListModelsResults.java | 2 +- .../v1/model/RelationsOptions.java | 5 ++--- 10 files changed, 22 insertions(+), 25 deletions(-) diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/NaturalLanguageUnderstanding.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/NaturalLanguageUnderstanding.java index b988d299c10..99f17d7a23e 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/NaturalLanguageUnderstanding.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/NaturalLanguageUnderstanding.java @@ -31,9 +31,8 @@ * Language Understanding will give you results for the features you request. The service cleans HTML content before * analysis by default, so the results can ignore most advertisements and other unwanted content. * - * You can create [custom models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing - * .html) with Watson Knowledge - * Studio to detect custom entities and relations in Natural Language Understanding. + * You can create [custom models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) + * with Watson Knowledge Studio to detect custom entities and relations in Natural Language Understanding. * * @version v1 * @see Natural Language @@ -172,9 +171,9 @@ public ServiceCall deleteModel(DeleteModelOptions deleteModelOptions) { /** * List models. * - * Lists Watson Knowledge Studio [custom models](https://cloud.ibm - * .com/docs/services/natural-language-understanding/customizing.html) that - * are deployed to your Natural Language Understanding service. + * Lists Watson Knowledge Studio [custom + * models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) that are deployed to + * your Natural Language Understanding service. * * @param listModelsOptions the {@link ListModelsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListModelsResults} @@ -193,9 +192,9 @@ public ServiceCall listModels(ListModelsOptions listModelsOpt /** * List models. * - * Lists Watson Knowledge Studio [custom models](https://cloud.ibm - * .com/docs/services/natural-language-understanding/customizing.html) that - * are deployed to your Natural Language Understanding service. + * Lists Watson Knowledge Studio [custom + * models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) that are deployed to + * your Natural Language Understanding service. * * @return a {@link ServiceCall} with a response type of {@link ListModelsResults} */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/AnalyzeOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/AnalyzeOptions.java index fbca4138782..f8a3d80a8f9 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/AnalyzeOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/AnalyzeOptions.java @@ -277,9 +277,9 @@ public Boolean clean() { /** * Gets the xpath. * - * An [XPath query](https://cloud.ibm.com/docs/services/natural-language-understanding/analyzing-webpages - * .html#xpath) to perform on `html` or `url` input. Results of the query will be appended to the cleaned webpage - * text before it is analyzed. To analyze only the results of the XPath query, set the `clean` parameter to `false`. + * An [XPath query](https://cloud.ibm.com/docs/services/natural-language-understanding/analyzing-webpages.html#xpath) + * to perform on `html` or `url` input. Results of the query will be appended to the cleaned webpage text before it is + * analyzed. To analyze only the results of the XPath query, set the `clean` parameter to `false`. * * @return the xpath */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesOptions.java index c67b1159175..f705991e0db 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesOptions.java @@ -31,7 +31,6 @@ public class CategoriesOptions extends DynamicModel { * Gets the limit. * * Maximum number of categories to return. - * Maximum value: **10**. * * @return the limit */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesResult.java index 3748dd261df..745c8a35454 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/CategoriesResult.java @@ -26,8 +26,8 @@ public class CategoriesResult extends GenericModel { * Gets the label. * * The path to the category through the 5-level taxonomy hierarchy. For the complete list of categories, see the - * [Categories hierarchy](https://cloud.ibm.com/docs/services/natural-language-understanding/categories - * .html#categories-hierarchy) + * [Categories + * hierarchy](https://cloud.ibm.com/docs/services/natural-language-understanding/categories.html#categories-hierarchy) * documentation. * * @return the label diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ConceptsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ConceptsOptions.java index b6781aab276..479dc84046a 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ConceptsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ConceptsOptions.java @@ -18,7 +18,7 @@ * Returns high-level concepts in the content. For example, a research paper about deep learning might return the * concept, "Artificial Intelligence" although the term is not mentioned. * - * Supported languages: English, French, German, Japanese, Korean, Portuguese, Spanish. + * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. */ public class ConceptsOptions extends GenericModel { diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/DeleteModelOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/DeleteModelOptions.java index 45d2ffa1ef8..039ae0046f1 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/DeleteModelOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/DeleteModelOptions.java @@ -85,7 +85,7 @@ public Builder newBuilder() { /** * Gets the modelId. * - * model_id of the model to delete. + * Model ID of the model to delete. * * @return the modelId */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/EntitiesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/EntitiesOptions.java index 0de74131892..be669496f73 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/EntitiesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/EntitiesOptions.java @@ -19,7 +19,7 @@ * subtypes](https://cloud.ibm.com/docs/services/natural-language-understanding/entity-types.html). * * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. - * Arabic, Chinese, and Dutch custom models are also supported. + * Arabic, Chinese, and Dutch are supported only through custom models. */ public class EntitiesOptions extends GenericModel { @@ -160,7 +160,7 @@ public Boolean mentions() { /** * Gets the model. * - * Enter a [custom model](https://www.bluemix.net/docs/services/natural-language-understanding/customizing.html) ID to + * Enter a [custom model](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) ID to * override the standard entity detection model. * * @return the model diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/Features.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/Features.java index 37cf6644c94..8a1c961b5a7 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/Features.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/Features.java @@ -199,7 +199,7 @@ public Builder newBuilder() { * Returns high-level concepts in the content. For example, a research paper about deep learning might return the * concept, "Artificial Intelligence" although the term is not mentioned. * - * Supported languages: English, French, German, Japanese, Korean, Portuguese, Spanish. + * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. * * @return the concepts */ @@ -229,7 +229,7 @@ public EmotionOptions emotion() { * subtypes](https://cloud.ibm.com/docs/services/natural-language-understanding/entity-types.html). * * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. - * Arabic, Chinese, and Dutch custom models are also supported. + * Arabic, Chinese, and Dutch are supported only through custom models. * * @return the entities */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ListModelsResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ListModelsResults.java index 26b023b9ced..7a0106682b5 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ListModelsResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/ListModelsResults.java @@ -17,7 +17,7 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; /** - * Models available for Relations and Entities features. + * Custom models that are available for entities and relations. */ public class ListModelsResults extends GenericModel { diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/RelationsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/RelationsOptions.java index b2cd3bf2184..46097bec4f7 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/RelationsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/RelationsOptions.java @@ -79,9 +79,8 @@ public Builder newBuilder() { /** * Gets the model. * - * Enter a [custom model](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) ID - * to override the default - * model. + * Enter a [custom model](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) ID to + * override the default model. * * @return the model */ From 1673bcf643e41642f69916f3e798a3ecf82948e0 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 13:47:59 -0500 Subject: [PATCH 14/26] docs(Personality Insights): Update code comments --- .../personality_insights/v3/PersonalityInsights.java | 8 ++++---- .../personality_insights/v3/model/ProfileOptions.java | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/PersonalityInsights.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/PersonalityInsights.java index 22566922275..5de3402e038 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/PersonalityInsights.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/PersonalityInsights.java @@ -119,8 +119,8 @@ public PersonalityInsights(String versionDate, IamOptions iamOptions) { * When specifying a content type of plain text or HTML, include the `charset` parameter to indicate the character * encoding of the input text; for example, `Content-Type: text/plain;charset=utf-8`. * - * **See also:** [Specifying request and response formats](https://cloud.ibm - * .com/docs/services/personality-insights/input.html#formats) + * **See also:** [Specifying request and response + * formats](https://cloud.ibm.com/docs/services/personality-insights/input.html#formats) * * ### Accept types * @@ -183,8 +183,8 @@ public ServiceCall profile(ProfileOptions profileOptions) { * When specifying a content type of plain text or HTML, include the `charset` parameter to indicate the character * encoding of the input text; for example, `Content-Type: text/plain;charset=utf-8`. * - * **See also:** [Specifying request and response formats](https://cloud.ibm - * .com/docs/services/personality-insights/input.html#formats) + * **See also:** [Specifying request and response + * formats](https://cloud.ibm.com/docs/services/personality-insights/input.html#formats) * * ### Accept types * diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ProfileOptions.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ProfileOptions.java index 407dedfde86..561c576e6e3 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ProfileOptions.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ProfileOptions.java @@ -236,9 +236,8 @@ public Builder newBuilder() { * Gets the content. * * A maximum of 20 MB of content to analyze, though the service requires much less text; for more information, see - * [Providing sufficient input](https://cloud.ibm.com/docs/services/personality-insights/input.html#sufficient). - * For JSON input, provide an - * object of type `Content`. + * [Providing sufficient input](https://cloud.ibm.com/docs/services/personality-insights/input.html#sufficient). For + * JSON input, provide an object of type `Content`. * * @return the content */ @@ -250,9 +249,8 @@ public Content content() { * Gets the body. * * A maximum of 20 MB of content to analyze, though the service requires much less text; for more information, see - * [Providing sufficient input](https://cloud.ibm.com/docs/services/personality-insights/input.html#sufficient). - * For JSON input, provide an - * object of type `Content`. + * [Providing sufficient input](https://cloud.ibm.com/docs/services/personality-insights/input.html#sufficient). For + * JSON input, provide an object of type `Content`. * * @return the body */ From fb6d4952415050f4048f8cfe9ccfc90c5790ed24 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 13:48:51 -0500 Subject: [PATCH 15/26] docs(Speech to Text): Update code comments --- .../speech_to_text/v1/model/TrainAcousticModelOptions.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/TrainAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/TrainAcousticModelOptions.java index 60809c70d88..06c0b666b46 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/TrainAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/TrainAcousticModelOptions.java @@ -114,7 +114,9 @@ public String customizationId() { * * The customization ID (GUID) of a custom language model that is to be used during training of the custom acoustic * model. Specify a custom language model that has been trained with verbatim transcriptions of the audio resources or - * that contains words that are relevant to the contents of the audio resources. + * that contains words that are relevant to the contents of the audio resources. The custom language model must be + * based on the same version of the same base model as the custom acoustic model. The credentials specified with the + * request must own both custom models. * * @return the customLanguageModelId */ From 0d07e4387f911f9983d6cecd4738ec9053f3d2ba Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 13:49:28 -0500 Subject: [PATCH 16/26] feat(Speech to Text): Add force parameter to UpdateAcousticModelOptions --- .../speech_to_text/v1/SpeechToText.java | 11 +++++-- .../v1/model/UpgradeAcousticModelOptions.java | 33 ++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToText.java index c0d36b83061..8d6e9699217 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToText.java @@ -1564,16 +1564,18 @@ public ServiceCall resetAcousticModel(ResetAcousticModelOptions resetAcous * existing request completes. * * You can use the optional `custom_language_model_id` parameter to specify the GUID of a separately created custom - * language model that is to be used during training. Specify a custom language model if you have verbatim + * language model that is to be used during training. Train with a custom language model if you have verbatim * transcriptions of the audio files that you have added to the custom model or you have either corpora (text files) - * or a list of words that are relevant to the contents of the audio files. For more information, see the **Create a - * custom language model** method. + * or a list of words that are relevant to the contents of the audio files. Both of the custom models must be based on + * the same version of the same base model for training to succeed. * * Training can fail to start for the following reasons: * * The service is currently handling another request for the custom model, such as another training request or a * request to add audio resources to the model. * * The custom model contains less than 10 minutes or more than 100 hours of audio data. * * One or more of the custom model's audio resources is invalid. + * * You passed an incompatible custom language model with the `custom_language_model_id` query parameter. Both custom + * models must be based on the same version of the same base model. * * **See also:** [Train the custom acoustic * model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#trainModel). @@ -1633,6 +1635,9 @@ public ServiceCall upgradeAcousticModel(UpgradeAcousticModelOptions upgrad if (upgradeAcousticModelOptions.customLanguageModelId() != null) { builder.query("custom_language_model_id", upgradeAcousticModelOptions.customLanguageModelId()); } + if (upgradeAcousticModelOptions.force() != null) { + builder.query("force", String.valueOf(upgradeAcousticModelOptions.force())); + } return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); } diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/UpgradeAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/UpgradeAcousticModelOptions.java index 40ff4b29114..803425639b7 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/UpgradeAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/UpgradeAcousticModelOptions.java @@ -22,6 +22,7 @@ public class UpgradeAcousticModelOptions extends GenericModel { private String customizationId; private String customLanguageModelId; + private Boolean force; /** * Builder. @@ -29,10 +30,12 @@ public class UpgradeAcousticModelOptions extends GenericModel { public static class Builder { private String customizationId; private String customLanguageModelId; + private Boolean force; private Builder(UpgradeAcousticModelOptions upgradeAcousticModelOptions) { customizationId = upgradeAcousticModelOptions.customizationId; customLanguageModelId = upgradeAcousticModelOptions.customLanguageModelId; + force = upgradeAcousticModelOptions.force; } /** @@ -80,12 +83,24 @@ public Builder customLanguageModelId(String customLanguageModelId) { this.customLanguageModelId = customLanguageModelId; return this; } + + /** + * Set the force. + * + * @param force the force + * @return the UpgradeAcousticModelOptions builder + */ + public Builder force(Boolean force) { + this.force = force; + return this; + } } private UpgradeAcousticModelOptions(Builder builder) { Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); customizationId = builder.customizationId; customLanguageModelId = builder.customLanguageModelId; + force = builder.force; } /** @@ -113,11 +128,27 @@ public String customizationId() { * Gets the customLanguageModelId. * * If the custom acoustic model was trained with a custom language model, the customization ID (GUID) of that custom - * language model. The custom language model must be upgraded before the custom acoustic model can be upgraded. + * language model. The custom language model must be upgraded before the custom acoustic model can be upgraded. The + * credentials specified with the request must own both custom models. * * @return the customLanguageModelId */ public String customLanguageModelId() { return customLanguageModelId; } + + /** + * Gets the force. + * + * If `true`, forces the upgrade of a custom acoustic model for which no input data has been modified since it was + * last trained. Use this parameter only to force the upgrade of a custom acoustic model that is trained with a custom + * language model, and only if you receive a 400 response code and the message `No input data modified since last + * training`. See [Upgrading a custom acoustic + * model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeAcoustic). + * + * @return the force + */ + public Boolean force() { + return force; + } } From ee831b58f30d2e79f4caf2f6826757388a938f0e Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 13:55:21 -0500 Subject: [PATCH 17/26] style(Text to Speech): Add changes from automated linter --- .../v1/websocket/BaseSynthesizeCallback.java | 18 ++++++++++++------ .../v1/websocket/SynthesizeCallback.java | 2 +- .../TextToSpeechWebSocketListener.java | 1 - 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/BaseSynthesizeCallback.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/BaseSynthesizeCallback.java index d675ca07b50..e17b86381f0 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/BaseSynthesizeCallback.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/BaseSynthesizeCallback.java @@ -13,7 +13,8 @@ public class BaseSynthesizeCallback implements SynthesizeCallback { * (non-Javadoc) * @see com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback#onConnected() */ - public void onConnected() { } + public void onConnected() { + } /* * (non-Javadoc) @@ -40,33 +41,38 @@ public void onWarning(Exception e) { * @see * com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback#onDisconnected() */ - public void onDisconnected() { } + public void onDisconnected() { + } /* * (non-Javadoc) * @see com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback#onContentType() */ @Override - public void onContentType(String contentType) { } + public void onContentType(String contentType) { + } /* * (non-Javadoc) * @see com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback#onTimings() */ @Override - public void onTimings(Timings timings) { } + public void onTimings(Timings timings) { + } /* * (non-Javadoc) * @see com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback#onMarks() */ @Override - public void onMarks(Marks marks) { } + public void onMarks(Marks marks) { + } /* * (non-Javadoc) * @see com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback#onAudioStream() */ @Override - public void onAudioStream(byte[] bytes) { } + public void onAudioStream(byte[] bytes) { + } } diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/SynthesizeCallback.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/SynthesizeCallback.java index 5d3d80e2040..db559f71ee6 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/SynthesizeCallback.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/SynthesizeCallback.java @@ -54,7 +54,7 @@ public interface SynthesizeCallback { * a result of synthesis. * * @param bytes array of bytes in the specified audio format or the default - * (audio/ogg;codecs=opus) + * (audio/ogg;codecs=opus) */ void onAudioStream(byte[] bytes); } diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/TextToSpeechWebSocketListener.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/TextToSpeechWebSocketListener.java index 6cc44367f2e..59ea025dd0b 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/TextToSpeechWebSocketListener.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/websocket/TextToSpeechWebSocketListener.java @@ -35,7 +35,6 @@ public class TextToSpeechWebSocketListener extends WebSocketListener { private static final String WORDS = "words"; private static final String MARKS = "marks"; - private final SynthesizeOptions options; private final SynthesizeCallback callback; private WebSocket socket; From 320c3192e2de95844cb37ef5b358e6aa20164f3f Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 13:59:50 -0500 Subject: [PATCH 18/26] chore(Text to Speech): Apply manual changes --- .../text_to_speech/v1/TextToSpeech.java | 30 ----------------- .../v1/model/SynthesizeOptions.java | 33 ------------------- 2 files changed, 63 deletions(-) diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java index 1772146a7d4..cb1fcb47076 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java @@ -39,16 +39,9 @@ import com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModels; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Voices; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Words; -import com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback; -import com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; import com.ibm.watson.developer_cloud.util.Validator; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.WebSocket; - import java.io.InputStream; /** @@ -272,29 +265,6 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream()); } - public WebSocket synthesizeUsingWebSocket(SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { - Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null"); - Validator.notNull(callback, "callback cannot be null"); - - HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/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/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java index f1cd252f36c..402f27e8eab 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java @@ -15,8 +15,6 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.Validator; -import java.util.List; - /** * The synthesize options. */ @@ -96,7 +94,6 @@ public interface Voice { private String accept; private String voice; private String customizationId; - private List timings; /** * Builder. @@ -106,14 +103,12 @@ public static class Builder { private String accept; private String voice; private String customizationId; - private List timings; private Builder(SynthesizeOptions synthesizeOptions) { text = synthesizeOptions.text; accept = synthesizeOptions.accept; voice = synthesizeOptions.voice; customizationId = synthesizeOptions.customizationId; - timings = synthesizeOptions.timings; } /** @@ -183,17 +178,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; - } } private SynthesizeOptions(Builder builder) { @@ -202,7 +186,6 @@ private SynthesizeOptions(Builder builder) { accept = builder.accept; voice = builder.voice; customizationId = builder.customizationId; - timings = builder.timings; } /** @@ -264,20 +247,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 timings() { - return timings; - } } From d8f34a7fc2ca6a3dd05f6913510d987182693871 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 14:07:28 -0500 Subject: [PATCH 19/26] chore(Visual Recognition): Add code directly from generator --- .../v3/VisualRecognition.java | 85 +++---------------- .../v3/model/ClassResult.java | 5 ++ .../v3/model/Classifier.java | 9 +- .../v3/model/ClassifyOptions.java | 69 ++++----------- .../v3/model/CreateClassifierOptions.java | 15 ---- .../v3/model/DetectFacesOptions.java | 36 +------- .../v3/model/UpdateClassifierOptions.java | 15 ---- 7 files changed, 43 insertions(+), 191 deletions(-) diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java index 4dccfd5e489..291274ae550 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java @@ -32,12 +32,10 @@ import com.ibm.watson.developer_cloud.visual_recognition.v3.model.GetCoreMlModelOptions; import com.ibm.watson.developer_cloud.visual_recognition.v3.model.ListClassifiersOptions; import com.ibm.watson.developer_cloud.visual_recognition.v3.model.UpdateClassifierOptions; +import java.io.InputStream; import okhttp3.MultipartBody; import okhttp3.RequestBody; -import java.io.InputStream; -import java.util.Map; - /** * The IBM Watson™ Visual Recognition service uses deep learning algorithms to identify scenes, objects, and faces * in images you upload to the service. You can create and train a custom classifier to identify subjects that suit @@ -70,52 +68,6 @@ public VisualRecognition(String versionDate) { this.versionDate = versionDate; } - /** - * Instantiates a new `VisualRecognition` with API Key. - * - * @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 apiKey the API Key - * @deprecated This form of authentication is deprecated and will be removed in the next major release. Please - * authenticate using IAM credentials, using either the (String, IamOptions) constructor or with the - * setIamCredentials() method. - */ - public VisualRecognition(String versionDate, String apiKey) { - this(versionDate); - setApiKey(apiKey); - } - - /* - * (non-Javadoc) - */ - @Override - protected void setAuthentication(okhttp3.Request.Builder builder) { - if ((getUsername() != null && getPassword() != null) || isTokenManagerSet()) { - super.setAuthentication(builder); - } else if (getApiKey() != null) { - addApiKeyQueryParameter(builder, getApiKey()); - } else { - throw new IllegalArgumentException( - "Credentials need to be specified. Use setApiKey(), setIamCredentials(), or setUsernameAndPassword()."); - } - } - - /** - * Adds the API key as a query parameter to the request URL. - * - * @param builder builder for the current request - * @param apiKey API key to be added - */ - private void addApiKeyQueryParameter(okhttp3.Request.Builder builder, String apiKey) { - final okhttp3.HttpUrl url = okhttp3.HttpUrl.parse(builder.build().url().toString()); - - if ((url.query() == null) || url.query().isEmpty()) { - builder.url(builder.build().url() + "?api_key=" + apiKey); - } else { - builder.url(builder.build().url() + "&api_key=" + apiKey); - } - } - /** * Instantiates a new `VisualRecognition` with IAM. Note that if the access token is specified in the * iamOptions, you accept responsibility for managing the access token yourself. You must set a new access token @@ -142,13 +94,9 @@ public VisualRecognition(String versionDate, IamOptions iamOptions) { */ public ServiceCall classify(ClassifyOptions classifyOptions) { Validator.notNull(classifyOptions, "classifyOptions cannot be null"); - Validator.isTrue((classifyOptions.imagesFile() != null) - || (classifyOptions.url() != null) - || (classifyOptions.threshold() != null) - || (classifyOptions.owners() != null) - || (classifyOptions.classifierIds() != null) - || (classifyOptions.parameters() != null), - "At least one of imagesFile, url, threshold, owners, classifierIds, or parameters must be supplied."); + Validator.isTrue((classifyOptions.imagesFile() != null) || (classifyOptions.url() != null) || (classifyOptions + .threshold() != null) || (classifyOptions.owners() != null) || (classifyOptions.classifierIds() != null), + "At least one of imagesFile, url, threshold, owners, or classifierIds must be supplied."); String[] pathSegments = { "v3/classify" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query(VERSION, versionDate); @@ -164,9 +112,6 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { .imagesFileContentType()); multipartBuilder.addFormDataPart("images_file", classifyOptions.imagesFilename(), imagesFileBody); } - if (classifyOptions.parameters() != null) { - multipartBuilder.addFormDataPart("parameters", classifyOptions.parameters()); - } if (classifyOptions.url() != null) { multipartBuilder.addFormDataPart("url", classifyOptions.url()); } @@ -207,17 +152,16 @@ public ServiceCall classify() { * recognition. * * Supported image formats include .gif, .jpg, .png, and .tif. The maximum image size is 10 MB. The minimum - * recommended pixel density is 32X32 pixels per inch. + * recommended pixel density is 32X32 pixels, but the service tends to perform better with images that are at least + * 224 x 224 pixels. * * @param detectFacesOptions the {@link DetectFacesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DetectedFaces} */ public ServiceCall detectFaces(DetectFacesOptions detectFacesOptions) { Validator.notNull(detectFacesOptions, "detectFacesOptions cannot be null"); - Validator.isTrue((detectFacesOptions.imagesFile() != null) - || (detectFacesOptions.url() != null) - || (detectFacesOptions.parameters() != null), - "At least one of imagesFile, url, or parameters must be supplied."); + Validator.isTrue((detectFacesOptions.imagesFile() != null) || (detectFacesOptions.url() != null), + "At least one of imagesFile or url must be supplied."); String[] pathSegments = { "v3/detect_faces" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query(VERSION, versionDate); @@ -233,9 +177,6 @@ public ServiceCall detectFaces(DetectFacesOptions detectFacesOpti .imagesFileContentType()); multipartBuilder.addFormDataPart("images_file", detectFacesOptions.imagesFilename(), imagesFileBody); } - if (detectFacesOptions.parameters() != null) { - multipartBuilder.addFormDataPart("parameters", detectFacesOptions.parameters()); - } if (detectFacesOptions.url() != null) { multipartBuilder.addFormDataPart("url", detectFacesOptions.url()); } @@ -256,7 +197,8 @@ public ServiceCall detectFaces(DetectFacesOptions detectFacesOpti * recognition. * * Supported image formats include .gif, .jpg, .png, and .tif. The maximum image size is 10 MB. The minimum - * recommended pixel density is 32X32 pixels per inch. + * recommended pixel density is 32X32 pixels, but the service tends to perform better with images that are at least + * 224 x 224 pixels. * * @return a {@link ServiceCall} with a response type of {@link DetectedFaces} */ @@ -374,9 +316,8 @@ public ServiceCall listClassifiers() { /** * Update a classifier. * - * Update a custom classifier by adding new positive or negative classes (examples) or by adding new images to - * existing classes. You must supply at least one set of positive or negative examples. For details, see [Updating - * custom + * Update a custom classifier by adding new positive or negative classes or by adding new images to existing classes. + * You must supply at least one set of positive or negative examples. For details, see [Updating custom * classifiers](https://cloud.ibm.com/docs/services/visual-recognition/customizing.html#updating-custom-classifiers). * * Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image file names, and classifier and class @@ -439,7 +380,7 @@ public ServiceCall getCoreMlModel(GetCoreMlModelOptions getCoreMlMo builder.query(VERSION, versionDate); builder.header("X-IBMCloud-SDK-Analytics", "service_name=watson_vision_combined;service_version=v3;operation_id=getCoreMlModel"); - return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream()); + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(InputStream.class)); } /** diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java index 6e5bf4f9200..fbcd7a2dbf9 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java @@ -31,6 +31,11 @@ public class ClassResult extends GenericModel { * * Name of the class. * + * Class names are translated in the language defined by the **Accept-Language** request header for the build-in + * classifier IDs (`default`, `food`, and `explicit`). Class names of custom classifiers are not translated. The + * response might not be in the specified language when the requested language is not supported or when there is no + * translation for the class name. + * * @return the className */ public String getClassName() { diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Classifier.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Classifier.java index 4b1e234ae13..ae7fbbc3d74 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Classifier.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Classifier.java @@ -75,8 +75,7 @@ public String getName() { /** * Gets the owner. * - * Unique ID of the account who owns the classifier. Returned when verbose=`true`. Might not be returned by some - * requests. + * Unique ID of the account who owns the classifier. Might not be returned by some requests. * * @return the owner */ @@ -142,8 +141,8 @@ public List getClasses() { /** * Gets the retrained. * - * Date and time in Coordinated Universal Time (UTC) that the classifier was updated. Returned when verbose=`true`. - * Might not be returned by some requests. Identical to `updated` and retained for backward compatibility. + * Date and time in Coordinated Universal Time (UTC) that the classifier was updated. Might not be returned by some + * requests. Identical to `updated` and retained for backward compatibility. * * @return the retrained */ @@ -155,7 +154,7 @@ public Date getRetrained() { * Gets the updated. * * Date and time in Coordinated Universal Time (UTC) that the classifier was most recently updated. The field matches - * either `retrained` or `created`. Returned when verbose=`true`. Might not be returned by some requests. + * either `retrained` or `created`. Might not be returned by some requests. * * @return the updated */ diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java index c1ed490c7f0..73bc00efeea 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java @@ -28,11 +28,7 @@ public class ClassifyOptions extends GenericModel { /** - * The language of the output class names. The full set of languages is supported for the built-in classifier IDs: - * `default`, `food`, and `explicit`. The class names of custom classifiers are not translated. - * - * The response might not be in the specified language when the requested language is not supported or when there is - * no translation for the class name. + * The desired language of parts of the response. See the response for details. */ public interface AcceptLanguage { /** en. */ @@ -67,8 +63,6 @@ public interface AcceptLanguage { private List owners; private List classifierIds; private String imagesFileContentType; - @Deprecated - private String parameters; /** * Builder. @@ -82,8 +76,6 @@ public static class Builder { private List owners; private List classifierIds; private String imagesFileContentType; - @Deprecated - private String parameters; private Builder(ClassifyOptions classifyOptions) { imagesFile = classifyOptions.imagesFile; @@ -94,7 +86,6 @@ private Builder(ClassifyOptions classifyOptions) { owners = classifyOptions.owners; classifierIds = classifyOptions.classifierIds; imagesFileContentType = classifyOptions.imagesFileContentType; - parameters = classifyOptions.parameters; } /** @@ -245,18 +236,6 @@ public Builder imagesFile(File imagesFile) throws FileNotFoundException { this.imagesFilename = imagesFile.getName(); return this; } - - /** - * Set the parameters. - * - * @param parameters the parameters - * @return the ClassifyOptions builder - * @deprecated replaced by the top-level parameters url, threshold, owners, and classifierIds - */ - public Builder parameters(String parameters) { - this.parameters = parameters; - return this; - } } private ClassifyOptions(Builder builder) { @@ -268,7 +247,6 @@ private ClassifyOptions(Builder builder) { owners = builder.owners; classifierIds = builder.classifierIds; imagesFileContentType = builder.imagesFileContentType; - parameters = builder.parameters; } /** @@ -283,9 +261,9 @@ public Builder newBuilder() { /** * Gets the imagesFile. * - * An image file (.jpg, .png) or .zip file with images. Maximum image size is 10 MB. Include no more than 20 images - * and limit the .zip file to 100 MB. Encode the image and .zip file names in UTF-8 if they contain non-ASCII - * characters. The service assumes UTF-8 encoding if it encounters non-ASCII characters. + * An image file (.gif, .jpg, .png, .tif) or .zip file with images. Maximum image size is 10 MB. Include no more than + * 20 images and limit the .zip file to 100 MB. Encode the image and .zip file names in UTF-8 if they contain + * non-ASCII characters. The service assumes UTF-8 encoding if it encounters non-ASCII characters. * * You can also include an image with the **url** parameter. * @@ -309,11 +287,7 @@ public String imagesFilename() { /** * Gets the acceptLanguage. * - * The language of the output class names. The full set of languages is supported for the built-in classifier IDs: - * `default`, `food`, and `explicit`. The class names of custom classifiers are not translated. - * - * The response might not be in the specified language when the requested language is not supported or when there is - * no translation for the class name. + * The desired language of parts of the response. See the response for details. * * @return the acceptLanguage */ @@ -324,8 +298,9 @@ public String acceptLanguage() { /** * Gets the url. * - * The URL of an image to analyze. Must be in .jpg, or .png format. The minimum recommended pixel density is 32X32 - * pixels per inch, and the maximum image size is 10 MB. + * The URL of an image (.gif, .jpg, .png, .tif) to analyze. The minimum recommended pixel density is 32X32 pixels, but + * the service tends to perform better with images that are at least 224 x 224 pixels. The maximum image size is 10 + * MB. * * You can also include images with the **images_file** parameter. * @@ -338,8 +313,8 @@ public String url() { /** * Gets the threshold. * - * The minimum score a class must have to be displayed in the response. Set the threshold to `0.0` to ignore the - * classification score and return all values. + * The minimum score a class must have to be displayed in the response. Set the threshold to `0.0` to return all + * identified classes. * * @return the threshold */ @@ -350,13 +325,13 @@ public Float threshold() { /** * Gets the owners. * - * The categories of classifiers to apply. Use `IBM` to classify against the `default` general classifier, and use - * `me` to classify against your custom classifiers. To analyze the image against both classifier categories, set the - * value to both `IBM` and `me`. - * - * The built-in `default` classifier is used if both **classifier_ids** and **owners** parameters are empty. - * - * The **classifier_ids** parameter overrides **owners**, so make sure that **classifier_ids** is empty. + * The categories of classifiers to apply. The **classifier_ids** parameter overrides **owners**, so make sure that + * **classifier_ids** is empty. + * - Use `IBM` to classify against the `default` general classifier. You get the same result if both + * **classifier_ids** and **owners** parameters are empty. + * - Use `me` to classify against all your custom classifiers. However, for better performance use **classifier_ids** + * to specify the specific custom classifiers to apply. + * - Use both `IBM` and `me` to analyze the image against both classifier categories. * * @return the owners */ @@ -391,14 +366,4 @@ public List classifierIds() { public String imagesFileContentType() { return imagesFileContentType; } - - /** - * Gets the parameters. - * - * @return the parameters - * @deprecated replaced by the top-level parameters url, threshold, owners, and classifierIds - */ - public String parameters() { - return parameters; - } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java index 438741c4239..75c956db76c 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java @@ -194,21 +194,6 @@ public Builder negativeExamples(File negativeExamples) throws FileNotFoundExcept this.negativeExamplesFilename = negativeExamples.getName(); return this; } - - /** - * Adds a classifier with a name and positive examples. If the classifier name is already contained, the old - * positive examples are replaced by the specified value. - * - * @param classname the class name - * @param positiveExamples the positive examples - * @return the builder - * @throws FileNotFoundException if the file could not be found - * @deprecated This method has been replaced by addPositiveExamples(String, File) and will be removed in the next - * major release - */ - public Builder addClass(String classname, File positiveExamples) throws FileNotFoundException { - return addPositiveExamples(classname, positiveExamples); - } } private CreateClassifierOptions(Builder builder) { diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java index 77475ef6b50..2cd935d47d1 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java @@ -25,7 +25,7 @@ public class DetectFacesOptions extends GenericModel { /** - * The language used for the value of `gender_label` in the response. + * The desired language of parts of the response. See the response for details. */ public interface AcceptLanguage { /** en. */ @@ -57,8 +57,6 @@ public interface AcceptLanguage { private String url; private String acceptLanguage; private String imagesFileContentType; - @Deprecated - private String parameters; /** * Builder. @@ -69,8 +67,6 @@ public static class Builder { private String url; private String acceptLanguage; private String imagesFileContentType; - @Deprecated - private String parameters; private Builder(DetectFacesOptions detectFacesOptions) { imagesFile = detectFacesOptions.imagesFile; @@ -78,7 +74,6 @@ private Builder(DetectFacesOptions detectFacesOptions) { url = detectFacesOptions.url; acceptLanguage = detectFacesOptions.acceptLanguage; imagesFileContentType = detectFacesOptions.imagesFileContentType; - parameters = detectFacesOptions.parameters; } /** @@ -164,18 +159,6 @@ public Builder imagesFile(File imagesFile) throws FileNotFoundException { this.imagesFilename = imagesFile.getName(); return this; } - - /** - * Set the parameters. - * - * @param parameters the parameters - * @return the DetectFacesOptions builder - * @deprecated replaced by the url parameter - */ - public Builder parameters(String parameters) { - this.parameters = parameters; - return this; - } } private DetectFacesOptions(Builder builder) { @@ -184,7 +167,6 @@ private DetectFacesOptions(Builder builder) { url = builder.url; acceptLanguage = builder.acceptLanguage; imagesFileContentType = builder.imagesFileContentType; - parameters = builder.parameters; } /** @@ -228,8 +210,8 @@ public String imagesFilename() { * Gets the url. * * The URL of an image to analyze. Must be in .gif, .jpg, .png, or .tif format. The minimum recommended pixel density - * is 32X32 pixels per inch, and the maximum image size is 10 MB. Redirects are followed, so you can use a shortened - * URL. + * is 32X32 pixels, but the service tends to perform better with images that are at least 224 x 224 pixels. The + * maximum image size is 10 MB. Redirects are followed, so you can use a shortened URL. * * You can also include images with the **images_file** parameter. * @@ -242,7 +224,7 @@ public String url() { /** * Gets the acceptLanguage. * - * The language used for the value of `gender_label` in the response. + * The desired language of parts of the response. See the response for details. * * @return the acceptLanguage */ @@ -260,14 +242,4 @@ public String acceptLanguage() { public String imagesFileContentType() { return imagesFileContentType; } - - /** - * Gets the parameters. - * - * @return the parameters - * @deprecated replaced by the url parameter - */ - public String parameters() { - return parameters; - } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java index 5d0452c5ecc..3dc998575c5 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java @@ -194,21 +194,6 @@ public Builder negativeExamples(File negativeExamples) throws FileNotFoundExcept this.negativeExamplesFilename = negativeExamples.getName(); return this; } - - /** - * Adds a classifier with a name and positive examples. If the classifier name is already contained, the old - * positive examples are replaced by the specified value. - * - * @param classname the class name - * @param positiveExamples the positive examples - * @return the builder - * @throws FileNotFoundException if the file could not be found - * @deprecated This method has been replaced by addPositiveExamples(String, File) and will be removed in the next - * major release - */ - public Builder addClass(String classname, File positiveExamples) throws FileNotFoundException { - return addPositiveExamples(classname, positiveExamples); - } } private UpdateClassifierOptions(Builder builder) { From 252154729ea18272eccb1ee383856b41afc4dc5d Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 14:08:48 -0500 Subject: [PATCH 20/26] chore(Visual Recognition): Apply manual changes --- .../v3/VisualRecognition.java | 74 +++++++++++++++++-- .../v3/model/ClassifyOptions.java | 28 +++++++ .../v3/model/CreateClassifierOptions.java | 15 ++++ .../v3/model/DetectFacesOptions.java | 28 +++++++ .../v3/model/UpdateClassifierOptions.java | 15 ++++ 5 files changed, 153 insertions(+), 7 deletions(-) diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java index 291274ae550..e8a834a01a5 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java @@ -32,10 +32,12 @@ import com.ibm.watson.developer_cloud.visual_recognition.v3.model.GetCoreMlModelOptions; import com.ibm.watson.developer_cloud.visual_recognition.v3.model.ListClassifiersOptions; import com.ibm.watson.developer_cloud.visual_recognition.v3.model.UpdateClassifierOptions; -import java.io.InputStream; import okhttp3.MultipartBody; import okhttp3.RequestBody; +import java.io.InputStream; +import java.util.Map; + /** * The IBM Watson™ Visual Recognition service uses deep learning algorithms to identify scenes, objects, and faces * in images you upload to the service. You can create and train a custom classifier to identify subjects that suit @@ -68,6 +70,52 @@ public VisualRecognition(String versionDate) { this.versionDate = versionDate; } + /** + * Instantiates a new `VisualRecognition` with API Key. + * + * @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 apiKey the API Key + * @deprecated This form of authentication is deprecated and will be removed in the next major release. Please + * authenticate using IAM credentials, using either the (String, IamOptions) constructor or with the + * setIamCredentials() method. + */ + public VisualRecognition(String versionDate, String apiKey) { + this(versionDate); + setApiKey(apiKey); + } + + /* + * (non-Javadoc) + */ + @Override + protected void setAuthentication(okhttp3.Request.Builder builder) { + if ((getUsername() != null && getPassword() != null) || isTokenManagerSet()) { + super.setAuthentication(builder); + } else if (getApiKey() != null) { + addApiKeyQueryParameter(builder, getApiKey()); + } else { + throw new IllegalArgumentException( + "Credentials need to be specified. Use setApiKey(), setIamCredentials(), or setUsernameAndPassword()."); + } + } + + /** + * Adds the API key as a query parameter to the request URL. + * + * @param builder builder for the current request + * @param apiKey API key to be added + */ + private void addApiKeyQueryParameter(okhttp3.Request.Builder builder, String apiKey) { + final okhttp3.HttpUrl url = okhttp3.HttpUrl.parse(builder.build().url().toString()); + + if ((url.query() == null) || url.query().isEmpty()) { + builder.url(builder.build().url() + "?api_key=" + apiKey); + } else { + builder.url(builder.build().url() + "&api_key=" + apiKey); + } + } + /** * Instantiates a new `VisualRecognition` with IAM. Note that if the access token is specified in the * iamOptions, you accept responsibility for managing the access token yourself. You must set a new access token @@ -94,9 +142,13 @@ public VisualRecognition(String versionDate, IamOptions iamOptions) { */ public ServiceCall classify(ClassifyOptions classifyOptions) { Validator.notNull(classifyOptions, "classifyOptions cannot be null"); - Validator.isTrue((classifyOptions.imagesFile() != null) || (classifyOptions.url() != null) || (classifyOptions - .threshold() != null) || (classifyOptions.owners() != null) || (classifyOptions.classifierIds() != null), - "At least one of imagesFile, url, threshold, owners, or classifierIds must be supplied."); + Validator.isTrue((classifyOptions.imagesFile() != null) + || (classifyOptions.url() != null) + || (classifyOptions.threshold() != null) + || (classifyOptions.owners() != null) + || (classifyOptions.classifierIds() != null) + || (classifyOptions.parameters() != null), + "At least one of imagesFile, url, threshold, owners, classifierIds, or parameters must be supplied."); String[] pathSegments = { "v3/classify" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query(VERSION, versionDate); @@ -112,6 +164,9 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { .imagesFileContentType()); multipartBuilder.addFormDataPart("images_file", classifyOptions.imagesFilename(), imagesFileBody); } + if (classifyOptions.parameters() != null) { + multipartBuilder.addFormDataPart("parameters", classifyOptions.parameters()); + } if (classifyOptions.url() != null) { multipartBuilder.addFormDataPart("url", classifyOptions.url()); } @@ -160,8 +215,10 @@ public ServiceCall classify() { */ public ServiceCall detectFaces(DetectFacesOptions detectFacesOptions) { Validator.notNull(detectFacesOptions, "detectFacesOptions cannot be null"); - Validator.isTrue((detectFacesOptions.imagesFile() != null) || (detectFacesOptions.url() != null), - "At least one of imagesFile or url must be supplied."); + Validator.isTrue((detectFacesOptions.imagesFile() != null) + || (detectFacesOptions.url() != null) + || (detectFacesOptions.parameters() != null), + "At least one of imagesFile, url, or parameters must be supplied."); String[] pathSegments = { "v3/detect_faces" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query(VERSION, versionDate); @@ -177,6 +234,9 @@ public ServiceCall detectFaces(DetectFacesOptions detectFacesOpti .imagesFileContentType()); multipartBuilder.addFormDataPart("images_file", detectFacesOptions.imagesFilename(), imagesFileBody); } + if (detectFacesOptions.parameters() != null) { + multipartBuilder.addFormDataPart("parameters", detectFacesOptions.parameters()); + } if (detectFacesOptions.url() != null) { multipartBuilder.addFormDataPart("url", detectFacesOptions.url()); } @@ -380,7 +440,7 @@ public ServiceCall getCoreMlModel(GetCoreMlModelOptions getCoreMlMo builder.query(VERSION, versionDate); builder.header("X-IBMCloud-SDK-Analytics", "service_name=watson_vision_combined;service_version=v3;operation_id=getCoreMlModel"); - return createServiceCall(builder.build(), ResponseConverterUtils.getObject(InputStream.class)); + return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream()); } /** diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java index 73bc00efeea..f4d54d1cc0d 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java @@ -63,6 +63,8 @@ public interface AcceptLanguage { private List owners; private List classifierIds; private String imagesFileContentType; + @Deprecated + private String parameters; /** * Builder. @@ -76,6 +78,8 @@ public static class Builder { private List owners; private List classifierIds; private String imagesFileContentType; + @Deprecated + private String parameters; private Builder(ClassifyOptions classifyOptions) { imagesFile = classifyOptions.imagesFile; @@ -86,6 +90,7 @@ private Builder(ClassifyOptions classifyOptions) { owners = classifyOptions.owners; classifierIds = classifyOptions.classifierIds; imagesFileContentType = classifyOptions.imagesFileContentType; + parameters = classifyOptions.parameters; } /** @@ -236,6 +241,18 @@ public Builder imagesFile(File imagesFile) throws FileNotFoundException { this.imagesFilename = imagesFile.getName(); return this; } + + /** + * Set the parameters. + * + * @param parameters the parameters + * @return the ClassifyOptions builder + * @deprecated replaced by the top-level parameters url, threshold, owners, and classifierIds + */ + public Builder parameters(String parameters) { + this.parameters = parameters; + return this; + } } private ClassifyOptions(Builder builder) { @@ -247,6 +264,7 @@ private ClassifyOptions(Builder builder) { owners = builder.owners; classifierIds = builder.classifierIds; imagesFileContentType = builder.imagesFileContentType; + parameters = builder.parameters; } /** @@ -366,4 +384,14 @@ public List classifierIds() { public String imagesFileContentType() { return imagesFileContentType; } + + /** + * Gets the parameters. + * + * @return the parameters + * @deprecated replaced by the top-level parameters url, threshold, owners, and classifierIds + */ + public String parameters() { + return parameters; + } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java index 75c956db76c..438741c4239 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/CreateClassifierOptions.java @@ -194,6 +194,21 @@ public Builder negativeExamples(File negativeExamples) throws FileNotFoundExcept this.negativeExamplesFilename = negativeExamples.getName(); return this; } + + /** + * Adds a classifier with a name and positive examples. If the classifier name is already contained, the old + * positive examples are replaced by the specified value. + * + * @param classname the class name + * @param positiveExamples the positive examples + * @return the builder + * @throws FileNotFoundException if the file could not be found + * @deprecated This method has been replaced by addPositiveExamples(String, File) and will be removed in the next + * major release + */ + public Builder addClass(String classname, File positiveExamples) throws FileNotFoundException { + return addPositiveExamples(classname, positiveExamples); + } } private CreateClassifierOptions(Builder builder) { diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java index 2cd935d47d1..73819b6aedb 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java @@ -57,6 +57,8 @@ public interface AcceptLanguage { private String url; private String acceptLanguage; private String imagesFileContentType; + @Deprecated + private String parameters; /** * Builder. @@ -67,6 +69,8 @@ public static class Builder { private String url; private String acceptLanguage; private String imagesFileContentType; + @Deprecated + private String parameters; private Builder(DetectFacesOptions detectFacesOptions) { imagesFile = detectFacesOptions.imagesFile; @@ -74,6 +78,7 @@ private Builder(DetectFacesOptions detectFacesOptions) { url = detectFacesOptions.url; acceptLanguage = detectFacesOptions.acceptLanguage; imagesFileContentType = detectFacesOptions.imagesFileContentType; + parameters = detectFacesOptions.parameters; } /** @@ -159,6 +164,18 @@ public Builder imagesFile(File imagesFile) throws FileNotFoundException { this.imagesFilename = imagesFile.getName(); return this; } + + /** + * Set the parameters. + * + * @param parameters the parameters + * @return the DetectFacesOptions builder + * @deprecated replaced by the url parameter + */ + public Builder parameters(String parameters) { + this.parameters = parameters; + return this; + } } private DetectFacesOptions(Builder builder) { @@ -167,6 +184,7 @@ private DetectFacesOptions(Builder builder) { url = builder.url; acceptLanguage = builder.acceptLanguage; imagesFileContentType = builder.imagesFileContentType; + parameters = builder.parameters; } /** @@ -242,4 +260,14 @@ public String acceptLanguage() { public String imagesFileContentType() { return imagesFileContentType; } + + /** + * Gets the parameters. + * + * @return the parameters + * @deprecated replaced by the url parameter + */ + public String parameters() { + return parameters; + } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java index 3dc998575c5..5d0452c5ecc 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/UpdateClassifierOptions.java @@ -194,6 +194,21 @@ public Builder negativeExamples(File negativeExamples) throws FileNotFoundExcept this.negativeExamplesFilename = negativeExamples.getName(); return this; } + + /** + * Adds a classifier with a name and positive examples. If the classifier name is already contained, the old + * positive examples are replaced by the specified value. + * + * @param classname the class name + * @param positiveExamples the positive examples + * @return the builder + * @throws FileNotFoundException if the file could not be found + * @deprecated This method has been replaced by addPositiveExamples(String, File) and will be removed in the next + * major release + */ + public Builder addClass(String classname, File positiveExamples) throws FileNotFoundException { + return addPositiveExamples(classname, positiveExamples); + } } private UpdateClassifierOptions(Builder builder) { From 9add4ab3904f1052a375cf51ff48a3a5a5bdbcd7 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 14:33:38 -0500 Subject: [PATCH 21/26] test(Compare and Comply): Update unit tests --- .../compare_comply/v1/CompareComplyTest.java | 20 +++++++++++++++++++ .../compare_comply/classify-return.json | 20 ++++++++++++++++--- .../compare_comply/table-return.json | 10 ++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/compare-comply/src/test/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComplyTest.java b/compare-comply/src/test/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComplyTest.java index b5e9856e29b..011ad8c9aa2 100644 --- a/compare-comply/src/test/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComplyTest.java +++ b/compare-comply/src/test/java/com/ibm/watson/developer_cloud/compare_comply/v1/CompareComplyTest.java @@ -21,9 +21,11 @@ import com.ibm.watson.developer_cloud.compare_comply.v1.model.ClassifyReturn; import com.ibm.watson.developer_cloud.compare_comply.v1.model.CompareDocumentsOptions; import com.ibm.watson.developer_cloud.compare_comply.v1.model.CompareReturn; +import com.ibm.watson.developer_cloud.compare_comply.v1.model.ContractAmts; import com.ibm.watson.developer_cloud.compare_comply.v1.model.ConvertToHtmlOptions; import com.ibm.watson.developer_cloud.compare_comply.v1.model.CreateBatchOptions; import com.ibm.watson.developer_cloud.compare_comply.v1.model.DeleteFeedbackOptions; +import com.ibm.watson.developer_cloud.compare_comply.v1.model.EffectiveDates; import com.ibm.watson.developer_cloud.compare_comply.v1.model.ExtractTablesOptions; import com.ibm.watson.developer_cloud.compare_comply.v1.model.FeedbackDataInput; import com.ibm.watson.developer_cloud.compare_comply.v1.model.FeedbackList; @@ -38,8 +40,10 @@ import com.ibm.watson.developer_cloud.compare_comply.v1.model.Location; import com.ibm.watson.developer_cloud.compare_comply.v1.model.OriginalLabelsIn; import com.ibm.watson.developer_cloud.compare_comply.v1.model.OriginalLabelsOut; +import com.ibm.watson.developer_cloud.compare_comply.v1.model.Parties; import com.ibm.watson.developer_cloud.compare_comply.v1.model.ShortDoc; import com.ibm.watson.developer_cloud.compare_comply.v1.model.TableReturn; +import com.ibm.watson.developer_cloud.compare_comply.v1.model.TerminationDates; import com.ibm.watson.developer_cloud.compare_comply.v1.model.TypeLabel; import com.ibm.watson.developer_cloud.compare_comply.v1.model.UpdateBatchOptions; import com.ibm.watson.developer_cloud.compare_comply.v1.model.UpdatedLabelsIn; @@ -633,6 +637,12 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getColumnHeaderTexts().get(0)); assertEquals(TEXT_NORMALIZED, response.getTables().get(0).getBodyCells().get(0).getColumnHeaderTextsNormalized().get(0)); + assertEquals(TYPE, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getType()); + assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getText()); + assertEquals(BEGIN, + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getBegin()); + assertEquals(END, + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getEnd()); assertEquals(TEXT, response.getDocumentStructure().getSectionTitles().get(0).getText()); assertEquals(BEGIN, response.getDocumentStructure().getSectionTitles().get(0).getLocation().getBegin()); assertEquals(END, response.getDocumentStructure().getSectionTitles().get(0).getLocation().getEnd()); @@ -649,6 +659,7 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(END, response.getDocumentStructure().getLeadingSentences().get(0).getElementLocations().get(0).getEnd()); assertEquals(PARTY, response.getParties().get(0).getParty()); + assertEquals(Parties.Importance.UNKNOWN, response.getParties().get(0).getImportance()); assertEquals(ROLE, response.getParties().get(0).getRole()); assertEquals(TEXT, response.getParties().get(0).getAddresses().get(0).getText()); assertEquals(BEGIN, response.getParties().get(0).getAddresses().get(0).getLocation().getBegin()); @@ -658,12 +669,15 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(TEXT, response.getEffectiveDates().get(0).getText()); assertEquals(BEGIN, response.getEffectiveDates().get(0).getLocation().getBegin()); assertEquals(END, response.getEffectiveDates().get(0).getLocation().getEnd()); + assertEquals(EffectiveDates.ConfidenceLevel.HIGH, response.getEffectiveDates().get(0).getConfidenceLevel()); assertEquals(TEXT, response.getContractAmounts().get(0).getText()); assertEquals(BEGIN, response.getContractAmounts().get(0).getLocation().getBegin()); assertEquals(END, response.getContractAmounts().get(0).getLocation().getEnd()); + assertEquals(ContractAmts.ConfidenceLevel.HIGH, response.getContractAmounts().get(0).getConfidenceLevel()); assertEquals(TEXT, response.getTerminationDates().get(0).getText()); assertEquals(BEGIN, response.getTerminationDates().get(0).getLocation().getBegin()); assertEquals(END, response.getTerminationDates().get(0).getLocation().getEnd()); + assertEquals(TerminationDates.ConfidenceLevel.HIGH, response.getTerminationDates().get(0).getConfidenceLevel()); } @Test @@ -729,6 +743,12 @@ public void testExtractTables() throws FileNotFoundException, InterruptedExcepti assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getColumnHeaderTexts().get(0)); assertEquals(TEXT_NORMALIZED, response.getTables().get(0).getBodyCells().get(0).getColumnHeaderTextsNormalized().get(0)); + assertEquals(TYPE, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getType()); + assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getText()); + assertEquals(BEGIN, + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getBegin()); + assertEquals(END, + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getEnd()); } @Test diff --git a/compare-comply/src/test/resources/compare_comply/classify-return.json b/compare-comply/src/test/resources/compare_comply/classify-return.json index 1e4986e02f2..2ace0837ba1 100644 --- a/compare-comply/src/test/resources/compare_comply/classify-return.json +++ b/compare-comply/src/test/resources/compare_comply/classify-return.json @@ -131,6 +131,16 @@ ], "column_header_texts_normalized": [ "text_normalized" + ], + "attributes": [ + { + "type": "type", + "text": "text", + "location": { + "begin": 0, + "end": 1 + } + } ] } ] @@ -172,6 +182,7 @@ "parties": [ { "party": "party", + "importance": "Unknown", "role": "role", "addresses": [ { @@ -196,7 +207,8 @@ "location": { "begin": 0, "end": 1 - } + }, + "confidence_level": "High" } ], "contract_amounts": [ @@ -205,7 +217,8 @@ "location": { "begin": 0, "end": 1 - } + }, + "confidence_level": "High" } ], "termination_dates": [ @@ -214,7 +227,8 @@ "location": { "begin": 0, "end": 1 - } + }, + "confidence_level": "High" } ] } \ No newline at end of file diff --git a/compare-comply/src/test/resources/compare_comply/table-return.json b/compare-comply/src/test/resources/compare_comply/table-return.json index cd00d7e1b03..99b998cdfae 100644 --- a/compare-comply/src/test/resources/compare_comply/table-return.json +++ b/compare-comply/src/test/resources/compare_comply/table-return.json @@ -92,6 +92,16 @@ ], "column_header_texts_normalized": [ "text_normalized" + ], + "attributes": [ + { + "type": "type", + "text": "text", + "location": { + "begin": 0, + "end": 1 + } + } ] } ] From 38751452eedad1932e7545bd81c3aeb2e8615305 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 14:38:08 -0500 Subject: [PATCH 22/26] test(Speech to Text): Update unit tests --- .../speech_to_text/v1/SpeechToTextTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java index 873941de2dd..a1052ea9abe 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java +++ b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java @@ -1202,12 +1202,17 @@ public void testUpgradeAcousticModel() throws InterruptedException { UpgradeAcousticModelOptions upgradeOptions = new UpgradeAcousticModelOptions.Builder() .customizationId(id) .customLanguageModelId(languageModelId) + .force(true) .build(); + upgradeOptions = upgradeOptions.newBuilder().build(); service.upgradeAcousticModel(upgradeOptions).execute(); final RecordedRequest request = server.takeRequest(); assertEquals("POST", request.getMethod()); - assertEquals(String.format(PATH_ACOUSTIC_UPGRADE, id) + "?custom_language_model_id=" + languageModelId, + assertEquals(String.format(PATH_ACOUSTIC_UPGRADE, id) + + "?custom_language_model_id=" + + languageModelId + + "&force=true", request.getPath()); } From 01a95d45d3f5ec911bef5e30567283a4c0dbf01a Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 14:49:14 -0500 Subject: [PATCH 23/26] Revert "fix(Assistant v1): Make InputData model dynamic" This reverts commit d0439bb3305cd34174922b6f14986fd172c66410. --- .../assistant/v1/model/InputData.java | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java index 38a44170599..f5e3252583b 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/InputData.java @@ -12,37 +12,15 @@ */ package com.ibm.watson.developer_cloud.assistant.v1.model; -import java.lang.reflect.Type; - -import com.google.gson.reflect.TypeToken; -import com.ibm.watson.developer_cloud.service.model.DynamicModel; -import com.ibm.watson.developer_cloud.util.GsonSerializationHelper; +import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.Validator; /** * An input object that includes the input text. */ -public class InputData extends DynamicModel { - private Type textType = new TypeToken() { - }.getType(); - - /** - * Gets the text. - * - * @return the text - */ - public String text() { - return GsonSerializationHelper.serializeDynamicModelProperty(this.get("text"), textType); - } +public class InputData extends GenericModel { - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(final String text) { - this.put("text", text); - } + private String text; /** * Builder. @@ -51,7 +29,7 @@ public static class Builder { private String text; private Builder(InputData inputData) { - text = inputData.text(); + text = inputData.text; } /** @@ -92,6 +70,27 @@ public Builder text(String text) { private InputData(Builder builder) { Validator.notNull(builder.text, "text cannot be null"); - setText(builder.text); + text = builder.text; + } + + /** + * New builder. + * + * @return a InputData builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the text. + * + * The text of the user input. This string cannot contain carriage return, newline, or tab characters, and it must be + * no longer than 2048 characters. + * + * @return the text + */ + public String text() { + return text; } } From 6e6b2ae46e18541b60e3ee48932b3484a586b4ce Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 14:51:55 -0500 Subject: [PATCH 24/26] chore(Text to Speech): Apply manual changes This reverts commit 320c3192e2de95844cb37ef5b358e6aa20164f3f. --- .../text_to_speech/v1/TextToSpeech.java | 30 +++++++++++++++++ .../v1/model/SynthesizeOptions.java | 33 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java index cb1fcb47076..1772146a7d4 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java @@ -39,9 +39,16 @@ import com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModels; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Voices; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Words; +import com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.SynthesizeCallback; +import com.ibm.watson.developer_cloud.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; import com.ibm.watson.developer_cloud.util.Validator; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.WebSocket; + import java.io.InputStream; /** @@ -265,6 +272,29 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream()); } + public WebSocket synthesizeUsingWebSocket(SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { + Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null"); + Validator.notNull(callback, "callback cannot be null"); + + HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/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/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java index 402f27e8eab..f1cd252f36c 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java @@ -15,6 +15,8 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.Validator; +import java.util.List; + /** * The synthesize options. */ @@ -94,6 +96,7 @@ public interface Voice { private String accept; private String voice; private String customizationId; + private List timings; /** * Builder. @@ -103,12 +106,14 @@ public static class Builder { private String accept; private String voice; private String customizationId; + private List timings; private Builder(SynthesizeOptions synthesizeOptions) { text = synthesizeOptions.text; accept = synthesizeOptions.accept; voice = synthesizeOptions.voice; customizationId = synthesizeOptions.customizationId; + timings = synthesizeOptions.timings; } /** @@ -178,6 +183,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; + } } private SynthesizeOptions(Builder builder) { @@ -186,6 +202,7 @@ private SynthesizeOptions(Builder builder) { accept = builder.accept; voice = builder.voice; customizationId = builder.customizationId; + timings = builder.timings; } /** @@ -247,4 +264,20 @@ 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 timings() { + return timings; + } } From 06c347b5ff268ac61045a97712fd4beea6368b6d Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 14:53:34 -0500 Subject: [PATCH 25/26] [skip ci] docs: Update version numbers from 6.13.2 -> 6.14.0 --- .bumpversion.cfg | 2 +- README.md | 14 +++++++------- assistant/README.md | 4 ++-- conversation/README.md | 4 ++-- discovery/README.md | 4 ++-- language-translator/README.md | 4 ++-- natural-language-classifier/README.md | 4 ++-- natural-language-understanding/README.md | 4 ++-- personality-insights/README.md | 4 ++-- speech-to-text/README.md | 4 ++-- text-to-speech/README.md | 4 ++-- tone-analyzer/README.md | 4 ++-- visual-recognition/README.md | 4 ++-- 13 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b37e1a1cbfe..a89f1b4fa5f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 6.13.2 +current_version = 6.14.0 commit = True message = [skip ci] docs: Update version numbers from {current_version} -> {new_version} diff --git a/README.md b/README.md index fb441cb54d7..c9aa79c2f7a 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ All the services: com.ibm.watson.developer_cloud java-sdk - 6.13.2 + 6.14.0 ``` @@ -71,7 +71,7 @@ Only Discovery: com.ibm.watson.developer_cloud discovery - 6.13.2 + 6.14.0 ``` @@ -80,13 +80,13 @@ Only Discovery: All the services: ```gradle -'com.ibm.watson.developer_cloud:java-sdk:6.13.2' +'com.ibm.watson.developer_cloud:java-sdk:6.14.0' ``` Only Assistant: ```gradle -'com.ibm.watson.developer_cloud:assistant:6.13.2' +'com.ibm.watson.developer_cloud:assistant:6.14.0' ``` ##### Development snapshots @@ -109,7 +109,7 @@ And then reference the snapshot version on your app module gradle Only Speech to Text: ```gradle -'com.ibm.watson.developer_cloud:speech-to-text:6.13.3-SNAPSHOT' +'com.ibm.watson.developer_cloud:speech-to-text:6.14.1-SNAPSHOT' ``` ##### JAR @@ -388,7 +388,7 @@ Gradle: ```sh cd java-sdk -gradle jar # build jar file (build/libs/watson-developer-cloud-6.13.2.jar) +gradle jar # build jar file (build/libs/watson-developer-cloud-6.14.0.jar) gradle test # run tests gradle check # performs quality checks on source files and generates reports gradle testReport # run tests and generate the aggregated test report (build/reports/allTests) @@ -441,4 +441,4 @@ or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson). [ibm-cloud-onboarding]: http://cloud.ibm.com/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Java -[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-6.13.2/java-sdk-6.13.2-jar-with-dependencies.jar +[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-6.14.0/java-sdk-6.14.0-jar-with-dependencies.jar diff --git a/assistant/README.md b/assistant/README.md index 2c27119fdef..11d12c7c72c 100644 --- a/assistant/README.md +++ b/assistant/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud assistant - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:assistant:6.13.2' +'com.ibm.watson.developer_cloud:assistant:6.14.0' ``` ## Usage diff --git a/conversation/README.md b/conversation/README.md index 9055f4e4182..885781beb27 100644 --- a/conversation/README.md +++ b/conversation/README.md @@ -10,13 +10,13 @@ Conversation will be removed in the next major release. Please migrate to Assist com.ibm.watson.developer_cloud conversation - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:conversation:6.13.2' +'com.ibm.watson.developer_cloud:conversation:6.14.0' ``` ## Usage diff --git a/discovery/README.md b/discovery/README.md index 5b3c3658953..cae60ff2162 100644 --- a/discovery/README.md +++ b/discovery/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud discovery - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:discovery:6.13.2' +'com.ibm.watson.developer_cloud:discovery:6.14.0' ``` ## Usage diff --git a/language-translator/README.md b/language-translator/README.md index d1b744b1309..64d7d3172a7 100644 --- a/language-translator/README.md +++ b/language-translator/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud language-translator - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:language-translator:6.13.2' +'com.ibm.watson.developer_cloud:language-translator:6.14.0' ``` ## Usage diff --git a/natural-language-classifier/README.md b/natural-language-classifier/README.md index 4fbb4091556..e26636f50bc 100644 --- a/natural-language-classifier/README.md +++ b/natural-language-classifier/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud natural-language-classifier - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:natural-language-classifier:6.13.2' +'com.ibm.watson.developer_cloud:natural-language-classifier:6.14.0' ``` ## Usage diff --git a/natural-language-understanding/README.md b/natural-language-understanding/README.md index ab872a39e1f..2bcf0aa69e9 100644 --- a/natural-language-understanding/README.md +++ b/natural-language-understanding/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud natural-language-understanding - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:natural-language-understanding:6.13.2' +'com.ibm.watson.developer_cloud:natural-language-understanding:6.14.0' ``` ## Usage diff --git a/personality-insights/README.md b/personality-insights/README.md index 4aa0d85cc7f..ec60624437d 100755 --- a/personality-insights/README.md +++ b/personality-insights/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud personality-insights - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:personality-insights:6.13.2' +'com.ibm.watson.developer_cloud:personality-insights:6.14.0' ``` ## Usage diff --git a/speech-to-text/README.md b/speech-to-text/README.md index 2514498c134..da5608b527a 100755 --- a/speech-to-text/README.md +++ b/speech-to-text/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud speech-to-text - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:speech-to-text:6.13.2' +'com.ibm.watson.developer_cloud:speech-to-text:6.14.0' ``` ## Usage diff --git a/text-to-speech/README.md b/text-to-speech/README.md index 514cbdad6ee..974aab79eb8 100755 --- a/text-to-speech/README.md +++ b/text-to-speech/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud text-to-speech - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:text-to-speech:6.13.2' +'com.ibm.watson.developer_cloud:text-to-speech:6.14.0' ``` ## Usage diff --git a/tone-analyzer/README.md b/tone-analyzer/README.md index 60a7e8cfcec..dc0e4100262 100755 --- a/tone-analyzer/README.md +++ b/tone-analyzer/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud tone-analyzer - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:tone-analyzer:6.13.2' +'com.ibm.watson.developer_cloud:tone-analyzer:6.14.0' ``` ## Usage diff --git a/visual-recognition/README.md b/visual-recognition/README.md index 732a88f60f9..d28010b322f 100644 --- a/visual-recognition/README.md +++ b/visual-recognition/README.md @@ -7,13 +7,13 @@ com.ibm.watson.developer_cloud visual-recognition - 6.13.2 + 6.14.0 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:visual-recognition:6.13.2' +'com.ibm.watson.developer_cloud:visual-recognition:6.14.0' ``` ## Usage From 12338dbff73ef4456f531adf619257bb6ae774dd Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Mon, 4 Feb 2019 15:43:43 -0500 Subject: [PATCH 26/26] test(Assistant v1): Don't test exact equality of JSON responses in unit tests --- .../watson/developer_cloud/assistant/v1/AssistantTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantTest.java b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantTest.java index d7cc0f67cab..d1e3c8530a7 100644 --- a/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantTest.java +++ b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantTest.java @@ -166,7 +166,7 @@ public void testSendMessage() throws IOException, InterruptedException { String path = StringUtils.join(PATH_MESSAGE, "?", VERSION, "=2018-07-10"); assertEquals(path, request.getPath()); - assertArrayEquals(new String[] { "Great choice! Playing some jazz for you." }, + assertArrayEquals(new String[]{"Great choice! Playing some jazz for you."}, serviceResponse.getOutput().getText().toArray(new String[0])); assertEquals(request.getMethod(), "POST"); assertNotNull(request.getHeader(HttpHeaders.AUTHORIZATION)); @@ -183,7 +183,6 @@ public void testSendMessage() throws IOException, InterruptedException { assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getTitle()); assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); - assertEquals(serviceResponse, mockResponse); } /** @@ -224,7 +223,6 @@ public void testSendMessageWithAlternateIntents() throws IOException, Interrupte serviceResponse.getOutput().getText().toArray(new String[0])); assertEquals(request.getMethod(), "POST"); assertNotNull(request.getHeader(HttpHeaders.AUTHORIZATION)); - assertEquals(serviceResponse, mockResponse); } /**