diff --git a/README.md b/README.md index eeb0367c2ff..e94e1a67a30 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,10 @@ Java client library to use the [Watson APIs][wdc]. * [Gradle](#gradle) * [Usage](#usage) * [Running in IBM Cloud](#running-in-ibm-cloud) - * [Getting the Service Credentials](#getting-the-service-credentials) + * [Authentication](#authentication) + * [Username and Password](#username-and-password) + * [API Key](#api-key) + * [Using IAM](#using-iam) * IBM Watson Services * [Assistant](assistant) * [Discovery](discovery) @@ -123,17 +126,92 @@ credentials; the library will get them for you by looking at the [`VCAP_SERVICES When running in IBM Cloud (or other platforms based on Cloud Foundry), the library will automatically get the credentials from [`VCAP_SERVICES`][vcap_services]. If you have more than one plan, you can use `CredentialUtils` to get the service credentials for an specific plan. -## Getting the Service Credentials +## Authentication -You will need the `username` and `password` (`api_key` for Visual Recognition) credentials, and the API endpoint for each service. Service credentials are different from your IBM Cloud account username and password. +There are three ways to authenticate with IBM Cloud through the SDK: using a `username` and `password`, using an `api_key`, and with IAM. -To get your service credentials, follow these steps: +Getting the credentials necessary for authentication is the same process for all methods. To get them, follow these steps: 1. Log in to [IBM Cloud](https://console.bluemix.net/catalog?category=watson) 1. In the IBM Cloud **Catalog**, select the service you want to use. 1. Click **Create**. 1. On the left side of the page, click **Service Credentials**, and then **View credentials** to view your service credentials. -1. Copy `url`, `username` and `password`(`api_key` for AlchemyAPI or Visual Recognition). +1. Copy the necessary credentials (`url`, `username`, `password`, `api_key`, `apikey`, etc.). + +In your code, you can use these values in the service constructor or with a method call after instantiating your service. Here are some examples: + +### Username and Password + +```java +// in the constructor +Discovery service = new Discovery("2017-11-07", "", ""); +``` + +```java +// after instantiation +Discovery service = new Discovery("2017-11-07"); +service.setUsernameAndPassword("", ""); +``` + +### API Key + +_Note: This version of instantiation only works with Visual Recognition, as it's the only service that uses an API key rather than a username and password._ + +```java +// in the constructor +VisualRecognition service = new VisualRecognition("2016-05-20", ""); +``` + +```java +// after instantiation +VisualRecognition service = new VisualRecognition("2016-05-20"); +service.setApiKey(""); +``` + +### Using IAM + +When authenticating with IAM, you have the option of passing in: +- the IAM API key and, optionally, the IAM service URL +- an IAM access token + +**Be aware that passing in an access token means that you're assuming responsibility for maintaining that token's lifecycle.** If you instead pass in an IAM API key, the SDK will manage it for you. + +```java +// in the constructor, letting the SDK manage the IAM token +IamOptions options = new IamOptions.Builder() + .apiKey("") + .url("") // optional - the default value is https://iam.ng.bluemix.net/identity/token + .build(); +Discovery service = new Discovery("2017-11-07", options); +``` + +```java +// after instantiation, letting the SDK manage the IAM token +Discovery service = new Discovery("2017-11-07"); +IamOptions options = new IamOptions.Builder() + .apiKey("") + .build(); +service.setIamCredentials(options); +``` + +```java +// in the constructor, assuming control of managing IAM token +IamOptions options = new IamOptions.Builder() + .accessToken("") + .build(); +Discovery service = new Discovery("2017-11-07", options); +``` + +```java +// after instantiation, assuming control of managing IAM token +Discovery service = new Discovery("2017-11-07"); +IamOptions options = new IamOptions.Builder() + .accessToken("") + .build(); +service.setIamCredentials(options); +``` + +If at any time you would like to let the SDK take over managing your IAM token, simply override your stored IAM credentials with an IAM API key by calling the `setIamCredentials()` method again. ## Android diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/Assistant.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/Assistant.java index d2eb4cf52aa..5cda507382d 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/Assistant.java @@ -81,6 +81,7 @@ import com.ibm.watson.developer_cloud.http.RequestBuilder; import com.ibm.watson.developer_cloud.http.ServiceCall; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; import com.ibm.watson.developer_cloud.util.Validator; @@ -129,6 +130,20 @@ public Assistant(String versionDate, String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `Assistant` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @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 iamOptions the options for authenticating through IAM + */ + public Assistant(String versionDate, IamOptions iamOptions) { + this(versionDate); + setIamCredentials(iamOptions); + } + /** * Get a response to a user's input. There is no rate limit for this operation. * @@ -278,8 +293,8 @@ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspac /** * List workspaces. * - * List the workspaces associated with an Assistant service instance. This operation is limited to 500 requests per 30 - * minutes. For more information, see **Rate limiting**. + * List the workspaces associated with a Watson Assistant service instance. This operation is limited to 500 requests + * per 30 minutes. For more information, see **Rate limiting**. * * @param listWorkspacesOptions the {@link ListWorkspacesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection} @@ -311,8 +326,8 @@ public ServiceCall listWorkspaces(ListWorkspacesOptions lis /** * List workspaces. * - * List the workspaces associated with an Assistant service instance. This operation is limited to 500 requests per 30 - * minutes. For more information, see **Rate limiting**. + * List the workspaces associated with a Watson Assistant service instance. This operation is limited to 500 requests + * per 30 minutes. For more information, see **Rate limiting**. * * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection} */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateDialogNode.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateDialogNode.java index c36eff178f9..6e7d9e8e047 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateDialogNode.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateDialogNode.java @@ -12,14 +12,14 @@ */ package com.ibm.watson.developer_cloud.assistant.v1.model; -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; -import com.ibm.watson.developer_cloud.util.Validator; - import java.util.ArrayList; import java.util.List; import java.util.Map; +import com.google.gson.annotations.SerializedName; +import com.ibm.watson.developer_cloud.service.model.GenericModel; +import com.ibm.watson.developer_cloud.util.Validator; + /** * CreateDialogNode. */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNode.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNode.java index 2d6956ccdb7..a192ccbcf9e 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNode.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNode.java @@ -12,13 +12,13 @@ */ package com.ibm.watson.developer_cloud.assistant.v1.model; -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - import java.util.Date; import java.util.List; import java.util.Map; +import com.google.gson.annotations.SerializedName; +import com.ibm.watson.developer_cloud.service.model.GenericModel; + /** * DialogNode. */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNodeVisitedDetails.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNodeVisitedDetails.java index daecf374fac..d8e4fdd1edc 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNodeVisitedDetails.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/DialogNodeVisitedDetails.java @@ -23,6 +23,7 @@ public class DialogNodeVisitedDetails extends GenericModel { @SerializedName("dialog_node") private String dialogNode; private String title; + private String conditions; /** * Gets the dialogNode. @@ -46,6 +47,17 @@ public String getTitle() { return title; } + /** + * Gets the conditions. + * + * The conditions that trigger the dialog node. + * + * @return the conditions + */ + public String getConditions() { + return conditions; + } + /** * Sets the dialogNode. * @@ -63,4 +75,13 @@ public void setDialogNode(final String dialogNode) { public void setTitle(final String title) { this.title = title; } + + /** + * Sets the conditions. + * + * @param conditions the new conditions + */ + public void setConditions(final String conditions) { + this.conditions = conditions; + } } diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListAllLogsOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListAllLogsOptions.java index 61813681073..7e67bde960a 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListAllLogsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListAllLogsOptions.java @@ -167,7 +167,7 @@ public Long pageLimit() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListCounterexamplesOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListCounterexamplesOptions.java index 840bf19b955..ce8a6ea7d43 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListCounterexamplesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListCounterexamplesOptions.java @@ -205,7 +205,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListDialogNodesOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListDialogNodesOptions.java index be37971bc0b..8902276ae28 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListDialogNodesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListDialogNodesOptions.java @@ -205,7 +205,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListEntitiesOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListEntitiesOptions.java index 5ef91134c1e..881da8659b6 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListEntitiesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListEntitiesOptions.java @@ -232,7 +232,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListExamplesOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListExamplesOptions.java index 17188207407..ae40f1593f6 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListExamplesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListExamplesOptions.java @@ -234,7 +234,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListIntentsOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListIntentsOptions.java index a3ed490e7e2..a35fb0eec42 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListIntentsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListIntentsOptions.java @@ -232,7 +232,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListLogsOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListLogsOptions.java index 2331f6e67f6..7a7e1ff7438 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListLogsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListLogsOptions.java @@ -191,7 +191,7 @@ public Long pageLimit() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListSynonymsOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListSynonymsOptions.java index fd6f3bbda43..2a4e410d2b6 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListSynonymsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListSynonymsOptions.java @@ -263,7 +263,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListValuesOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListValuesOptions.java index fc2375a6918..17d875cefe5 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListValuesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListValuesOptions.java @@ -261,7 +261,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListWorkspacesOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListWorkspacesOptions.java index 01325a19179..8278958d36e 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListWorkspacesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/ListWorkspacesOptions.java @@ -168,7 +168,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last object from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageRequest.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageRequest.java index 5a3d52c7358..04dbcfe8de1 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageRequest.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/MessageRequest.java @@ -18,7 +18,7 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; /** - * A request formatted for the Assistant service. + * A request formatted for the Watson Assistant service. */ public class MessageRequest extends GenericModel { 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 c9bc56a5d8a..8c54d129b74 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 @@ -20,7 +20,7 @@ import com.ibm.watson.developer_cloud.util.GsonSerializationHelper; /** - * A response from the Assistant service. + * A response from the Watson Assistant service. */ public class MessageResponse extends DynamicModel { private Type inputType = new TypeToken() { diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/package-info.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/package-info.java index e58f9163f3a..9c29917c7a7 100644 --- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/package-info.java +++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/package-info.java @@ -11,6 +11,6 @@ * specific language governing permissions and limitations under the License. */ /** - * Assistant v1. + * Watson Assistant v1. */ package com.ibm.watson.developer_cloud.assistant.v1; 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 1f304b7f14a..399949ea6d6 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 @@ -12,8 +12,6 @@ */ package com.ibm.watson.developer_cloud.assistant.v1; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; import com.ibm.watson.developer_cloud.WatsonServiceUnitTest; import com.ibm.watson.developer_cloud.assistant.v1.model.Context; import com.ibm.watson.developer_cloud.assistant.v1.model.CreateCounterexample; @@ -54,7 +52,6 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; /** * Unit tests for the {@link Assistant}. @@ -131,18 +128,18 @@ public void testAssistantWithEmptyWorkspaceId() { */ @Test public void testSendMessage() throws IOException, InterruptedException { - String text = "I'd like to get insurance to for my home"; + String text = "I would love to hear some jazz music."; MessageResponse mockResponse = loadFixture(FIXTURE, MessageResponse.class); server.enqueue(jsonResponse(mockResponse)); InputData input = new InputData.Builder(text).build(); RuntimeIntent intent = new RuntimeIntent(); - intent.setIntent("turn_off"); + intent.setIntent("turn_on"); intent.setConfidence(0.0); RuntimeEntity entity = new RuntimeEntity(); - entity.setEntity("car"); - entity.setValue("ford"); + entity.setEntity("genre"); + entity.setValue("jazz"); MessageOptions options = new MessageOptions.Builder(WORKSPACE_ID) .input(input) .addIntent(intent) @@ -158,18 +155,16 @@ public void testSendMessage() throws IOException, InterruptedException { String path = StringUtils.join(PATH_MESSAGE, "?", VERSION, "=2018-02-16"); assertEquals(path, request.getPath()); - assertArrayEquals(new String[] { "Do you want to get a quote?" }, + 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)); - String expected = "{" + "\"input\":{\"text\":\"I'd like to get insurance to for my home\"}," - + "\"intents\":[{\"confidence\":0.0,\"intent\":\"turn_off\"}]," - + "\"entities\":[{\"value\":\"ford\",\"entity\":\"car\"}]," - + "\"alternate_intents\":true" + "}"; - JsonParser parser = new JsonParser(); - JsonObject expectedObj = parser.parse(expected).getAsJsonObject(); - JsonObject actualObj = parser.parse(request.getBody().readUtf8()).getAsJsonObject(); - assertTrue(expectedObj.equals(actualObj)); + assertNotNull(serviceResponse.getOutput().getLogMessages()); + assertNotNull(serviceResponse.getOutput().getNodesVisited()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getDialogNode()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getTitle()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); assertEquals(serviceResponse, mockResponse); } @@ -202,13 +197,10 @@ public void testSendMessageWithAlternateIntents() throws IOException, Interrupte String path = StringUtils.join(PATH_MESSAGE, "?", VERSION, "=2018-02-16"); assertEquals(path, request.getPath()); - assertArrayEquals(new String[] { "Do you want to get a quote?" }, + 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)); - assertEquals( - "{\"input\":{\"text\":\"My text\"},\"alternate_intents\":false," + "\"context\":{\"name\":\"Myname\"}}", - request.getBody().readUtf8()); assertEquals(serviceResponse, mockResponse); } diff --git a/assistant/src/test/resources/assistant/assistant.json b/assistant/src/test/resources/assistant/assistant.json index 7ec8d410828..4ece4091566 100644 --- a/assistant/src/test/resources/assistant/assistant.json +++ b/assistant/src/test/resources/assistant/assistant.json @@ -1,28 +1,112 @@ { "intents": [ { - "intent": "get_quote", - "confidence": 0.943643 + "intent": "turn_on", + "confidence": 0.9842960834503174 } ], "entities": [ { - "entity": "house", - "value": "home", + "entity": "genre", "location": [ - 36, - 40 - ] + 26, + 30 + ], + "value": "jazz", + "confidence": 1 + }, + { + "entity": "genre_bad", + "location": [ + 31, + 36 + ], + "value": "Soundtrack", + "confidence": 0.7 + }, + { + "entity": "appliance", + "location": [ + 31, + 36 + ], + "value": "music", + "confidence": 1 } ], "input": { - "text": "I'd like to get insurance to for my home" - }, - "context": { + "text": "I would love to hear some jazz music." }, "output": { "text": [ - "Do you want to get a quote?" - ] + "Great choice! Playing some jazz for you." + ], + "nodes_visited": [ + "Entry Point For On Off Commands", + "node_5_1469049934217", + "Genre On Off Check", + "node_3_1484628332751" + ], + "action": { + "music_on": "jazz" + }, + "nodes_visited_details": [ + { + "dialog_node": "Entry Point For On Off Commands", + "title": "Entry Point For On Off Commands", + "conditions": "#turn_on" + }, + { + "dialog_node": "node_5_1469049934217", + "title": null, + "conditions": "@genre" + }, + { + "dialog_node": "Genre On Off Check", + "title": "Genre On Off Check", + "conditions": "true" + }, + { + "dialog_node": "node_3_1484628332751", + "title": null, + "conditions": "$appl_action == \"on\"" + } + ], + "log_messages": [] + }, + "context": { + "conversation_id": "ed55c019-83b0-4d24-9d7c-99ee85e4e7a7", + "system": { + "dialog_stack": [ + { + "dialog_node": "root" + } + ], + "dialog_turn_counter": 2, + "dialog_request_counter": 2, + "_node_output_map": { + "Start And Initialize Context": [ + 0, + 0 + ], + "node_3_1484628332751": [ + 0, + 0 + ] + }, + "branch_exited": true, + "branch_exited_reason": "completed" + }, + "AConoff": "off", + "lightonoff": "off", + "musiconoff": "on", + "appl_action": "on", + "heateronoff": "off", + "volumeonoff": "off", + "wipersonoff": "off", + "default_counter": 0, + "previous_cuisine": "", + "previous_restaurant_date": "", + "previous_restaurant_time": "" } } diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/Conversation.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/Conversation.java index 597827aae86..b7d4886125b 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/Conversation.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/Conversation.java @@ -81,6 +81,7 @@ import com.ibm.watson.developer_cloud.http.RequestBuilder; import com.ibm.watson.developer_cloud.http.ServiceCall; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; import com.ibm.watson.developer_cloud.util.Validator; @@ -129,11 +130,65 @@ public Conversation(String versionDate, String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `Conversation` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @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 iamOptions the options for authenticating through IAM + */ + public Conversation(String versionDate, IamOptions iamOptions) { + this(versionDate); + setIamCredentials(iamOptions); + } + + /** + * Get a response to a user's input. There is no rate limit for this operation. + * + * @param messageOptions the {@link MessageOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link MessageResponse} + */ + public ServiceCall message(MessageOptions messageOptions) { + Validator.notNull(messageOptions, "messageOptions cannot be null"); + String[] pathSegments = { "v1/workspaces", "message" }; + String[] pathParameters = { messageOptions.workspaceId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, + pathParameters)); + builder.query(VERSION, versionDate); + if (messageOptions.nodesVisitedDetails() != null) { + builder.query("nodes_visited_details", String.valueOf(messageOptions.nodesVisitedDetails())); + } + final JsonObject contentJson = new JsonObject(); + if (messageOptions.input() != null) { + contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input())); + } + if (messageOptions.alternateIntents() != null) { + contentJson.addProperty("alternate_intents", messageOptions.alternateIntents()); + } + if (messageOptions.context() != null) { + contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context())); + } + if (messageOptions.entities() != null) { + contentJson.add("entities", GsonSingleton.getGson().toJsonTree(messageOptions.entities())); + } + if (messageOptions.intents() != null) { + contentJson.add("intents", GsonSingleton.getGson().toJsonTree(messageOptions.intents())); + } + if (messageOptions.output() != null) { + contentJson.add("output", GsonSingleton.getGson().toJsonTree(messageOptions.output())); + } + builder.bodyJson(contentJson); + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MessageResponse.class)); + } + /** * Create workspace. * * Create a workspace based on component objects. You must provide workspace components defining the content of the - * new workspace. + * new workspace. This operation is limited to 30 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @param createWorkspaceOptions the {@link CreateWorkspaceOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Workspace} @@ -181,7 +236,8 @@ public ServiceCall createWorkspace(CreateWorkspaceOptions createWorks * Create workspace. * * Create a workspace based on component objects. You must provide workspace components defining the content of the - * new workspace. + * new workspace. This operation is limited to 30 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @return a {@link ServiceCall} with a response type of {@link Workspace} */ @@ -192,7 +248,8 @@ public ServiceCall createWorkspace() { /** * Delete workspace. * - * Delete a workspace from the service instance. + * Delete a workspace from the service instance. This operation is limited to 30 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param deleteWorkspaceOptions the {@link DeleteWorkspaceOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -210,7 +267,9 @@ public ServiceCall deleteWorkspace(DeleteWorkspaceOptions deleteWorkspaceO /** * Get information about a workspace. * - * Get information about a workspace, optionally including all workspace content. + * Get information about a workspace, optionally including all workspace content. With **export**=`false`, this + * operation is limited to 6000 requests per 5 minutes. With **export**=`true`, the limit is 20 requests per 30 + * minutes. For more information, see **Rate limiting**. * * @param getWorkspaceOptions the {@link GetWorkspaceOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link WorkspaceExport} @@ -234,7 +293,8 @@ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspac /** * List workspaces. * - * List the workspaces associated with a Conversation service instance. + * List the workspaces associated with a Conversation service instance. This operation is limited to 500 requests per + * 30 minutes. For more information, see **Rate limiting**. * * @param listWorkspacesOptions the {@link ListWorkspacesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection} @@ -266,7 +326,8 @@ public ServiceCall listWorkspaces(ListWorkspacesOptions lis /** * List workspaces. * - * List the workspaces associated with a Conversation service instance. + * List the workspaces associated with a Conversation service instance. This operation is limited to 500 requests per + * 30 minutes. For more information, see **Rate limiting**. * * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection} */ @@ -278,7 +339,8 @@ public ServiceCall listWorkspaces() { * Update workspace. * * Update an existing workspace with new or modified data. You must provide component objects defining the content of - * the updated workspace. + * the updated workspace. This operation is limited to 30 request per 30 minutes. For more information, see **Rate + * limiting**. * * @param updateWorkspaceOptions the {@link UpdateWorkspaceOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Workspace} @@ -325,49 +387,11 @@ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorks return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class)); } - /** - * Get a response to a user's input. - * - * @param messageOptions the {@link MessageOptions} containing the options for the call - * @return a {@link ServiceCall} with a response type of {@link MessageResponse} - */ - public ServiceCall message(MessageOptions messageOptions) { - Validator.notNull(messageOptions, "messageOptions cannot be null"); - String[] pathSegments = { "v1/workspaces", "message" }; - String[] pathParameters = { messageOptions.workspaceId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, - pathParameters)); - builder.query(VERSION, versionDate); - if (messageOptions.nodesVisitedDetails() != null) { - builder.query("nodes_visited_details", String.valueOf(messageOptions.nodesVisitedDetails())); - } - final JsonObject contentJson = new JsonObject(); - if (messageOptions.input() != null) { - contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input())); - } - if (messageOptions.alternateIntents() != null) { - contentJson.addProperty("alternate_intents", messageOptions.alternateIntents()); - } - if (messageOptions.context() != null) { - contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context())); - } - if (messageOptions.entities() != null) { - contentJson.add("entities", GsonSingleton.getGson().toJsonTree(messageOptions.entities())); - } - if (messageOptions.intents() != null) { - contentJson.add("intents", GsonSingleton.getGson().toJsonTree(messageOptions.intents())); - } - if (messageOptions.output() != null) { - contentJson.add("output", GsonSingleton.getGson().toJsonTree(messageOptions.output())); - } - builder.bodyJson(contentJson); - return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MessageResponse.class)); - } - /** * Create intent. * - * Create a new intent. + * Create a new intent. This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @param createIntentOptions the {@link CreateIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Intent} @@ -394,7 +418,8 @@ public ServiceCall createIntent(CreateIntentOptions createIntentOptions) /** * Delete intent. * - * Delete an intent from a workspace. + * Delete an intent from a workspace. This operation is limited to 2000 requests per 30 minutes. For more information, + * see **Rate limiting**. * * @param deleteIntentOptions the {@link DeleteIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -412,7 +437,9 @@ public ServiceCall deleteIntent(DeleteIntentOptions deleteIntentOptions) { /** * Get intent. * - * Get information about an intent, optionally including all intent content. + * Get information about an intent, optionally including all intent content. With **export**=`false`, this operation + * is limited to 6000 requests per 5 minutes. With **export**=`true`, the limit is 400 requests per 30 minutes. For + * more information, see **Rate limiting**. * * @param getIntentOptions the {@link GetIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link IntentExport} @@ -436,7 +463,9 @@ public ServiceCall getIntent(GetIntentOptions getIntentOptions) { /** * List intents. * - * List the intents for a workspace. + * List the intents for a workspace. With **export**=`false`, this operation is limited to 2000 requests per 30 + * minutes. With **export**=`true`, the limit is 400 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @param listIntentsOptions the {@link ListIntentsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link IntentCollection} @@ -472,8 +501,9 @@ public ServiceCall listIntents(ListIntentsOptions listIntentsO /** * Update intent. * - * Update an existing intent with new or modified data. You must provide data defining the content of the updated - * intent. + * Update an existing intent with new or modified data. You must provide component objects defining the content of the + * updated intent. This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @param updateIntentOptions the {@link UpdateIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Intent} @@ -502,7 +532,8 @@ public ServiceCall updateIntent(UpdateIntentOptions updateIntentOptions) /** * Create user input example. * - * Add a new user input example to an intent. + * Add a new user input example to an intent. This operation is limited to 1000 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param createExampleOptions the {@link CreateExampleOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Example} @@ -523,7 +554,8 @@ public ServiceCall createExample(CreateExampleOptions createExampleOpti /** * Delete user input example. * - * Delete a user input example from an intent. + * Delete a user input example from an intent. This operation is limited to 1000 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param deleteExampleOptions the {@link DeleteExampleOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -531,8 +563,8 @@ public ServiceCall createExample(CreateExampleOptions createExampleOpti public ServiceCall deleteExample(DeleteExampleOptions deleteExampleOptions) { Validator.notNull(deleteExampleOptions, "deleteExampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; - String[] pathParameters = { deleteExampleOptions.workspaceId(), deleteExampleOptions.intent(), - deleteExampleOptions.text() }; + String[] pathParameters = { deleteExampleOptions.workspaceId(), deleteExampleOptions.intent(), deleteExampleOptions + .text() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query(VERSION, versionDate); @@ -542,7 +574,8 @@ public ServiceCall deleteExample(DeleteExampleOptions deleteExampleOptions /** * Get user input example. * - * Get information about a user input example. + * Get information about a user input example. This operation is limited to 6000 requests per 5 minutes. For more + * information, see **Rate limiting**. * * @param getExampleOptions the {@link GetExampleOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Example} @@ -550,8 +583,7 @@ public ServiceCall deleteExample(DeleteExampleOptions deleteExampleOptions public ServiceCall getExample(GetExampleOptions getExampleOptions) { Validator.notNull(getExampleOptions, "getExampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; - String[] pathParameters = { getExampleOptions.workspaceId(), getExampleOptions.intent(), getExampleOptions - .text() }; + String[] pathParameters = { getExampleOptions.workspaceId(), getExampleOptions.intent(), getExampleOptions.text() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query(VERSION, versionDate); @@ -564,7 +596,8 @@ public ServiceCall getExample(GetExampleOptions getExampleOptions) { /** * List user input examples. * - * List the user input examples for an intent. + * List the user input examples for an intent. This operation is limited to 2500 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param listExamplesOptions the {@link ListExamplesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ExampleCollection} @@ -597,7 +630,8 @@ public ServiceCall listExamples(ListExamplesOptions listExamp /** * Update user input example. * - * Update the text of a user input example. + * Update the text of a user input example. This operation is limited to 1000 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param updateExampleOptions the {@link UpdateExampleOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Example} @@ -605,8 +639,8 @@ public ServiceCall listExamples(ListExamplesOptions listExamp public ServiceCall updateExample(UpdateExampleOptions updateExampleOptions) { Validator.notNull(updateExampleOptions, "updateExampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; - String[] pathParameters = { updateExampleOptions.workspaceId(), updateExampleOptions.intent(), - updateExampleOptions.text() }; + String[] pathParameters = { updateExampleOptions.workspaceId(), updateExampleOptions.intent(), updateExampleOptions + .text() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query(VERSION, versionDate); @@ -618,10 +652,133 @@ public ServiceCall updateExample(UpdateExampleOptions updateExampleOpti return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Example.class)); } + /** + * Create counterexample. + * + * Add a new counterexample to a workspace. Counterexamples are examples that have been marked as irrelevant input. + * This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. + * + * @param createCounterexampleOptions the {@link CreateCounterexampleOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link Counterexample} + */ + public ServiceCall createCounterexample(CreateCounterexampleOptions createCounterexampleOptions) { + Validator.notNull(createCounterexampleOptions, "createCounterexampleOptions cannot be null"); + String[] pathSegments = { "v1/workspaces", "counterexamples" }; + String[] pathParameters = { createCounterexampleOptions.workspaceId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, + pathParameters)); + builder.query(VERSION, versionDate); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("text", createCounterexampleOptions.text()); + builder.bodyJson(contentJson); + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class)); + } + + /** + * Delete counterexample. + * + * Delete a counterexample from a workspace. Counterexamples are examples that have been marked as irrelevant input. + * This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. + * + * @param deleteCounterexampleOptions the {@link DeleteCounterexampleOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of Void + */ + public ServiceCall deleteCounterexample(DeleteCounterexampleOptions deleteCounterexampleOptions) { + Validator.notNull(deleteCounterexampleOptions, "deleteCounterexampleOptions cannot be null"); + String[] pathSegments = { "v1/workspaces", "counterexamples" }; + String[] pathParameters = { deleteCounterexampleOptions.workspaceId(), deleteCounterexampleOptions.text() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, + pathParameters)); + builder.query(VERSION, versionDate); + return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); + } + + /** + * Get counterexample. + * + * Get information about a counterexample. Counterexamples are examples that have been marked as irrelevant input. + * This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**. + * + * @param getCounterexampleOptions the {@link GetCounterexampleOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link Counterexample} + */ + public ServiceCall getCounterexample(GetCounterexampleOptions getCounterexampleOptions) { + Validator.notNull(getCounterexampleOptions, "getCounterexampleOptions cannot be null"); + String[] pathSegments = { "v1/workspaces", "counterexamples" }; + String[] pathParameters = { getCounterexampleOptions.workspaceId(), getCounterexampleOptions.text() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, + pathParameters)); + builder.query(VERSION, versionDate); + if (getCounterexampleOptions.includeAudit() != null) { + builder.query("include_audit", String.valueOf(getCounterexampleOptions.includeAudit())); + } + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class)); + } + + /** + * List counterexamples. + * + * List the counterexamples for a workspace. Counterexamples are examples that have been marked as irrelevant input. + * This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**. + * + * @param listCounterexamplesOptions the {@link ListCounterexamplesOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link CounterexampleCollection} + */ + public ServiceCall listCounterexamples( + ListCounterexamplesOptions listCounterexamplesOptions) { + Validator.notNull(listCounterexamplesOptions, "listCounterexamplesOptions cannot be null"); + String[] pathSegments = { "v1/workspaces", "counterexamples" }; + String[] pathParameters = { listCounterexamplesOptions.workspaceId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, + pathParameters)); + builder.query(VERSION, versionDate); + if (listCounterexamplesOptions.pageLimit() != null) { + builder.query("page_limit", String.valueOf(listCounterexamplesOptions.pageLimit())); + } + if (listCounterexamplesOptions.includeCount() != null) { + builder.query("include_count", String.valueOf(listCounterexamplesOptions.includeCount())); + } + if (listCounterexamplesOptions.sort() != null) { + builder.query("sort", listCounterexamplesOptions.sort()); + } + if (listCounterexamplesOptions.cursor() != null) { + builder.query("cursor", listCounterexamplesOptions.cursor()); + } + if (listCounterexamplesOptions.includeAudit() != null) { + builder.query("include_audit", String.valueOf(listCounterexamplesOptions.includeAudit())); + } + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CounterexampleCollection.class)); + } + + /** + * Update counterexample. + * + * Update the text of a counterexample. Counterexamples are examples that have been marked as irrelevant input. This + * operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. + * + * @param updateCounterexampleOptions the {@link UpdateCounterexampleOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link Counterexample} + */ + public ServiceCall updateCounterexample(UpdateCounterexampleOptions updateCounterexampleOptions) { + Validator.notNull(updateCounterexampleOptions, "updateCounterexampleOptions cannot be null"); + String[] pathSegments = { "v1/workspaces", "counterexamples" }; + String[] pathParameters = { updateCounterexampleOptions.workspaceId(), updateCounterexampleOptions.text() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, + pathParameters)); + builder.query(VERSION, versionDate); + final JsonObject contentJson = new JsonObject(); + if (updateCounterexampleOptions.newText() != null) { + contentJson.addProperty("text", updateCounterexampleOptions.newText()); + } + builder.bodyJson(contentJson); + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class)); + } + /** * Create entity. * - * Create a new entity. + * Create a new entity. This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @param createEntityOptions the {@link CreateEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Entity} @@ -654,7 +811,8 @@ public ServiceCall createEntity(CreateEntityOptions createEntityOptions) /** * Delete entity. * - * Delete an entity from a workspace. + * Delete an entity from a workspace. This operation is limited to 1000 requests per 30 minutes. For more information, + * see **Rate limiting**. * * @param deleteEntityOptions the {@link DeleteEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -672,7 +830,9 @@ public ServiceCall deleteEntity(DeleteEntityOptions deleteEntityOptions) { /** * Get entity. * - * Get information about an entity, optionally including all entity content. + * Get information about an entity, optionally including all entity content. With **export**=`false`, this operation + * is limited to 6000 requests per 5 minutes. With **export**=`true`, the limit is 200 requests per 30 minutes. For + * more information, see **Rate limiting**. * * @param getEntityOptions the {@link GetEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link EntityExport} @@ -696,7 +856,9 @@ public ServiceCall getEntity(GetEntityOptions getEntityOptions) { /** * List entities. * - * List the entities for a workspace. + * List the entities for a workspace. With **export**=`false`, this operation is limited to 1000 requests per 30 + * minutes. With **export**=`true`, the limit is 200 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @param listEntitiesOptions the {@link ListEntitiesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link EntityCollection} @@ -732,7 +894,9 @@ public ServiceCall listEntities(ListEntitiesOptions listEntiti /** * Update entity. * - * Update an existing entity with new or modified data. + * Update an existing entity with new or modified data. You must provide component objects defining the content of the + * updated entity. This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate + * limiting**. * * @param updateEntityOptions the {@link UpdateEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Entity} @@ -767,7 +931,8 @@ public ServiceCall updateEntity(UpdateEntityOptions updateEntityOptions) /** * Add entity value. * - * Create a new value for an entity. + * Create a new value for an entity. This operation is limited to 1000 requests per 30 minutes. For more information, + * see **Rate limiting**. * * @param createValueOptions the {@link CreateValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Value} @@ -800,7 +965,8 @@ public ServiceCall createValue(CreateValueOptions createValueOptions) { /** * Delete entity value. * - * Delete a value for an entity. + * Delete a value from an entity. This operation is limited to 1000 requests per 30 minutes. For more information, see + * **Rate limiting**. * * @param deleteValueOptions the {@link DeleteValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -819,7 +985,8 @@ public ServiceCall deleteValue(DeleteValueOptions deleteValueOptions) { /** * Get entity value. * - * Get information about an entity value. + * Get information about an entity value. This operation is limited to 6000 requests per 5 minutes. For more + * information, see **Rate limiting**. * * @param getValueOptions the {@link GetValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ValueExport} @@ -843,7 +1010,8 @@ public ServiceCall getValue(GetValueOptions getValueOptions) { /** * List entity values. * - * List the values for an entity. + * List the values for an entity. This operation is limited to 2500 requests per 30 minutes. For more information, see + * **Rate limiting**. * * @param listValuesOptions the {@link ListValuesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ValueCollection} @@ -879,7 +1047,9 @@ public ServiceCall listValues(ListValuesOptions listValuesOptio /** * Update entity value. * - * Update the content of a value for an entity. + * Update an existing entity value with new or modified data. You must provide component objects defining the content + * of the updated entity value. This operation is limited to 1000 requests per 30 minutes. For more information, see + * **Rate limiting**. * * @param updateValueOptions the {@link UpdateValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Value} @@ -915,7 +1085,8 @@ public ServiceCall updateValue(UpdateValueOptions updateValueOptions) { /** * Add entity value synonym. * - * Add a new synonym to an entity value. + * Add a new synonym to an entity value. This operation is limited to 1000 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param createSynonymOptions the {@link CreateSynonymOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Synonym} @@ -923,8 +1094,8 @@ public ServiceCall updateValue(UpdateValueOptions updateValueOptions) { public ServiceCall createSynonym(CreateSynonymOptions createSynonymOptions) { Validator.notNull(createSynonymOptions, "createSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; - String[] pathParameters = { createSynonymOptions.workspaceId(), createSynonymOptions.entity(), - createSynonymOptions.value() }; + String[] pathParameters = { createSynonymOptions.workspaceId(), createSynonymOptions.entity(), createSynonymOptions + .value() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query(VERSION, versionDate); @@ -937,7 +1108,8 @@ public ServiceCall createSynonym(CreateSynonymOptions createSynonymOpti /** * Delete entity value synonym. * - * Delete a synonym for an entity value. + * Delete a synonym from an entity value. This operation is limited to 1000 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param deleteSynonymOptions the {@link DeleteSynonymOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -945,8 +1117,8 @@ public ServiceCall createSynonym(CreateSynonymOptions createSynonymOpti public ServiceCall deleteSynonym(DeleteSynonymOptions deleteSynonymOptions) { Validator.notNull(deleteSynonymOptions, "deleteSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; - String[] pathParameters = { deleteSynonymOptions.workspaceId(), deleteSynonymOptions.entity(), - deleteSynonymOptions.value(), deleteSynonymOptions.synonym() }; + String[] pathParameters = { deleteSynonymOptions.workspaceId(), deleteSynonymOptions.entity(), deleteSynonymOptions + .value(), deleteSynonymOptions.synonym() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query(VERSION, versionDate); @@ -956,7 +1128,8 @@ public ServiceCall deleteSynonym(DeleteSynonymOptions deleteSynonymOptions /** * Get entity value synonym. * - * Get information about a synonym for an entity value. + * Get information about a synonym of an entity value. This operation is limited to 6000 requests per 5 minutes. For + * more information, see **Rate limiting**. * * @param getSynonymOptions the {@link GetSynonymOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Synonym} @@ -964,8 +1137,8 @@ public ServiceCall deleteSynonym(DeleteSynonymOptions deleteSynonymOptions public ServiceCall getSynonym(GetSynonymOptions getSynonymOptions) { Validator.notNull(getSynonymOptions, "getSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; - String[] pathParameters = { getSynonymOptions.workspaceId(), getSynonymOptions.entity(), getSynonymOptions - .value(), getSynonymOptions.synonym() }; + String[] pathParameters = { getSynonymOptions.workspaceId(), getSynonymOptions.entity(), getSynonymOptions.value(), + getSynonymOptions.synonym() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query(VERSION, versionDate); @@ -978,7 +1151,8 @@ public ServiceCall getSynonym(GetSynonymOptions getSynonymOptions) { /** * List entity value synonyms. * - * List the synonyms for an entity value. + * List the synonyms for an entity value. This operation is limited to 2500 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param listSynonymsOptions the {@link ListSynonymsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link SynonymCollection} @@ -1012,7 +1186,8 @@ public ServiceCall listSynonyms(ListSynonymsOptions listSynon /** * Update entity value synonym. * - * Update the information about a synonym for an entity value. + * Update an existing entity value synonym with new text. This operation is limited to 1000 requests per 30 minutes. + * For more information, see **Rate limiting**. * * @param updateSynonymOptions the {@link UpdateSynonymOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Synonym} @@ -1020,8 +1195,8 @@ public ServiceCall listSynonyms(ListSynonymsOptions listSynon public ServiceCall updateSynonym(UpdateSynonymOptions updateSynonymOptions) { Validator.notNull(updateSynonymOptions, "updateSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; - String[] pathParameters = { updateSynonymOptions.workspaceId(), updateSynonymOptions.entity(), - updateSynonymOptions.value(), updateSynonymOptions.synonym() }; + String[] pathParameters = { updateSynonymOptions.workspaceId(), updateSynonymOptions.entity(), updateSynonymOptions + .value(), updateSynonymOptions.synonym() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query(VERSION, versionDate); @@ -1036,7 +1211,8 @@ public ServiceCall updateSynonym(UpdateSynonymOptions updateSynonymOpti /** * Create dialog node. * - * Create a dialog node. + * Create a new dialog node. This operation is limited to 500 requests per 30 minutes. For more information, see + * **Rate limiting**. * * @param createDialogNodeOptions the {@link CreateDialogNodeOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DialogNode} @@ -1089,6 +1265,15 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi if (createDialogNodeOptions.variable() != null) { contentJson.addProperty("variable", createDialogNodeOptions.variable()); } + if (createDialogNodeOptions.digressIn() != null) { + contentJson.addProperty("digress_in", createDialogNodeOptions.digressIn()); + } + if (createDialogNodeOptions.digressOut() != null) { + contentJson.addProperty("digress_out", createDialogNodeOptions.digressOut()); + } + if (createDialogNodeOptions.digressOutSlots() != null) { + contentJson.addProperty("digress_out_slots", createDialogNodeOptions.digressOutSlots()); + } builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DialogNode.class)); } @@ -1096,7 +1281,8 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi /** * Delete dialog node. * - * Delete a dialog node from the workspace. + * Delete a dialog node from a workspace. This operation is limited to 500 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param deleteDialogNodeOptions the {@link DeleteDialogNodeOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -1114,7 +1300,8 @@ public ServiceCall deleteDialogNode(DeleteDialogNodeOptions deleteDialogNo /** * Get dialog node. * - * Get information about a dialog node. + * Get information about a dialog node. This operation is limited to 6000 requests per 5 minutes. For more + * information, see **Rate limiting**. * * @param getDialogNodeOptions the {@link GetDialogNodeOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DialogNode} @@ -1135,7 +1322,8 @@ public ServiceCall getDialogNode(GetDialogNodeOptions getDialogNodeO /** * List dialog nodes. * - * List the dialog nodes in the workspace. + * List the dialog nodes for a workspace. This operation is limited to 2500 requests per 30 minutes. For more + * information, see **Rate limiting**. * * @param listDialogNodesOptions the {@link ListDialogNodesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DialogNodeCollection} @@ -1168,7 +1356,8 @@ public ServiceCall listDialogNodes(ListDialogNodesOptions /** * Update dialog node. * - * Update information for a dialog node. + * Update an existing dialog node with new or modified data. This operation is limited to 500 requests per 30 minutes. + * For more information, see **Rate limiting**. * * @param updateDialogNodeOptions the {@link UpdateDialogNodeOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DialogNode} @@ -1208,12 +1397,21 @@ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDi if (updateDialogNodeOptions.newDescription() != null) { contentJson.addProperty("description", updateDialogNodeOptions.newDescription()); } + if (updateDialogNodeOptions.newDigressOut() != null) { + contentJson.addProperty("digress_out", updateDialogNodeOptions.newDigressOut()); + } if (updateDialogNodeOptions.newEventName() != null) { contentJson.addProperty("event_name", updateDialogNodeOptions.newEventName()); } + if (updateDialogNodeOptions.newDigressOutSlots() != null) { + contentJson.addProperty("digress_out_slots", updateDialogNodeOptions.newDigressOutSlots()); + } if (updateDialogNodeOptions.newNextStep() != null) { contentJson.add("next_step", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newNextStep())); } + if (updateDialogNodeOptions.newDigressIn() != null) { + contentJson.addProperty("digress_in", updateDialogNodeOptions.newDigressIn()); + } if (updateDialogNodeOptions.newOutput() != null) { contentJson.add("output", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newOutput())); } @@ -1230,7 +1428,9 @@ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDi /** * List log events in all workspaces. * - * List log events in all workspaces in the service instance. + * List the events from the logs of all workspaces in the service instance. If **cursor** is not specified, this + * operation is limited to 40 requests per 30 minutes. If **cursor** is specified, the limit is 120 requests per + * minute. For more information, see **Rate limiting**. * * @param listAllLogsOptions the {@link ListAllLogsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LogCollection} @@ -1256,7 +1456,9 @@ public ServiceCall listAllLogs(ListAllLogsOptions listAllLogsOpti /** * List log events in a workspace. * - * List log events in a specific workspace. + * List the events from the log of a specific workspace. If **cursor** is not specified, this operation is limited to + * 40 requests per 30 minutes. If **cursor** is specified, the limit is 120 requests per minute. For more information, + * see **Rate limiting**. * * @param listLogsOptions the {@link ListLogsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LogCollection} @@ -1283,121 +1485,4 @@ public ServiceCall listLogs(ListLogsOptions listLogsOptions) { return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LogCollection.class)); } - /** - * Create counterexample. - * - * Add a new counterexample to a workspace. Counterexamples are examples that have been marked as irrelevant input. - * - * @param createCounterexampleOptions the {@link CreateCounterexampleOptions} containing the options for the call - * @return a {@link ServiceCall} with a response type of {@link Counterexample} - */ - public ServiceCall createCounterexample(CreateCounterexampleOptions createCounterexampleOptions) { - Validator.notNull(createCounterexampleOptions, "createCounterexampleOptions cannot be null"); - String[] pathSegments = { "v1/workspaces", "counterexamples" }; - String[] pathParameters = { createCounterexampleOptions.workspaceId() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, - pathParameters)); - builder.query(VERSION, versionDate); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("text", createCounterexampleOptions.text()); - builder.bodyJson(contentJson); - return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class)); - } - - /** - * Delete counterexample. - * - * Delete a counterexample from a workspace. Counterexamples are examples that have been marked as irrelevant input. - * - * @param deleteCounterexampleOptions the {@link DeleteCounterexampleOptions} containing the options for the call - * @return a {@link ServiceCall} with a response type of Void - */ - public ServiceCall deleteCounterexample(DeleteCounterexampleOptions deleteCounterexampleOptions) { - Validator.notNull(deleteCounterexampleOptions, "deleteCounterexampleOptions cannot be null"); - String[] pathSegments = { "v1/workspaces", "counterexamples" }; - String[] pathParameters = { deleteCounterexampleOptions.workspaceId(), deleteCounterexampleOptions.text() }; - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, - pathParameters)); - builder.query(VERSION, versionDate); - return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); - } - - /** - * Get counterexample. - * - * Get information about a counterexample. Counterexamples are examples that have been marked as irrelevant input. - * - * @param getCounterexampleOptions the {@link GetCounterexampleOptions} containing the options for the call - * @return a {@link ServiceCall} with a response type of {@link Counterexample} - */ - public ServiceCall getCounterexample(GetCounterexampleOptions getCounterexampleOptions) { - Validator.notNull(getCounterexampleOptions, "getCounterexampleOptions cannot be null"); - String[] pathSegments = { "v1/workspaces", "counterexamples" }; - String[] pathParameters = { getCounterexampleOptions.workspaceId(), getCounterexampleOptions.text() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, - pathParameters)); - builder.query(VERSION, versionDate); - if (getCounterexampleOptions.includeAudit() != null) { - builder.query("include_audit", String.valueOf(getCounterexampleOptions.includeAudit())); - } - return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class)); - } - - /** - * List counterexamples. - * - * List the counterexamples for a workspace. Counterexamples are examples that have been marked as irrelevant input. - * - * @param listCounterexamplesOptions the {@link ListCounterexamplesOptions} containing the options for the call - * @return a {@link ServiceCall} with a response type of {@link CounterexampleCollection} - */ - public ServiceCall listCounterexamples( - ListCounterexamplesOptions listCounterexamplesOptions) { - Validator.notNull(listCounterexamplesOptions, "listCounterexamplesOptions cannot be null"); - String[] pathSegments = { "v1/workspaces", "counterexamples" }; - String[] pathParameters = { listCounterexamplesOptions.workspaceId() }; - RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, - pathParameters)); - builder.query(VERSION, versionDate); - if (listCounterexamplesOptions.pageLimit() != null) { - builder.query("page_limit", String.valueOf(listCounterexamplesOptions.pageLimit())); - } - if (listCounterexamplesOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listCounterexamplesOptions.includeCount())); - } - if (listCounterexamplesOptions.sort() != null) { - builder.query("sort", listCounterexamplesOptions.sort()); - } - if (listCounterexamplesOptions.cursor() != null) { - builder.query("cursor", listCounterexamplesOptions.cursor()); - } - if (listCounterexamplesOptions.includeAudit() != null) { - builder.query("include_audit", String.valueOf(listCounterexamplesOptions.includeAudit())); - } - return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CounterexampleCollection.class)); - } - - /** - * Update counterexample. - * - * Update the text of a counterexample. Counterexamples are examples that have been marked as irrelevant input. - * - * @param updateCounterexampleOptions the {@link UpdateCounterexampleOptions} containing the options for the call - * @return a {@link ServiceCall} with a response type of {@link Counterexample} - */ - public ServiceCall updateCounterexample(UpdateCounterexampleOptions updateCounterexampleOptions) { - Validator.notNull(updateCounterexampleOptions, "updateCounterexampleOptions cannot be null"); - String[] pathSegments = { "v1/workspaces", "counterexamples" }; - String[] pathParameters = { updateCounterexampleOptions.workspaceId(), updateCounterexampleOptions.text() }; - RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, - pathParameters)); - builder.query(VERSION, versionDate); - final JsonObject contentJson = new JsonObject(); - if (updateCounterexampleOptions.newText() != null) { - contentJson.addProperty("text", updateCounterexampleOptions.newText()); - } - builder.bodyJson(contentJson); - return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class)); - } - } diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Context.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Context.java index b786df989e9..d65245af84a 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Context.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Context.java @@ -19,8 +19,7 @@ import com.ibm.watson.developer_cloud.util.GsonSerializationHelper; /** - * Context information for the message. Include the context from the previous response to maintain state for the - * conversation. + * State information for the conversation. To maintain state, include the context from the previous response. */ public class Context extends DynamicModel { private Type conversationIdType = new TypeToken() { diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CounterexampleCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CounterexampleCollection.java index 2abfd66e876..b60fe853420 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CounterexampleCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CounterexampleCollection.java @@ -38,7 +38,7 @@ public List getCounterexamples() { /** * Gets the pagination. * - * An object defining the pagination data for the returned objects. + * The pagination data for the returned objects. * * @return the pagination */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexample.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexample.java index 7328507b956..b44e742f86a 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexample.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexample.java @@ -85,7 +85,9 @@ public Builder newBuilder() { /** * Gets the text. * - * The text of a user input marked as irrelevant input. + * The text of a user input marked as irrelevant input. This string must conform to the following restrictions: - It + * cannot contain carriage return, newline, or tab characters - It cannot consist of only whitespace characters - It + * must be no longer than 1024 characters. * * @return the text */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexampleOptions.java index 6326f3b965e..a73d7d5e102 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexampleOptions.java @@ -103,7 +103,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -114,7 +114,9 @@ public String workspaceId() { /** * Gets the text. * - * The text of a user input marked as irrelevant input. + * The text of a user input marked as irrelevant input. This string must conform to the following restrictions: - It + * cannot contain carriage return, newline, or tab characters - It cannot consist of only whitespace characters - It + * must be no longer than 1024 characters. * * @return the text */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNode.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNode.java index 99f99d05060..d5696a46971 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNode.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNode.java @@ -39,6 +39,8 @@ public interface NodeType { String SLOT = "slot"; /** response_condition. */ String RESPONSE_CONDITION = "response_condition"; + /** folder. */ + String FOLDER = "folder"; } /** @@ -63,6 +65,42 @@ public interface EventName { String NOMATCH_RESPONSES_DEPLETED = "nomatch_responses_depleted"; } + /** + * Whether this top-level dialog node can be digressed into. + */ + public interface DigressIn { + /** not_available. */ + String NOT_AVAILABLE = "not_available"; + /** returns. */ + String RETURNS = "returns"; + /** does_not_return. */ + String DOES_NOT_RETURN = "does_not_return"; + } + + /** + * Whether this dialog node can be returned to after a digression. + */ + public interface DigressOut { + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + /** allow_all_never_return. */ + String ALLOW_ALL_NEVER_RETURN = "allow_all_never_return"; + } + + /** + * Whether the user can digress to top-level nodes while filling out slots. + */ + public interface DigressOutSlots { + /** not_allowed. */ + String NOT_ALLOWED = "not_allowed"; + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + } + @SerializedName("dialog_node") private String dialogNode; private String description; @@ -82,6 +120,12 @@ public interface EventName { @SerializedName("event_name") private String eventName; private String variable; + @SerializedName("digress_in") + private String digressIn; + @SerializedName("digress_out") + private String digressOut; + @SerializedName("digress_out_slots") + private String digressOutSlots; /** * Builder. @@ -101,6 +145,9 @@ public static class Builder { private String nodeType; private String eventName; private String variable; + private String digressIn; + private String digressOut; + private String digressOutSlots; private Builder(CreateDialogNode createDialogNode) { dialogNode = createDialogNode.dialogNode; @@ -117,6 +164,9 @@ private Builder(CreateDialogNode createDialogNode) { nodeType = createDialogNode.nodeType; eventName = createDialogNode.eventName; variable = createDialogNode.variable; + digressIn = createDialogNode.digressIn; + digressOut = createDialogNode.digressOut; + digressOutSlots = createDialogNode.digressOutSlots; } /** @@ -312,6 +362,39 @@ public Builder variable(String variable) { this.variable = variable; return this; } + + /** + * Set the digressIn. + * + * @param digressIn the digressIn + * @return the CreateDialogNode builder + */ + public Builder digressIn(String digressIn) { + this.digressIn = digressIn; + return this; + } + + /** + * Set the digressOut. + * + * @param digressOut the digressOut + * @return the CreateDialogNode builder + */ + public Builder digressOut(String digressOut) { + this.digressOut = digressOut; + return this; + } + + /** + * Set the digressOutSlots. + * + * @param digressOutSlots the digressOutSlots + * @return the CreateDialogNode builder + */ + public Builder digressOutSlots(String digressOutSlots) { + this.digressOutSlots = digressOutSlots; + return this; + } } private CreateDialogNode(Builder builder) { @@ -330,6 +413,9 @@ private CreateDialogNode(Builder builder) { nodeType = builder.nodeType; eventName = builder.eventName; variable = builder.variable; + digressIn = builder.digressIn; + digressOut = builder.digressOut; + digressOutSlots = builder.digressOutSlots; } /** @@ -344,7 +430,8 @@ public Builder newBuilder() { /** * Gets the dialogNode. * - * The dialog node ID. + * The dialog node ID. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, space, underscore, hyphen, and dot characters. - It must be no longer than 1024 characters. * * @return the dialogNode */ @@ -355,7 +442,8 @@ public String dialogNode() { /** * Gets the description. * - * The description of the dialog node. + * The description of the dialog node. This string cannot contain carriage return, newline, or tab characters, and it + * must be no longer than 128 characters. * * @return the description */ @@ -366,7 +454,8 @@ public String description() { /** * Gets the conditions. * - * The condition that will trigger the dialog node. + * The condition that will trigger the dialog node. This string cannot contain carriage return, newline, or tab + * characters, and it must be no longer than 2048 characters. * * @return the conditions */ @@ -377,7 +466,7 @@ public String conditions() { /** * Gets the parent. * - * The ID of the parent dialog node (if any). + * The ID of the parent dialog node. * * @return the parent */ @@ -388,7 +477,7 @@ public String parent() { /** * Gets the previousSibling. * - * The previous dialog node. + * The ID of the previous dialog node. * * @return the previousSibling */ @@ -399,7 +488,8 @@ public String previousSibling() { /** * Gets the output. * - * The output of the dialog node. + * The output of the dialog node. For more information about how to specify dialog node output, see the + * [documentation](https://console.bluemix.net/docs/services/conversation/dialog-overview.html#complex). * * @return the output */ @@ -432,7 +522,7 @@ public Map metadata() { /** * Gets the nextStep. * - * The next step to execute following this dialog node. + * The next step to be executed in dialog processing. * * @return the nextStep */ @@ -443,7 +533,7 @@ public DialogNodeNextStep nextStep() { /** * Gets the actions. * - * The actions for the dialog node. + * An array of objects describing any actions to be invoked by the dialog node. * * @return the actions */ @@ -454,7 +544,9 @@ public List actions() { /** * Gets the title. * - * The alias used to identify the dialog node. + * The alias used to identify the dialog node. This string must conform to the following restrictions: - It can + * contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. - It must be no longer than 64 + * characters. * * @return the title */ @@ -494,4 +586,37 @@ public String eventName() { public String variable() { return variable; } + + /** + * Gets the digressIn. + * + * Whether this top-level dialog node can be digressed into. + * + * @return the digressIn + */ + public String digressIn() { + return digressIn; + } + + /** + * Gets the digressOut. + * + * Whether this dialog node can be returned to after a digression. + * + * @return the digressOut + */ + public String digressOut() { + return digressOut; + } + + /** + * Gets the digressOutSlots. + * + * Whether the user can digress to top-level nodes while filling out slots. + * + * @return the digressOutSlots + */ + public String digressOutSlots() { + return digressOutSlots; + } } diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNodeOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNodeOptions.java index a78898f00dc..368ab505b39 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNodeOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateDialogNodeOptions.java @@ -38,6 +38,8 @@ public interface NodeType { String SLOT = "slot"; /** response_condition. */ String RESPONSE_CONDITION = "response_condition"; + /** folder. */ + String FOLDER = "folder"; } /** @@ -62,6 +64,42 @@ public interface EventName { String NOMATCH_RESPONSES_DEPLETED = "nomatch_responses_depleted"; } + /** + * Whether this top-level dialog node can be digressed into. + */ + public interface DigressIn { + /** not_available. */ + String NOT_AVAILABLE = "not_available"; + /** returns. */ + String RETURNS = "returns"; + /** does_not_return. */ + String DOES_NOT_RETURN = "does_not_return"; + } + + /** + * Whether this dialog node can be returned to after a digression. + */ + public interface DigressOut { + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + /** allow_all_never_return. */ + String ALLOW_ALL_NEVER_RETURN = "allow_all_never_return"; + } + + /** + * Whether the user can digress to top-level nodes while filling out slots. + */ + public interface DigressOutSlots { + /** not_allowed. */ + String NOT_ALLOWED = "not_allowed"; + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + } + private String workspaceId; private String dialogNode; private String description; @@ -77,6 +115,9 @@ public interface EventName { private String nodeType; private String eventName; private String variable; + private String digressIn; + private String digressOut; + private String digressOutSlots; /** * Builder. @@ -97,6 +138,9 @@ public static class Builder { private String nodeType; private String eventName; private String variable; + private String digressIn; + private String digressOut; + private String digressOutSlots; private Builder(CreateDialogNodeOptions createDialogNodeOptions) { workspaceId = createDialogNodeOptions.workspaceId; @@ -114,6 +158,9 @@ private Builder(CreateDialogNodeOptions createDialogNodeOptions) { nodeType = createDialogNodeOptions.nodeType; eventName = createDialogNodeOptions.eventName; variable = createDialogNodeOptions.variable; + digressIn = createDialogNodeOptions.digressIn; + digressOut = createDialogNodeOptions.digressOut; + digressOutSlots = createDialogNodeOptions.digressOutSlots; } /** @@ -322,6 +369,39 @@ public Builder variable(String variable) { this.variable = variable; return this; } + + /** + * Set the digressIn. + * + * @param digressIn the digressIn + * @return the CreateDialogNodeOptions builder + */ + public Builder digressIn(String digressIn) { + this.digressIn = digressIn; + return this; + } + + /** + * Set the digressOut. + * + * @param digressOut the digressOut + * @return the CreateDialogNodeOptions builder + */ + public Builder digressOut(String digressOut) { + this.digressOut = digressOut; + return this; + } + + /** + * Set the digressOutSlots. + * + * @param digressOutSlots the digressOutSlots + * @return the CreateDialogNodeOptions builder + */ + public Builder digressOutSlots(String digressOutSlots) { + this.digressOutSlots = digressOutSlots; + return this; + } } private CreateDialogNodeOptions(Builder builder) { @@ -342,6 +422,9 @@ private CreateDialogNodeOptions(Builder builder) { nodeType = builder.nodeType; eventName = builder.eventName; variable = builder.variable; + digressIn = builder.digressIn; + digressOut = builder.digressOut; + digressOutSlots = builder.digressOutSlots; } /** @@ -356,7 +439,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -367,7 +450,8 @@ public String workspaceId() { /** * Gets the dialogNode. * - * The dialog node ID. + * The dialog node ID. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, space, underscore, hyphen, and dot characters. - It must be no longer than 1024 characters. * * @return the dialogNode */ @@ -378,7 +462,8 @@ public String dialogNode() { /** * Gets the description. * - * The description of the dialog node. + * The description of the dialog node. This string cannot contain carriage return, newline, or tab characters, and it + * must be no longer than 128 characters. * * @return the description */ @@ -389,7 +474,8 @@ public String description() { /** * Gets the conditions. * - * The condition that will trigger the dialog node. + * The condition that will trigger the dialog node. This string cannot contain carriage return, newline, or tab + * characters, and it must be no longer than 2048 characters. * * @return the conditions */ @@ -400,7 +486,7 @@ public String conditions() { /** * Gets the parent. * - * The ID of the parent dialog node (if any). + * The ID of the parent dialog node. * * @return the parent */ @@ -411,7 +497,7 @@ public String parent() { /** * Gets the previousSibling. * - * The previous dialog node. + * The ID of the previous dialog node. * * @return the previousSibling */ @@ -422,7 +508,8 @@ public String previousSibling() { /** * Gets the output. * - * The output of the dialog node. + * The output of the dialog node. For more information about how to specify dialog node output, see the + * [documentation](https://console.bluemix.net/docs/services/conversation/dialog-overview.html#complex). * * @return the output */ @@ -455,7 +542,7 @@ public Map metadata() { /** * Gets the nextStep. * - * The next step to execute following this dialog node. + * The next step to be executed in dialog processing. * * @return the nextStep */ @@ -466,7 +553,7 @@ public DialogNodeNextStep nextStep() { /** * Gets the actions. * - * The actions for the dialog node. + * An array of objects describing any actions to be invoked by the dialog node. * * @return the actions */ @@ -477,7 +564,9 @@ public List actions() { /** * Gets the title. * - * The alias used to identify the dialog node. + * The alias used to identify the dialog node. This string must conform to the following restrictions: - It can + * contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. - It must be no longer than 64 + * characters. * * @return the title */ @@ -517,4 +606,37 @@ public String eventName() { public String variable() { return variable; } + + /** + * Gets the digressIn. + * + * Whether this top-level dialog node can be digressed into. + * + * @return the digressIn + */ + public String digressIn() { + return digressIn; + } + + /** + * Gets the digressOut. + * + * Whether this dialog node can be returned to after a digression. + * + * @return the digressOut + */ + public String digressOut() { + return digressOut; + } + + /** + * Gets the digressOutSlots. + * + * Whether the user can digress to top-level nodes while filling out slots. + * + * @return the digressOutSlots + */ + public String digressOutSlots() { + return digressOutSlots; + } } diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntity.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntity.java index 2188e9c59d0..03a9fe1a99e 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntity.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntity.java @@ -167,7 +167,9 @@ public Builder newBuilder() { /** * Gets the entity. * - * The name of the entity. + * The name of the entity. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, underscore, and hyphen characters. - It cannot begin with the reserved prefix `sys-`. - It must be no + * longer than 64 characters. * * @return the entity */ @@ -178,7 +180,8 @@ public String entity() { /** * Gets the description. * - * The description of the entity. + * The description of the entity. This string cannot contain carriage return, newline, or tab characters, and it must + * be no longer than 128 characters. * * @return the description */ @@ -200,7 +203,7 @@ public Map metadata() { /** * Gets the values. * - * An array of entity values. + * An array of objects describing the entity values. * * @return the values */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntityOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntityOptions.java index b3a7518cae7..415fc736ddb 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntityOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateEntityOptions.java @@ -183,7 +183,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -194,7 +194,9 @@ public String workspaceId() { /** * Gets the entity. * - * The name of the entity. + * The name of the entity. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, underscore, and hyphen characters. - It cannot begin with the reserved prefix `sys-`. - It must be no + * longer than 64 characters. * * @return the entity */ @@ -205,7 +207,8 @@ public String entity() { /** * Gets the description. * - * The description of the entity. + * The description of the entity. This string cannot contain carriage return, newline, or tab characters, and it must + * be no longer than 128 characters. * * @return the description */ @@ -227,7 +230,7 @@ public Map metadata() { /** * Gets the values. * - * An array of entity values. + * An array of objects describing the entity values. * * @return the values */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExample.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExample.java index 4f53e2578f3..ae8b6cca12f 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExample.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExample.java @@ -85,7 +85,9 @@ public Builder newBuilder() { /** * Gets the text. * - * The text of a user input example. + * The text of a user input example. This string must conform to the following restrictions: - It cannot contain + * carriage return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no + * longer than 1024 characters. * * @return the text */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExampleOptions.java index 33b9847fac9..0f76eb40ca5 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExampleOptions.java @@ -121,7 +121,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -132,7 +132,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ @@ -143,7 +143,9 @@ public String intent() { /** * Gets the text. * - * The text of a user input example. + * The text of a user input example. This string must conform to the following restrictions: - It cannot contain + * carriage return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no + * longer than 1024 characters. * * @return the text */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntent.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntent.java index 0d008401e13..08a0a658209 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntent.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntent.java @@ -134,7 +134,9 @@ public Builder newBuilder() { /** * Gets the intent. * - * The name of the intent. + * The name of the intent. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, underscore, hyphen, and dot characters. - It cannot begin with the reserved prefix `sys-`. - It must + * be no longer than 128 characters. * * @return the intent */ @@ -145,7 +147,8 @@ public String intent() { /** * Gets the description. * - * The description of the intent. + * The description of the intent. This string cannot contain carriage return, newline, or tab characters, and it must + * be no longer than 128 characters. * * @return the description */ @@ -156,7 +159,7 @@ public String description() { /** * Gets the examples. * - * An array of user input examples. + * An array of user input examples for the intent. * * @return the examples */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntentOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntentOptions.java index 75b5bff8f23..f3bdd65c6dd 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntentOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntentOptions.java @@ -152,7 +152,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -163,7 +163,9 @@ public String workspaceId() { /** * Gets the intent. * - * The name of the intent. + * The name of the intent. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, underscore, hyphen, and dot characters. - It cannot begin with the reserved prefix `sys-`. - It must + * be no longer than 128 characters. * * @return the intent */ @@ -174,7 +176,8 @@ public String intent() { /** * Gets the description. * - * The description of the intent. + * The description of the intent. This string cannot contain carriage return, newline, or tab characters, and it must + * be no longer than 128 characters. * * @return the description */ @@ -185,7 +188,7 @@ public String description() { /** * Gets the examples. * - * An array of user input examples. + * An array of user input examples for the intent. * * @return the examples */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateSynonymOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateSynonymOptions.java index fd7dcc0e972..a32179c244c 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateSynonymOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateSynonymOptions.java @@ -139,7 +139,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -172,7 +172,9 @@ public String value() { /** * Gets the synonym. * - * The text of the synonym. + * The text of the synonym. This string must conform to the following restrictions: - It cannot contain carriage + * return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no longer than + * 64 characters. * * @return the synonym */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValue.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValue.java index be3be75fec8..9db30e47664 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValue.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValue.java @@ -26,7 +26,7 @@ public class CreateValue extends GenericModel { /** - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. */ public interface ValueType { /** synonyms. */ @@ -193,7 +193,9 @@ public Builder newBuilder() { /** * Gets the value. * - * The text of the entity value. + * The text of the entity value. This string must conform to the following restrictions: - It cannot contain carriage + * return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no longer than + * 64 characters. * * @return the value */ @@ -215,7 +217,10 @@ public Map metadata() { /** * Gets the synonyms. * - * An array of synonyms for the entity value. + * An array containing any synonyms for the entity value. You can provide either synonyms or patterns (as indicated by + * **type**), but not both. A synonym must conform to the following restrictions: - It cannot contain carriage return, + * newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no longer than 64 + * characters. * * @return the synonyms */ @@ -226,7 +231,10 @@ public List synonyms() { /** * Gets the patterns. * - * An array of patterns for the entity value. A pattern is specified as a regular expression. + * An array of patterns for the entity value. You can provide either synonyms or patterns (as indicated by **type**), + * but not both. A pattern is a regular expression no longer than 128 characters. For more information about how to + * specify a pattern, see the + * [documentation](https://console.bluemix.net/docs/services/conversation/entities.html#creating-entities). * * @return the patterns */ @@ -237,7 +245,7 @@ public List patterns() { /** * Gets the valueType. * - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. * * @return the valueType */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValueOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValueOptions.java index 365e3e7bfb5..924e4295db8 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValueOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateValueOptions.java @@ -25,7 +25,7 @@ public class CreateValueOptions extends GenericModel { /** - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. */ public interface ValueType { /** synonyms. */ @@ -227,7 +227,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -249,7 +249,9 @@ public String entity() { /** * Gets the value. * - * The text of the entity value. + * The text of the entity value. This string must conform to the following restrictions: - It cannot contain carriage + * return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no longer than + * 64 characters. * * @return the value */ @@ -271,7 +273,10 @@ public Map metadata() { /** * Gets the synonyms. * - * An array of synonyms for the entity value. + * An array containing any synonyms for the entity value. You can provide either synonyms or patterns (as indicated by + * **type**), but not both. A synonym must conform to the following restrictions: - It cannot contain carriage return, + * newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no longer than 64 + * characters. * * @return the synonyms */ @@ -282,7 +287,10 @@ public List synonyms() { /** * Gets the patterns. * - * An array of patterns for the entity value. A pattern is specified as a regular expression. + * An array of patterns for the entity value. You can provide either synonyms or patterns (as indicated by **type**), + * but not both. A pattern is a regular expression no longer than 128 characters. For more information about how to + * specify a pattern, see the + * [documentation](https://console.bluemix.net/docs/services/conversation/entities.html#creating-entities). * * @return the patterns */ @@ -293,7 +301,7 @@ public List patterns() { /** * Gets the valueType. * - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. * * @return the valueType */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateWorkspaceOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateWorkspaceOptions.java index 4a0fd8e9b3c..379d4537026 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateWorkspaceOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateWorkspaceOptions.java @@ -263,7 +263,8 @@ public Builder newBuilder() { /** * Gets the name. * - * The name of the workspace. + * The name of the workspace. This string cannot contain carriage return, newline, or tab characters, and it must be + * no longer than 64 characters. * * @return the name */ @@ -274,7 +275,8 @@ public String name() { /** * Gets the description. * - * The description of the workspace. + * The description of the workspace. This string cannot contain carriage return, newline, or tab characters, and it + * must be no longer than 128 characters. * * @return the description */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteCounterexampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteCounterexampleOptions.java index c5c5b41f9f9..0a30cc935e4 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteCounterexampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteCounterexampleOptions.java @@ -103,7 +103,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteDialogNodeOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteDialogNodeOptions.java index 88920b25a7f..e7c4e0977a7 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteDialogNodeOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteDialogNodeOptions.java @@ -103,7 +103,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteEntityOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteEntityOptions.java index 44911c738fa..12d91e30812 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteEntityOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteEntityOptions.java @@ -103,7 +103,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteExampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteExampleOptions.java index bd78c494892..8f92171e8de 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteExampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteExampleOptions.java @@ -121,7 +121,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -132,7 +132,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteIntentOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteIntentOptions.java index 0467d49b3e5..037f09e76a7 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteIntentOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteIntentOptions.java @@ -103,7 +103,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -114,7 +114,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteSynonymOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteSynonymOptions.java index 8f4c507dd73..afdcedcba82 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteSynonymOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteSynonymOptions.java @@ -139,7 +139,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteValueOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteValueOptions.java index 76e896ee547..6d4d658625f 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteValueOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteValueOptions.java @@ -121,7 +121,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteWorkspaceOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteWorkspaceOptions.java index 30e73f0679f..724e732037c 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteWorkspaceOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DeleteWorkspaceOptions.java @@ -85,7 +85,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNode.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNode.java index 3ef580d5fed..cf94b54f315 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNode.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNode.java @@ -38,6 +38,8 @@ public interface NodeType { String SLOT = "slot"; /** response_condition. */ String RESPONSE_CONDITION = "response_condition"; + /** folder. */ + String FOLDER = "folder"; } /** @@ -62,6 +64,42 @@ public interface EventName { String NOMATCH_RESPONSES_DEPLETED = "nomatch_responses_depleted"; } + /** + * Whether this top-level dialog node can be digressed into. + */ + public interface DigressIn { + /** not_available. */ + String NOT_AVAILABLE = "not_available"; + /** returns. */ + String RETURNS = "returns"; + /** does_not_return. */ + String DOES_NOT_RETURN = "does_not_return"; + } + + /** + * Whether this dialog node can be returned to after a digression. + */ + public interface DigressOut { + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + /** allow_all_never_return. */ + String ALLOW_ALL_NEVER_RETURN = "allow_all_never_return"; + } + + /** + * Whether the user can digress to top-level nodes while filling out slots. + */ + public interface DigressOutSlots { + /** not_allowed. */ + String NOT_ALLOWED = "not_allowed"; + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + } + @SerializedName("dialog_node") private String dialogNodeId; private String description; @@ -83,6 +121,12 @@ public interface EventName { @SerializedName("event_name") private String eventName; private String variable; + @SerializedName("digress_in") + private String digressIn; + @SerializedName("digress_out") + private String digressOut; + @SerializedName("digress_out_slots") + private String digressOutSlots; /** * Gets the dialogNodeId. @@ -120,7 +164,7 @@ public String getConditions() { /** * Gets the parent. * - * The ID of the parent dialog node. + * The ID of the parent dialog node. This property is not returned if the dialog node has no parent. * * @return the parent */ @@ -131,7 +175,8 @@ public String getParent() { /** * Gets the previousSibling. * - * The ID of the previous sibling dialog node. + * The ID of the previous sibling dialog node. This property is not returned if the dialog node has no previous + * sibling. * * @return the previousSibling */ @@ -164,7 +209,7 @@ public Map getContext() { /** * Gets the metadata. * - * The metadata (if any) for the dialog node. + * Any metadata for the dialog node. * * @return the metadata */ @@ -259,4 +304,37 @@ public String getEventName() { public String getVariable() { return variable; } + + /** + * Gets the digressIn. + * + * Whether this top-level dialog node can be digressed into. + * + * @return the digressIn + */ + public String getDigressIn() { + return digressIn; + } + + /** + * Gets the digressOut. + * + * Whether this dialog node can be returned to after a digression. + * + * @return the digressOut + */ + public String getDigressOut() { + return digressOut; + } + + /** + * Gets the digressOutSlots. + * + * Whether the user can digress to top-level nodes while filling out slots. + * + * @return the digressOutSlots + */ + public String getDigressOutSlots() { + return digressOutSlots; + } } diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeCollection.java index 3ce8b026899..7d15ee473f2 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeCollection.java @@ -18,7 +18,7 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; /** - * DialogNodeCollection. + * An array of dialog nodes. */ public class DialogNodeCollection extends GenericModel { @@ -29,6 +29,8 @@ public class DialogNodeCollection extends GenericModel { /** * Gets the dialogNodes. * + * An array of objects describing the dialog nodes defined for the workspace. + * * @return the dialogNodes */ public List getDialogNodes() { @@ -38,7 +40,7 @@ public List getDialogNodes() { /** * Gets the pagination. * - * An object defining the pagination data for the returned objects. + * The pagination data for the returned objects. * * @return the pagination */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeNextStep.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeNextStep.java index b94fa32ff0f..b8590fff795 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeNextStep.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeNextStep.java @@ -21,8 +21,13 @@ public class DialogNodeNextStep extends GenericModel { /** - * How the `next_step` reference is processed. If you specify `jump_to`, then you must also specify a value for the - * `dialog_node` property. + * What happens after the dialog node completes. The valid values depend on the node type: - The following values are + * valid for any node: - `get_user_input` - `skip_user_input` - `jump_to` - If the node is of type `event_handler` and + * its parent node is of type `slot` or `frame`, additional values are also valid: - if **event_name**=`filled` and + * the type of the parent node is `slot`: - `reprompt` - `skip_all_slots` - if **event_name**=`nomatch` and the type + * of the parent node is `slot`: - `reprompt` - `skip_slot` - `skip_all_slots` - if **event_name**=`generic` and the + * type of the parent node is `frame`: - `reprompt` - `skip_slot` - `skip_all_slots` If you specify `jump_to`, then + * you must also specify a value for the `dialog_node` property. */ public interface Behavior { /** get_user_input. */ @@ -61,8 +66,13 @@ public interface Selector { /** * Gets the behavior. * - * How the `next_step` reference is processed. If you specify `jump_to`, then you must also specify a value for the - * `dialog_node` property. + * What happens after the dialog node completes. The valid values depend on the node type: - The following values are + * valid for any node: - `get_user_input` - `skip_user_input` - `jump_to` - If the node is of type `event_handler` and + * its parent node is of type `slot` or `frame`, additional values are also valid: - if **event_name**=`filled` and + * the type of the parent node is `slot`: - `reprompt` - `skip_all_slots` - if **event_name**=`nomatch` and the type + * of the parent node is `slot`: - `reprompt` - `skip_slot` - `skip_all_slots` - if **event_name**=`generic` and the + * type of the parent node is `frame`: - `reprompt` - `skip_slot` - `skip_all_slots` If you specify `jump_to`, then + * you must also specify a value for the `dialog_node` property. * * @return the behavior */ @@ -73,7 +83,7 @@ public String getBehavior() { /** * Gets the dialogNode. * - * The ID of the dialog node to process next. This parameter is required if `behavior`=`jump_to`. + * The ID of the dialog node to process next. This parameter is required if **behavior**=`jump_to`. * * @return the dialogNode */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeVisitedDetails.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeVisitedDetails.java index d7ca04df8b0..775f9762d36 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeVisitedDetails.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/DialogNodeVisitedDetails.java @@ -23,6 +23,7 @@ public class DialogNodeVisitedDetails extends GenericModel { @SerializedName("dialog_node") private String dialogNode; private String title; + private String conditions; /** * Gets the dialogNode. @@ -46,6 +47,17 @@ public String getTitle() { return title; } + /** + * Gets the conditions. + * + * The conditions that trigger the dialog node. + * + * @return the conditions + */ + public String getConditions() { + return conditions; + } + /** * Sets the dialogNode. * @@ -63,4 +75,13 @@ public void setDialogNode(final String dialogNode) { public void setTitle(final String title) { this.title = title; } + + /** + * Sets the conditions. + * + * @param conditions the new conditions + */ + public void setConditions(final String conditions) { + this.conditions = conditions; + } } diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityCollection.java index 2a96b854f6f..c403fdc9f5c 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityCollection.java @@ -27,7 +27,7 @@ public class EntityCollection extends GenericModel { /** * Gets the entities. * - * An array of entities. + * An array of objects describing the entities defined for the workspace. * * @return the entities */ @@ -38,7 +38,7 @@ public List getEntities() { /** * Gets the pagination. * - * An object defining the pagination data for the returned objects. + * The pagination data for the returned objects. * * @return the pagination */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityExport.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityExport.java index 236ca70792f..6dfa1f31e33 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityExport.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/EntityExport.java @@ -103,7 +103,7 @@ public Boolean isFuzzyMatch() { /** * Gets the values. * - * An array of entity values. + * An array objects describing the entity values. * * @return the values */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Example.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Example.java index 5938a7d968a..267d6169712 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Example.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Example.java @@ -30,7 +30,7 @@ public class Example extends GenericModel { /** * Gets the exampleText. * - * The text of the example. + * The text of the user input example. * * @return the exampleText */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ExampleCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ExampleCollection.java index f067f0179d2..555fb829510 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ExampleCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ExampleCollection.java @@ -27,7 +27,7 @@ public class ExampleCollection extends GenericModel { /** * Gets the examples. * - * An array of Example objects describing the examples defined for the intent. + * An array of objects describing the examples defined for the intent. * * @return the examples */ @@ -38,7 +38,7 @@ public List getExamples() { /** * Gets the pagination. * - * An object defining the pagination data for the returned objects. + * The pagination data for the returned objects. * * @return the pagination */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetCounterexampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetCounterexampleOptions.java index 063b8a325de..c7d91d989d5 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetCounterexampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetCounterexampleOptions.java @@ -118,7 +118,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetDialogNodeOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetDialogNodeOptions.java index 6f8e96415a0..28d3a413578 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetDialogNodeOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetDialogNodeOptions.java @@ -118,7 +118,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetEntityOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetEntityOptions.java index 5754303158f..6e969346224 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetEntityOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetEntityOptions.java @@ -133,7 +133,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -155,9 +155,8 @@ public String entity() { /** * Gets the export. * - * Whether to include all element content in the returned data. If export=`false`, the returned data includes only - * information about the element itself. If export=`true`, all content, including subelements, is included. The - * default value is `false`. + * Whether to include all element content in the returned data. If **export**=`false`, the returned data includes only + * information about the element itself. If **export**=`true`, all content, including subelements, is included. * * @return the export */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetExampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetExampleOptions.java index 1dbe382e275..49fb2a0d0ca 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetExampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetExampleOptions.java @@ -136,7 +136,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -147,7 +147,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetIntentOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetIntentOptions.java index c1e457be717..1c8ae57d4b6 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetIntentOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetIntentOptions.java @@ -133,7 +133,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -144,7 +144,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ @@ -155,9 +155,8 @@ public String intent() { /** * Gets the export. * - * Whether to include all element content in the returned data. If export=`false`, the returned data includes only - * information about the element itself. If export=`true`, all content, including subelements, is included. The - * default value is `false`. + * Whether to include all element content in the returned data. If **export**=`false`, the returned data includes only + * information about the element itself. If **export**=`true`, all content, including subelements, is included. * * @return the export */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetSynonymOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetSynonymOptions.java index 78cc470a7fc..26102a58597 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetSynonymOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetSynonymOptions.java @@ -154,7 +154,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetValueOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetValueOptions.java index c3b01b3f60b..6f329d291af 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetValueOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetValueOptions.java @@ -151,7 +151,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -184,9 +184,8 @@ public String value() { /** * Gets the export. * - * Whether to include all element content in the returned data. If export=`false`, the returned data includes only - * information about the element itself. If export=`true`, all content, including subelements, is included. The - * default value is `false`. + * Whether to include all element content in the returned data. If **export**=`false`, the returned data includes only + * information about the element itself. If **export**=`true`, all content, including subelements, is included. * * @return the export */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetWorkspaceOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetWorkspaceOptions.java index 4539779b5e1..2b24816186d 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetWorkspaceOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/GetWorkspaceOptions.java @@ -115,7 +115,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -126,9 +126,8 @@ public String workspaceId() { /** * Gets the export. * - * Whether to include all element content in the returned data. If export=`false`, the returned data includes only - * information about the element itself. If export=`true`, all content, including subelements, is included. The - * default value is `false`. + * Whether to include all element content in the returned data. If **export**=`false`, the returned data includes only + * information about the element itself. If **export**=`true`, all content, including subelements, is included. * * @return the export */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/InputData.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/InputData.java index 107d7d24eb2..7a2afbc8235 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/InputData.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/InputData.java @@ -16,7 +16,7 @@ import com.ibm.watson.developer_cloud.util.Validator; /** - * An object defining the user input. + * The user input. */ public class InputData extends GenericModel { @@ -85,7 +85,8 @@ public Builder newBuilder() { /** * Gets the text. * - * The text of the user input. + * 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 */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentCollection.java index 8dab859edb6..d1c4cb8f90d 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentCollection.java @@ -27,7 +27,7 @@ public class IntentCollection extends GenericModel { /** * Gets the intents. * - * An array of intents. + * An array of objects describing the intents defined for the workspace. * * @return the intents */ @@ -38,7 +38,7 @@ public List getIntents() { /** * Gets the pagination. * - * An object defining the pagination data for the returned objects. + * The pagination data for the returned objects. * * @return the pagination */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentExport.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentExport.java index a1c92325253..0724ff2cba6 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentExport.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/IntentExport.java @@ -77,7 +77,7 @@ public String getDescription() { /** * Gets the examples. * - * An array of user input examples. + * An array of objects describing the user input examples for the intent. * * @return the examples */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListAllLogsOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListAllLogsOptions.java index e00dd554d66..2b0bf2cf362 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListAllLogsOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListAllLogsOptions.java @@ -144,7 +144,8 @@ public String filter() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -155,7 +156,7 @@ public String sort() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -166,7 +167,7 @@ public Long pageLimit() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListCounterexamplesOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListCounterexamplesOptions.java index 2e7233e173a..7088c4fd20d 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListCounterexamplesOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListCounterexamplesOptions.java @@ -160,7 +160,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -171,7 +171,7 @@ public String workspaceId() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -193,7 +193,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -204,7 +205,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListDialogNodesOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListDialogNodesOptions.java index ade760432d6..bd11278beff 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListDialogNodesOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListDialogNodesOptions.java @@ -160,7 +160,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -171,7 +171,7 @@ public String workspaceId() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -193,7 +193,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -204,7 +205,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListEntitiesOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListEntitiesOptions.java index 2d7d48a55c9..0d6caf5ef29 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListEntitiesOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListEntitiesOptions.java @@ -175,7 +175,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -186,9 +186,8 @@ public String workspaceId() { /** * Gets the export. * - * Whether to include all element content in the returned data. If export=`false`, the returned data includes only - * information about the element itself. If export=`true`, all content, including subelements, is included. The - * default value is `false`. + * Whether to include all element content in the returned data. If **export**=`false`, the returned data includes only + * information about the element itself. If **export**=`true`, all content, including subelements, is included. * * @return the export */ @@ -199,7 +198,7 @@ public Boolean export() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -221,7 +220,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -232,7 +232,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListExamplesOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListExamplesOptions.java index cd2f006918f..e42fd77f546 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListExamplesOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListExamplesOptions.java @@ -178,7 +178,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -189,7 +189,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ @@ -200,7 +200,7 @@ public String intent() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -222,7 +222,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -233,7 +234,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListIntentsOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListIntentsOptions.java index f83797f3792..bddb1daa822 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListIntentsOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListIntentsOptions.java @@ -175,7 +175,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -186,9 +186,8 @@ public String workspaceId() { /** * Gets the export. * - * Whether to include all element content in the returned data. If export=`false`, the returned data includes only - * information about the element itself. If export=`true`, all content, including subelements, is included. The - * default value is `false`. + * Whether to include all element content in the returned data. If **export**=`false`, the returned data includes only + * information about the element itself. If **export**=`true`, all content, including subelements, is included. * * @return the export */ @@ -199,7 +198,7 @@ public Boolean export() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -221,7 +220,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -232,7 +232,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListLogsOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListLogsOptions.java index 650c989957e..88329bd9ae2 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListLogsOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListLogsOptions.java @@ -145,7 +145,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -156,7 +156,8 @@ public String workspaceId() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -179,7 +180,7 @@ public String filter() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -190,7 +191,7 @@ public Long pageLimit() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListSynonymsOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListSynonymsOptions.java index ca2a508a938..7ced8a573d3 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListSynonymsOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListSynonymsOptions.java @@ -196,7 +196,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -229,7 +229,7 @@ public String value() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -251,7 +251,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -262,7 +263,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListValuesOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListValuesOptions.java index 8a7a7f2c8ca..85377d6f616 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListValuesOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListValuesOptions.java @@ -193,7 +193,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -215,9 +215,8 @@ public String entity() { /** * Gets the export. * - * Whether to include all element content in the returned data. If export=`false`, the returned data includes only - * information about the element itself. If export=`true`, all content, including subelements, is included. The - * default value is `false`. + * Whether to include all element content in the returned data. If **export**=`false`, the returned data includes only + * information about the element itself. If **export**=`true`, all content, including subelements, is included. * * @return the export */ @@ -228,7 +227,7 @@ public Boolean export() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -250,7 +249,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -261,7 +261,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListWorkspacesOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListWorkspacesOptions.java index ed841d3df75..2ec5e4fc5c2 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListWorkspacesOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ListWorkspacesOptions.java @@ -134,7 +134,7 @@ public Builder newBuilder() { /** * Gets the pageLimit. * - * The number of records to return in each page of results. The default page limit is 100. + * The number of records to return in each page of results. * * @return the pageLimit */ @@ -156,7 +156,8 @@ public Boolean includeCount() { /** * Gets the sort. * - * Sorts the response according to the value of the specified property, in ascending or descending order. + * The attribute by which returned results will be sorted. To reverse the sort order, prefix the value with a minus + * sign (`-`). Supported values are `name`, `updated`, and `workspace_id`. * * @return the sort */ @@ -167,7 +168,7 @@ public String sort() { /** * Gets the cursor. * - * A token identifying the last value from the previous page of results. + * A token identifying the page of results to retrieve. * * @return the cursor */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogCollection.java index 360d7b59c2e..766736c06b4 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogCollection.java @@ -27,7 +27,7 @@ public class LogCollection extends GenericModel { /** * Gets the logs. * - * An array of log events. + * An array of objects describing log events. * * @return the logs */ @@ -38,7 +38,7 @@ public List getLogs() { /** * Gets the pagination. * - * An object defining the pagination data for the returned objects. + * The pagination data for the returned objects. * * @return the pagination */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogExport.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogExport.java index a901982d7a4..4466ccd2964 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogExport.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogExport.java @@ -35,7 +35,7 @@ public class LogExport extends GenericModel { /** * Gets the request. * - * A request formatted for the Conversation service. + * A request received by the workspace, including the user input and context. * * @return the request */ @@ -46,7 +46,7 @@ public MessageRequest getRequest() { /** * Gets the response. * - * A response from the Conversation service. + * The response sent by the workspace, including the output text, detected intents and entities, and context. * * @return the response */ @@ -57,7 +57,7 @@ public MessageResponse getResponse() { /** * Gets the logId. * - * A unique identifier for the logged message. + * A unique identifier for the logged event. * * @return the logId */ @@ -90,7 +90,7 @@ public String getResponseTimestamp() { /** * Gets the workspaceId. * - * The workspace ID. + * The unique identifier of the workspace where the request was made. * * @return the workspaceId */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogMessage.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogMessage.java index 63e5b6b3d0d..2814e440e9a 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogMessage.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/LogMessage.java @@ -23,7 +23,7 @@ */ public class LogMessage extends DynamicModel { /** - * The severity of the message. + * The severity of the log message. */ public interface Level { /** info. */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageInput.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageInput.java index 9bc972167e5..a312d11460a 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageInput.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageInput.java @@ -15,7 +15,7 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; /** - * An input object that includes the input text. + * The text of the user input. */ public class MessageInput extends GenericModel { diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageOptions.java index 59969ab584b..572ea612430 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageOptions.java @@ -286,8 +286,8 @@ public Context context() { /** * Gets the entities. * - * Include the entities from the previous response when they do not need to change and to prevent Watson from trying - * to identify them. + * Entities to use when evaluating the message. Include entities from the previous response to continue using those + * entities rather than detecting entities in the new input. * * @return the entities */ @@ -298,8 +298,8 @@ public List entities() { /** * Gets the intents. * - * An array of name-confidence pairs for the user input. Include the intents from the previous response when they do - * not need to change and to prevent Watson from trying to identify them. + * Intents to use when evaluating the user input. Include intents from the previous response to continue using those + * intents rather than trying to recognize intents in the new input. * * @return the intents */ @@ -310,8 +310,8 @@ public List intents() { /** * Gets the output. * - * System output. Include the output from the request when you have several requests within the same Dialog turn to - * pass back in the intermediate information. + * System output. Include the output from the previous response to maintain intermediate information over multiple + * requests. * * @return the output */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageRequest.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageRequest.java index af28c16baa6..acf9d8937f2 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageRequest.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/MessageRequest.java @@ -67,8 +67,8 @@ public Context getContext() { /** * Gets the entities. * - * Include the entities from the previous response when they do not need to change and to prevent Watson from trying - * to identify them. + * Entities to use when evaluating the message. Include entities from the previous response to continue using those + * entities rather than detecting entities in the new input. * * @return the entities */ @@ -79,8 +79,8 @@ public List getEntities() { /** * Gets the intents. * - * An array of name-confidence pairs for the user input. Include the intents from the previous response when they do - * not need to change and to prevent Watson from trying to identify them. + * Intents to use when evaluating the user input. Include intents from the previous response to continue using those + * intents rather than trying to recognize intents in the new input. * * @return the intents */ @@ -91,8 +91,8 @@ public List getIntents() { /** * Gets the output. * - * System output. Include the output from the request when you have several requests within the same Dialog turn to - * pass back in the intermediate information. + * System output. Include the output from the previous response to maintain intermediate information over multiple + * requests. * * @return the output */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/SynonymCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/SynonymCollection.java index bae10b30c95..29f6690e928 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/SynonymCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/SynonymCollection.java @@ -38,7 +38,7 @@ public List getSynonyms() { /** * Gets the pagination. * - * An object defining the pagination data for the returned objects. + * The pagination data for the returned objects. * * @return the pagination */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateCounterexampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateCounterexampleOptions.java index 001fa8fcff3..c088aff5f92 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateCounterexampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateCounterexampleOptions.java @@ -118,7 +118,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -140,7 +140,7 @@ public String text() { /** * Gets the newText. * - * The text of the example to be marked as irrelevant input. + * The text of a user input counterexample. * * @return the newText */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateDialogNodeOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateDialogNodeOptions.java index c1d6eac01d0..3de2296fcff 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateDialogNodeOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateDialogNodeOptions.java @@ -38,6 +38,20 @@ public interface NodeType { String SLOT = "slot"; /** response_condition. */ String RESPONSE_CONDITION = "response_condition"; + /** folder. */ + String FOLDER = "folder"; + } + + /** + * Whether this dialog node can be returned to after a digression. + */ + public interface NewDigressOut { + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + /** allow_all_never_return. */ + String ALLOW_ALL_NEVER_RETURN = "allow_all_never_return"; } /** @@ -62,6 +76,30 @@ public interface NewEventName { String NOMATCH_RESPONSES_DEPLETED = "nomatch_responses_depleted"; } + /** + * Whether the user can digress to top-level nodes while filling out slots. + */ + public interface NewDigressOutSlots { + /** not_allowed. */ + String NOT_ALLOWED = "not_allowed"; + /** allow_returning. */ + String ALLOW_RETURNING = "allow_returning"; + /** allow_all. */ + String ALLOW_ALL = "allow_all"; + } + + /** + * Whether this top-level dialog node can be digressed into. + */ + public interface NewDigressIn { + /** not_available. */ + String NOT_AVAILABLE = "not_available"; + /** returns. */ + String RETURNS = "returns"; + /** does_not_return. */ + String DOES_NOT_RETURN = "does_not_return"; + } + private String workspaceId; private String dialogNode; private String nodeType; @@ -73,8 +111,11 @@ public interface NewEventName { private Map newMetadata; private String newTitle; private String newDescription; + private String newDigressOut; private String newEventName; + private String newDigressOutSlots; private DialogNodeNextStep newNextStep; + private String newDigressIn; private Map newOutput; private String newParent; private String newDialogNode; @@ -94,8 +135,11 @@ public static class Builder { private Map newMetadata; private String newTitle; private String newDescription; + private String newDigressOut; private String newEventName; + private String newDigressOutSlots; private DialogNodeNextStep newNextStep; + private String newDigressIn; private Map newOutput; private String newParent; private String newDialogNode; @@ -112,8 +156,11 @@ private Builder(UpdateDialogNodeOptions updateDialogNodeOptions) { newMetadata = updateDialogNodeOptions.newMetadata; newTitle = updateDialogNodeOptions.newTitle; newDescription = updateDialogNodeOptions.newDescription; + newDigressOut = updateDialogNodeOptions.newDigressOut; newEventName = updateDialogNodeOptions.newEventName; + newDigressOutSlots = updateDialogNodeOptions.newDigressOutSlots; newNextStep = updateDialogNodeOptions.newNextStep; + newDigressIn = updateDialogNodeOptions.newDigressIn; newOutput = updateDialogNodeOptions.newOutput; newParent = updateDialogNodeOptions.newParent; newDialogNode = updateDialogNodeOptions.newDialogNode; @@ -282,6 +329,17 @@ public Builder newDescription(String newDescription) { return this; } + /** + * Set the newDigressOut. + * + * @param newDigressOut the newDigressOut + * @return the UpdateDialogNodeOptions builder + */ + public Builder newDigressOut(String newDigressOut) { + this.newDigressOut = newDigressOut; + return this; + } + /** * Set the newEventName. * @@ -293,6 +351,17 @@ public Builder newEventName(String newEventName) { return this; } + /** + * Set the newDigressOutSlots. + * + * @param newDigressOutSlots the newDigressOutSlots + * @return the UpdateDialogNodeOptions builder + */ + public Builder newDigressOutSlots(String newDigressOutSlots) { + this.newDigressOutSlots = newDigressOutSlots; + return this; + } + /** * Set the newNextStep. * @@ -304,6 +373,17 @@ public Builder newNextStep(DialogNodeNextStep newNextStep) { return this; } + /** + * Set the newDigressIn. + * + * @param newDigressIn the newDigressIn + * @return the UpdateDialogNodeOptions builder + */ + public Builder newDigressIn(String newDigressIn) { + this.newDigressIn = newDigressIn; + return this; + } + /** * Set the newOutput. * @@ -352,8 +432,11 @@ private UpdateDialogNodeOptions(Builder builder) { newMetadata = builder.newMetadata; newTitle = builder.newTitle; newDescription = builder.newDescription; + newDigressOut = builder.newDigressOut; newEventName = builder.newEventName; + newDigressOutSlots = builder.newDigressOutSlots; newNextStep = builder.newNextStep; + newDigressIn = builder.newDigressIn; newOutput = builder.newOutput; newParent = builder.newParent; newDialogNode = builder.newDialogNode; @@ -371,7 +454,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -404,7 +487,7 @@ public String nodeType() { /** * Gets the newActions. * - * The actions for the dialog node. + * An array of objects describing any actions to be invoked by the dialog node. * * @return the newActions */ @@ -415,7 +498,8 @@ public List newActions() { /** * Gets the newConditions. * - * The condition that will trigger the dialog node. + * The condition that will trigger the dialog node. This string cannot contain carriage return, newline, or tab + * characters, and it must be no longer than 2048 characters. * * @return the newConditions */ @@ -437,7 +521,7 @@ public Map newContext() { /** * Gets the newPreviousSibling. * - * The previous dialog node. + * The ID of the previous sibling dialog node. * * @return the newPreviousSibling */ @@ -470,7 +554,9 @@ public Map newMetadata() { /** * Gets the newTitle. * - * The alias used to identify the dialog node. + * The alias used to identify the dialog node. This string must conform to the following restrictions: - It can + * contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. - It must be no longer than 64 + * characters. * * @return the newTitle */ @@ -481,7 +567,8 @@ public String newTitle() { /** * Gets the newDescription. * - * The description of the dialog node. + * The description of the dialog node. This string cannot contain carriage return, newline, or tab characters, and it + * must be no longer than 128 characters. * * @return the newDescription */ @@ -489,6 +576,17 @@ public String newDescription() { return newDescription; } + /** + * Gets the newDigressOut. + * + * Whether this dialog node can be returned to after a digression. + * + * @return the newDigressOut + */ + public String newDigressOut() { + return newDigressOut; + } + /** * Gets the newEventName. * @@ -500,10 +598,21 @@ public String newEventName() { return newEventName; } + /** + * Gets the newDigressOutSlots. + * + * Whether the user can digress to top-level nodes while filling out slots. + * + * @return the newDigressOutSlots + */ + public String newDigressOutSlots() { + return newDigressOutSlots; + } + /** * Gets the newNextStep. * - * The next step to execute following this dialog node. + * The next step to be executed in dialog processing. * * @return the newNextStep */ @@ -511,10 +620,22 @@ public DialogNodeNextStep newNextStep() { return newNextStep; } + /** + * Gets the newDigressIn. + * + * Whether this top-level dialog node can be digressed into. + * + * @return the newDigressIn + */ + public String newDigressIn() { + return newDigressIn; + } + /** * Gets the newOutput. * - * The output of the dialog node. + * The output of the dialog node. For more information about how to specify dialog node output, see the + * [documentation](https://console.bluemix.net/docs/services/conversation/dialog-overview.html#complex). * * @return the newOutput */ @@ -525,7 +646,7 @@ public Map newOutput() { /** * Gets the newParent. * - * The ID of the parent dialog node (if any). + * The ID of the parent dialog node. * * @return the newParent */ @@ -536,7 +657,8 @@ public String newParent() { /** * Gets the newDialogNode. * - * The dialog node ID. + * The dialog node ID. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, space, underscore, hyphen, and dot characters. - It must be no longer than 1024 characters. * * @return the newDialogNode */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateEntityOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateEntityOptions.java index c9a6ce5f5f6..11ebca53ab7 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateEntityOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateEntityOptions.java @@ -198,7 +198,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -231,7 +231,9 @@ public Boolean newFuzzyMatch() { /** * Gets the newEntity. * - * The name of the entity. + * The name of the entity. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, underscore, and hyphen characters. - It cannot begin with the reserved prefix `sys-`. - It must be no + * longer than 64 characters. * * @return the newEntity */ @@ -264,7 +266,8 @@ public List newValues() { /** * Gets the newDescription. * - * The description of the entity. + * The description of the entity. This string cannot contain carriage return, newline, or tab characters, and it must + * be no longer than 128 characters. * * @return the newDescription */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateExampleOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateExampleOptions.java index c55eb419459..9f1c31e10ac 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateExampleOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateExampleOptions.java @@ -136,7 +136,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -147,7 +147,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ @@ -169,7 +169,9 @@ public String text() { /** * Gets the newText. * - * The text of the user input example. + * The text of the user input example. This string must conform to the following restrictions: - It cannot contain + * carriage return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no + * longer than 1024 characters. * * @return the newText */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateIntentOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateIntentOptions.java index c4eead1e58d..239ac2741c7 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateIntentOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateIntentOptions.java @@ -167,7 +167,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -178,7 +178,7 @@ public String workspaceId() { /** * Gets the intent. * - * The intent name (for example, `pizza_order`). + * The intent name. * * @return the intent */ @@ -189,7 +189,9 @@ public String intent() { /** * Gets the newIntent. * - * The name of the intent. + * The name of the intent. This string must conform to the following restrictions: - It can contain only Unicode + * alphanumeric, underscore, hyphen, and dot characters. - It cannot begin with the reserved prefix `sys-`. - It must + * be no longer than 128 characters. * * @return the newIntent */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateSynonymOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateSynonymOptions.java index c8f13e47055..0550060f98f 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateSynonymOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateSynonymOptions.java @@ -154,7 +154,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -198,7 +198,9 @@ public String synonym() { /** * Gets the newSynonym. * - * The text of the synonym. + * The text of the synonym. This string must conform to the following restrictions: - It cannot contain carriage + * return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no longer than + * 64 characters. * * @return the newSynonym */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateValueOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateValueOptions.java index f976e70b116..2117bd81b9f 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateValueOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateValueOptions.java @@ -25,7 +25,7 @@ public class UpdateValueOptions extends GenericModel { /** - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. */ public interface ValueType { /** synonyms. */ @@ -242,7 +242,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -275,7 +275,9 @@ public String value() { /** * Gets the newSynonyms. * - * An array of synonyms for the entity value. + * An array of synonyms for the entity value. You can provide either synonyms or patterns (as indicated by **type**), + * but not both. A synonym must conform to the following resrictions: - It cannot contain carriage return, newline, or + * tab characters. - It cannot consist of only whitespace characters. - It must be no longer than 64 characters. * * @return the newSynonyms */ @@ -286,7 +288,7 @@ public List newSynonyms() { /** * Gets the valueType. * - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. * * @return the valueType */ @@ -308,7 +310,10 @@ public Map newMetadata() { /** * Gets the newPatterns. * - * An array of patterns for the entity value. A pattern is specified as a regular expression. + * An array of patterns for the entity value. You can provide either synonyms or patterns (as indicated by **type**), + * but not both. A pattern is a regular expression no longer than 128 characters. For more information about how to + * specify a pattern, see the + * [documentation](https://console.bluemix.net/docs/services/conversation/entities.html#creating-entities). * * @return the newPatterns */ @@ -319,7 +324,9 @@ public List newPatterns() { /** * Gets the newValue. * - * The text of the entity value. + * The text of the entity value. This string must conform to the following restrictions: - It cannot contain carriage + * return, newline, or tab characters. - It cannot consist of only whitespace characters. - It must be no longer than + * 64 characters. * * @return the newValue */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateWorkspaceOptions.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateWorkspaceOptions.java index f2f9afc8021..389f28bea80 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateWorkspaceOptions.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/UpdateWorkspaceOptions.java @@ -303,7 +303,7 @@ public Builder newBuilder() { /** * Gets the workspaceId. * - * The workspace ID. + * Unique identifier of the workspace. * * @return the workspaceId */ @@ -314,7 +314,8 @@ public String workspaceId() { /** * Gets the name. * - * The name of the workspace. + * The name of the workspace. This string cannot contain carriage return, newline, or tab characters, and it must be + * no longer than 64 characters. * * @return the name */ @@ -325,7 +326,8 @@ public String name() { /** * Gets the description. * - * The description of the workspace. + * The description of the workspace. This string cannot contain carriage return, newline, or tab characters, and it + * must be no longer than 128 characters. * * @return the description */ @@ -414,8 +416,11 @@ public Boolean learningOptOut() { /** * Gets the append. * - * Specifies that the elements included in the request body are to be appended to the existing data in the workspace. - * The default value is `false`. + * Whether the new data is to be appended to the existing data in the workspace. If **append**=`false`, elements + * included in the new data completely replace the corresponding existing elements, including all subelements. For + * example, if the new data includes **entities** and **append**=`false`, all existing entities in the workspace are + * discarded and replaced with the new entities. If **append**=`true`, existing elements are preserved, and the new + * elements are added. If any elements in the new data collide with existing elements, the update request fails. * * @return the append */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Value.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Value.java index 7ab2a78a01a..811d284a2d2 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Value.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Value.java @@ -25,7 +25,7 @@ public class Value extends GenericModel { /** - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. */ public interface ValueType { /** synonyms. */ @@ -91,7 +91,7 @@ public Date getUpdated() { /** * Gets the synonyms. * - * An array of synonyms for the entity value. + * An array containing any synonyms for the entity value. * * @return the synonyms */ @@ -102,7 +102,7 @@ public List getSynonyms() { /** * Gets the patterns. * - * An array of patterns for the entity value. A pattern is specified as a regular expression. + * An array containing any patterns for the entity value. * * @return the patterns */ @@ -113,7 +113,7 @@ public List getPatterns() { /** * Gets the valueType. * - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. * * @return the valueType */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ValueExport.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ValueExport.java index 9848426ed4c..89946dead92 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ValueExport.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/ValueExport.java @@ -25,7 +25,7 @@ public class ValueExport extends GenericModel { /** - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. */ public interface ValueType { /** synonyms. */ @@ -91,7 +91,7 @@ public Date getUpdated() { /** * Gets the synonyms. * - * An array of synonyms for the entity value. + * An array containing any synonyms for the entity value. * * @return the synonyms */ @@ -102,7 +102,7 @@ public List getSynonyms() { /** * Gets the patterns. * - * An array of patterns for the entity value. A pattern is specified as a regular expression. + * An array containing any patterns for the entity value. * * @return the patterns */ @@ -113,7 +113,7 @@ public List getPatterns() { /** * Gets the valueType. * - * Specifies the type of value (`synonyms` or `patterns`). The default value is `synonyms`. + * Specifies the type of value. * * @return the valueType */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Workspace.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Workspace.java index 105ed7c0bd4..9cd683923c5 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Workspace.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/Workspace.java @@ -103,7 +103,7 @@ public String getDescription() { /** * Gets the metadata. * - * Any metadata that is required by the workspace. + * Any metadata related to the workspace. * * @return the metadata */ @@ -114,8 +114,8 @@ public Map getMetadata() { /** * Gets the learningOptOut. * - * Whether training data from the workspace can be used by IBM for general service improvements. `true` indicates that - * workspace training data is not to be used. + * Whether training data from the workspace (including artifacts such as intents and entities) can be used by IBM for + * general service improvements. `true` indicates that workspace training data is not to be used. * * @return the learningOptOut */ diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/WorkspaceCollection.java b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/WorkspaceCollection.java index c50e24d174e..f9d6ffc0d51 100644 --- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/WorkspaceCollection.java +++ b/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/WorkspaceCollection.java @@ -27,7 +27,7 @@ public class WorkspaceCollection extends GenericModel { /** * Gets the workspaces. * - * An array of workspaces. + * An array of objects describing the workspaces associated with the service instance. * * @return the workspaces */ diff --git a/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationServiceIT.java b/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationServiceIT.java index bafe7ad2d2c..a5d2734e5da 100644 --- a/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationServiceIT.java +++ b/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationServiceIT.java @@ -472,7 +472,7 @@ public void testUpdateCounterexample() { try { UpdateCounterexampleOptions updateOptions = new UpdateCounterexampleOptions.Builder(workspaceId, counterExampleText).newText(counterExampleText2) - .build(); + .build(); Counterexample response = service.updateCounterexample(updateOptions).execute(); assertNotNull(response); assertNotNull(response.getText()); diff --git a/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationTest.java b/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationTest.java index 30fbe0df1eb..1a895bb03e8 100644 --- a/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationTest.java +++ b/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationTest.java @@ -12,20 +12,7 @@ */ package com.ibm.watson.developer_cloud.conversation.v1; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - +import com.ibm.watson.developer_cloud.WatsonServiceUnitTest; import com.ibm.watson.developer_cloud.conversation.v1.model.Context; import com.ibm.watson.developer_cloud.conversation.v1.model.CreateCounterexample; import com.ibm.watson.developer_cloud.conversation.v1.model.CreateDialogNode; @@ -51,13 +38,20 @@ import com.ibm.watson.developer_cloud.conversation.v1.model.UpdateValueOptions; import com.ibm.watson.developer_cloud.conversation.v1.model.UpdateWorkspaceOptions; import com.ibm.watson.developer_cloud.http.HttpHeaders; -import com.ibm.watson.developer_cloud.WatsonServiceUnitTest; - +import okhttp3.mockwebserver.RecordedRequest; import org.apache.commons.lang3.StringUtils; import org.junit.Before; import org.junit.Test; -import okhttp3.mockwebserver.RecordedRequest; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Unit tests for the {@link Conversation}. @@ -134,18 +128,18 @@ public void testConversationWithEmptyWorkspaceId() { */ @Test public void testSendMessage() throws IOException, InterruptedException { - String text = "I'd like to get insurance to for my home"; + String text = "I would love to hear some jazz music."; MessageResponse mockResponse = loadFixture(FIXTURE, MessageResponse.class); server.enqueue(jsonResponse(mockResponse)); InputData input = new InputData.Builder(text).build(); RuntimeIntent intent = new RuntimeIntent(); - intent.setIntent("turn_off"); + intent.setIntent("turn_on"); intent.setConfidence(0.0); RuntimeEntity entity = new RuntimeEntity(); - entity.setEntity("car"); - entity.setValue("ford"); + entity.setEntity("genre"); + entity.setValue("jazz"); MessageOptions options = new MessageOptions.Builder(WORKSPACE_ID) .input(input) .addIntent(intent) @@ -161,18 +155,16 @@ public void testSendMessage() throws IOException, InterruptedException { String path = StringUtils.join(PATH_MESSAGE, "?", VERSION, "=2018-02-16"); assertEquals(path, request.getPath()); - assertArrayEquals(new String[] { "Do you want to get a quote?" }, + 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)); - String expected = "{" + "\"input\":{\"text\":\"I'd like to get insurance to for my home\"}," - + "\"intents\":[{\"confidence\":0.0,\"intent\":\"turn_off\"}]," - + "\"entities\":[{\"value\":\"ford\",\"entity\":\"car\"}]," - + "\"alternate_intents\":true" + "}"; - JsonParser parser = new JsonParser(); - JsonObject expectedObj = parser.parse(expected).getAsJsonObject(); - JsonObject actualObj = parser.parse(request.getBody().readUtf8()).getAsJsonObject(); - assertTrue(expectedObj.equals(actualObj)); + assertNotNull(serviceResponse.getOutput().getLogMessages()); + assertNotNull(serviceResponse.getOutput().getNodesVisited()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getDialogNode()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getTitle()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); assertEquals(serviceResponse, mockResponse); } @@ -205,13 +197,10 @@ public void testSendMessageWithAlternateIntents() throws IOException, Interrupte String path = StringUtils.join(PATH_MESSAGE, "?", VERSION, "=2018-02-16"); assertEquals(path, request.getPath()); - assertArrayEquals(new String[] { "Do you want to get a quote?" }, + 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)); - assertEquals( - "{\"input\":{\"text\":\"My text\"},\"alternate_intents\":false," + "\"context\":{\"name\":\"Myname\"}}", - request.getBody().readUtf8()); assertEquals(serviceResponse, mockResponse); } diff --git a/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/model/util/PaginationTypeAdapterTest.java b/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/model/util/PaginationTypeAdapterTest.java index a8aa1cd12f3..faad607b886 100644 --- a/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/model/util/PaginationTypeAdapterTest.java +++ b/conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/model/util/PaginationTypeAdapterTest.java @@ -31,14 +31,16 @@ public class PaginationTypeAdapterTest extends WatsonServiceUnitTest { private static final String FIXTURE = "src/test/resources/conversation/pagination.json"; - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.ibm.watson.developer_cloud.WatsonServiceUnitTest#setUp() */ @Override public void setUp() throws Exception { } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.ibm.watson.developer_cloud.WatsonServiceUnitTest#tearDown() */ @Override diff --git a/conversation/src/test/resources/conversation/conversation.json b/conversation/src/test/resources/conversation/conversation.json index 7ec8d410828..4ece4091566 100644 --- a/conversation/src/test/resources/conversation/conversation.json +++ b/conversation/src/test/resources/conversation/conversation.json @@ -1,28 +1,112 @@ { "intents": [ { - "intent": "get_quote", - "confidence": 0.943643 + "intent": "turn_on", + "confidence": 0.9842960834503174 } ], "entities": [ { - "entity": "house", - "value": "home", + "entity": "genre", "location": [ - 36, - 40 - ] + 26, + 30 + ], + "value": "jazz", + "confidence": 1 + }, + { + "entity": "genre_bad", + "location": [ + 31, + 36 + ], + "value": "Soundtrack", + "confidence": 0.7 + }, + { + "entity": "appliance", + "location": [ + 31, + 36 + ], + "value": "music", + "confidence": 1 } ], "input": { - "text": "I'd like to get insurance to for my home" - }, - "context": { + "text": "I would love to hear some jazz music." }, "output": { "text": [ - "Do you want to get a quote?" - ] + "Great choice! Playing some jazz for you." + ], + "nodes_visited": [ + "Entry Point For On Off Commands", + "node_5_1469049934217", + "Genre On Off Check", + "node_3_1484628332751" + ], + "action": { + "music_on": "jazz" + }, + "nodes_visited_details": [ + { + "dialog_node": "Entry Point For On Off Commands", + "title": "Entry Point For On Off Commands", + "conditions": "#turn_on" + }, + { + "dialog_node": "node_5_1469049934217", + "title": null, + "conditions": "@genre" + }, + { + "dialog_node": "Genre On Off Check", + "title": "Genre On Off Check", + "conditions": "true" + }, + { + "dialog_node": "node_3_1484628332751", + "title": null, + "conditions": "$appl_action == \"on\"" + } + ], + "log_messages": [] + }, + "context": { + "conversation_id": "ed55c019-83b0-4d24-9d7c-99ee85e4e7a7", + "system": { + "dialog_stack": [ + { + "dialog_node": "root" + } + ], + "dialog_turn_counter": 2, + "dialog_request_counter": 2, + "_node_output_map": { + "Start And Initialize Context": [ + 0, + 0 + ], + "node_3_1484628332751": [ + 0, + 0 + ] + }, + "branch_exited": true, + "branch_exited_reason": "completed" + }, + "AConoff": "off", + "lightonoff": "off", + "musiconoff": "on", + "appl_action": "on", + "heateronoff": "off", + "volumeonoff": "off", + "wipersonoff": "off", + "default_counter": 0, + "previous_cuisine": "", + "previous_restaurant_date": "", + "previous_restaurant_time": "" } } diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java b/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java index 101de52ca92..36e746de99c 100644 --- a/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java +++ b/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java @@ -33,6 +33,8 @@ import com.ibm.watson.developer_cloud.service.exception.TooManyRequestsException; import com.ibm.watson.developer_cloud.service.exception.UnauthorizedException; import com.ibm.watson.developer_cloud.service.exception.UnsupportedException; +import com.ibm.watson.developer_cloud.service.security.IamOptions; +import com.ibm.watson.developer_cloud.service.security.IamTokenManager; import com.ibm.watson.developer_cloud.util.CredentialUtils; import com.ibm.watson.developer_cloud.util.RequestUtils; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; @@ -66,12 +68,14 @@ public abstract class WatsonService { private static final String MESSAGE_ERROR_3 = "message"; private static final String MESSAGE_ERROR_2 = "error_message"; private static final String BASIC = "Basic "; + private static final String BEARER = "Bearer "; private static final Logger LOG = Logger.getLogger(WatsonService.class.getName()); private String apiKey; private String username; private String password; private String endPoint; private final String name; + private IamTokenManager tokenManager; private OkHttpClient client; @@ -97,6 +101,15 @@ public abstract class WatsonService { */ public WatsonService(final String name) { this.name = name; + String iamApiKey = CredentialUtils.getIAMKey(name); + String iamUrl = CredentialUtils.getIAMUrl(name); + if (iamApiKey != null) { + IamOptions iamOptions = new IamOptions.Builder() + .apiKey(iamApiKey) + .url(iamUrl) + .build(); + tokenManager = new IamTokenManager(iamOptions); + } apiKey = CredentialUtils.getAPIKey(name); String url = CredentialUtils.getAPIUrl(name); if ((url != null) && !url.isEmpty()) { @@ -280,13 +293,17 @@ public void setApiKey(String apiKey) { * @param builder the new authentication */ protected void setAuthentication(final Builder builder) { - if (getApiKey() == null) { + if (tokenManager != null) { + String accessToken = tokenManager.getToken(); + builder.addHeader(HttpHeaders.AUTHORIZATION, BEARER + accessToken); + } else if (getApiKey() == null) { if (skipAuthentication) { return; // chosen to skip authentication with the service } throw new IllegalArgumentException("apiKey or username and password were not specified"); + } else { + builder.addHeader(HttpHeaders.AUTHORIZATION, apiKey.startsWith(BASIC) ? apiKey : BASIC + apiKey); } - builder.addHeader(HttpHeaders.AUTHORIZATION, apiKey.startsWith(BASIC) ? apiKey : BASIC + apiKey); } /** @@ -325,6 +342,19 @@ public void setDefaultHeaders(final Map headers) { } } + /** + * Sets IAM information. + * + * Be aware that if you pass in an access token using this method, you accept responsibility for managing the access + * token yourself. You must set a new access token before this one expires. Failing to do so will result in + * authentication errors after this token expires. + * + * @param iamOptions object containing values to be used for authenticating with IAM + */ + public void setIamCredentials(IamOptions iamOptions) { + this.tokenManager = new IamTokenManager(iamOptions); + } + /* * (non-Javadoc) * diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamOptions.java b/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamOptions.java new file mode 100644 index 00000000000..3aa34f43027 --- /dev/null +++ b/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamOptions.java @@ -0,0 +1,65 @@ +/* + * 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.service.security; + +/** + * Options for authenticating using IAM. + */ +public class IamOptions { + private String apiKey; + private String accessToken; + private String url; + + public String getApiKey() { + return apiKey; + } + + public String getAccessToken() { + return accessToken; + } + + public String getUrl() { + return url; + } + + public static class Builder { + private String apiKey; + private String accessToken; + private String url; + + public IamOptions build() { + return new IamOptions(this); + } + + public Builder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + public Builder accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + } + + private IamOptions(Builder builder) { + this.apiKey = builder.apiKey; + this.accessToken = builder.accessToken; + this.url = builder.url; + } +} diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamToken.java b/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamToken.java new file mode 100644 index 00000000000..ed09149863a --- /dev/null +++ b/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamToken.java @@ -0,0 +1,51 @@ +/* + * 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.service.security; + +import com.google.gson.annotations.SerializedName; +import com.ibm.watson.developer_cloud.service.model.ObjectModel; + +/** + * Represents response from IAM API. + */ +public class IamToken implements ObjectModel { + @SerializedName("access_token") + private String accessToken; + @SerializedName("refresh_token") + private String refreshToken; + @SerializedName("token_type") + private String tokenType; + @SerializedName("expires_in") + private Long expiresIn; + private Long expiration; + + public String getAccessToken() { + return accessToken; + } + + public String getRefreshToken() { + return refreshToken; + } + + public String getTokenType() { + return tokenType; + } + + public Long getExpiresIn() { + return expiresIn; + } + + public Long getExpiration() { + return expiration; + } +} diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamTokenManager.java b/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamTokenManager.java new file mode 100644 index 00000000000..f2a2800c1f4 --- /dev/null +++ b/core/src/main/java/com/ibm/watson/developer_cloud/service/security/IamTokenManager.java @@ -0,0 +1,186 @@ +/* + * 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.service.security; + +import com.ibm.watson.developer_cloud.http.HttpClientSingleton; +import com.ibm.watson.developer_cloud.http.HttpHeaders; +import com.ibm.watson.developer_cloud.http.HttpMediaType; +import com.ibm.watson.developer_cloud.http.RequestBuilder; +import com.ibm.watson.developer_cloud.http.ResponseConverter; +import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; +import okhttp3.Call; +import okhttp3.FormBody; +import okhttp3.Request; + +import java.io.IOException; + +/** + * Retrieves, stores, and refreshes IAM tokens. + */ +public class IamTokenManager { + private String userManagedAccessToken; + private String apiKey; + private String url; + private IamToken tokenData; + + private static final String DEFAULT_AUTHORIZATION = "Basic Yng6Yng="; + private static final String DEFAULT_IAM_URL = "https://iam.ng.bluemix.net/identity/token"; + private static final String GRANT_TYPE = "grant_type"; + private static final String REQUEST_GRANT_TYPE = "urn:ibm:params:oauth:grant-type:apikey"; + private static final String REFRESH_GRANT_TYPE = "refresh_token"; + private static final String API_KEY = "apikey"; + private static final String RESPONSE_TYPE = "response_type"; + private static final String CLOUD_IAM = "cloud_iam"; + private static final String REFRESH_TOKEN = "refresh_token"; + + public IamTokenManager(IamOptions options) { + this.apiKey = options.getApiKey(); + this.url = (options.getUrl() != null) ? options.getUrl() : DEFAULT_IAM_URL; + this.userManagedAccessToken = options.getAccessToken(); + tokenData = new IamToken(); + } + + /** + * This function returns an access token. The source of the token is determined by the following logic: + * 1. If user provides their own managed access token, assume it is valid and send it + * 2. If this class is managing tokens and does not yet have one, or the refresh token is expired, make a request + * for one + * 3. If this class is managing tokens and the token has expired, refresh it + * 4. If this class is managing tokens and has a valid token stored, send it + * + * @return the valid access token + */ + public String getToken() { + String token; + + if (userManagedAccessToken != null) { + // use user-managed access token + token = userManagedAccessToken; + } else if (tokenData.getAccessToken() == null || isRefreshTokenExpired()) { + // request new token + token = requestToken(); + } else if (isAccessTokenExpired()) { + // refresh current token + token = refreshToken(); + } else { + // use valid managed token + token = tokenData.getAccessToken(); + } + + return token; + } + + /** + * Request an IAM token using an API key. Also updates internal managed IAM token information. + * + * @return the new access token + */ + private String requestToken() { + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(url, new String[0])); + + builder.header(HttpHeaders.CONTENT_TYPE, HttpMediaType.APPLICATION_FORM_URLENCODED); + builder.header(HttpHeaders.AUTHORIZATION, DEFAULT_AUTHORIZATION); + + FormBody formBody = new FormBody.Builder() + .add(GRANT_TYPE, REQUEST_GRANT_TYPE) + .add(API_KEY, apiKey) + .add(RESPONSE_TYPE, CLOUD_IAM) + .build(); + builder.body(formBody); + + tokenData = callIamApi(builder.build()); + return tokenData.getAccessToken(); + } + + /** + * Refresh an IAM token using a refresh token. Also updates internal managed IAM token information. + * + * @return the new access token + */ + private String refreshToken() { + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(url, new String[0])); + + builder.header(HttpHeaders.CONTENT_TYPE, HttpMediaType.APPLICATION_FORM_URLENCODED); + builder.header(HttpHeaders.AUTHORIZATION, DEFAULT_AUTHORIZATION); + + FormBody formBody = new FormBody.Builder() + .add(GRANT_TYPE, REFRESH_GRANT_TYPE) + .add(REFRESH_TOKEN, tokenData.getRefreshToken()) + .build(); + builder.body(formBody); + + tokenData = callIamApi(builder.build()); + return tokenData.getAccessToken(); + } + + /** + * Check if currently stored access token is expired. + * + * Using a buffer to prevent the edge case of the + * token expiring before the request could be made. + * + * The buffer will be a fraction of the total TTL. Using 80%. + * + * @return whether the current managed access token is expired or not + */ + private boolean isAccessTokenExpired() { + if (tokenData.getExpiresIn() == null || tokenData.getExpiration() == null) { + return true; + } + + Double fractionOfTimeToLive = 0.8; + Long timeToLive = tokenData.getExpiresIn(); + Long expirationTime = tokenData.getExpiration(); + Double refreshTime = expirationTime - (timeToLive * (1.0 - fractionOfTimeToLive)); + Double currentTime = Math.floor(System.currentTimeMillis() / 1000); + + return refreshTime < currentTime; + } + + /** + * Used as a fail-safe to prevent the condition of a refresh token expiring, + * which could happen after around 30 days. This function will return true + * if it has been at least 7 days and 1 hour since the last token was + * retrieved. + * + * @returns whether the current managed refresh token is expired or not + */ + private boolean isRefreshTokenExpired() { + if (tokenData.getExpiration() == null) { + return true; + } + + int sevenDays = 7 * 24 * 3600; + Double currentTime = Math.floor(System.currentTimeMillis() / 1000); + Long newTokenTime = tokenData.getExpiration() + sevenDays; + return newTokenTime < currentTime; + } + + /** + * Executes call to IAM API and returns IamToken object representing the response. + * + * @param request the request for the IAM API + * @return object containing requested IAM token information + */ + private IamToken callIamApi(Request request) { + Call call = HttpClientSingleton.getInstance().createHttpClient().newCall(request); + ResponseConverter converter = ResponseConverterUtils.getObject(IamToken.class); + + try { + okhttp3.Response response = call.execute(); + return converter.convert(response); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/util/CredentialUtils.java b/core/src/main/java/com/ibm/watson/developer_cloud/util/CredentialUtils.java index 9e1bc90aa49..a1af0bd0018 100644 --- a/core/src/main/java/com/ibm/watson/developer_cloud/util/CredentialUtils.java +++ b/core/src/main/java/com/ibm/watson/developer_cloud/util/CredentialUtils.java @@ -77,6 +77,9 @@ public String getUsername() { /** The Constant APIKEY. */ private static final String APIKEY = "apikey"; + /** The Constant IAM_API_KEY_NAME. */ + private static final String IAM_API_KEY_NAME = "iam_apikey_name"; + /** The Constant CREDENTIALS. */ private static final String CREDENTIALS = "credentials"; @@ -101,6 +104,9 @@ public String getUsername() { /** The Constant URL. */ private static final String URL = "url"; + /** The Constant IAM_URL. */ + private static final String IAM_URL = "iam_url"; + /** The Constant PLAN_EXPERIMENTAL. */ public static final String PLAN_EXPERIMENTAL = "experimental"; @@ -191,6 +197,27 @@ private static JsonObject getVCAPServices() { return vcapServices; } + /** + * Returns the IAM API key from the VCAP_SERVICES, or null if it doesn't exist. + * + * @param serviceName the service name + * @return the IAM API key or null if the service cannot be found + */ + public static String getIAMKey(String serviceName) { + final JsonObject services = getVCAPServices(); + + if (serviceName == null || services == null) { + return null; + } + + final JsonObject credentials = getCredentialsObject(services, serviceName, null); + if (credentials != null && credentials.get(APIKEY) != null && credentials.get(IAM_API_KEY_NAME) != null) { + return credentials.get(APIKEY).getAsString(); + } + + return null; + } + /** * Returns the apiKey from the VCAP_SERVICES or null if doesn't exists. * @@ -348,6 +375,21 @@ public static String getAPIUrl(String serviceName, String plan) { return null; } + public static String getIAMUrl(String serviceName) { + final JsonObject services = getVCAPServices(); + + if (serviceName == null || services == null) { + return null; + } + + final JsonObject credentials = getCredentialsObject(services, serviceName, null); + if (credentials != null && credentials.get(IAM_URL) != null) { + return credentials.get(IAM_URL).getAsString(); + } + + return null; + } + /** * Sets the VCAP_SERVICES variable. This is utility variable for testing * diff --git a/core/src/test/java/com/ibm/watson/developer_cloud/service/IamManagerTest.java b/core/src/test/java/com/ibm/watson/developer_cloud/service/IamManagerTest.java new file mode 100644 index 00000000000..a3990c28c7f --- /dev/null +++ b/core/src/test/java/com/ibm/watson/developer_cloud/service/IamManagerTest.java @@ -0,0 +1,97 @@ +/** + * 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.service; + +import com.ibm.watson.developer_cloud.WatsonServiceUnitTest; +import com.ibm.watson.developer_cloud.service.security.IamOptions; +import com.ibm.watson.developer_cloud.service.security.IamToken; +import com.ibm.watson.developer_cloud.service.security.IamTokenManager; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class IamManagerTest extends WatsonServiceUnitTest { + + private IamToken expiredTokenData; + private IamToken validTokenData; + private String url; + + private static final String ACCESS_TOKEN = "abcd-1234"; + private static final String API_KEY = "123456789"; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + url = getMockWebServerUrl(); + expiredTokenData = loadFixture("src/test/resources/expired_iam_token.json", IamToken.class); + validTokenData = loadFixture("src/test/resources/valid_iam_token.json", IamToken.class); + } + + /** + * Tests that if a user passes in an access token during initial IAM setup, that access token is passed back + * during later retrieval. + */ + @Test + public void getUserManagedTokenFromConstructor() { + IamOptions options = new IamOptions.Builder() + .accessToken(ACCESS_TOKEN) + .url(url) + .build(); + IamTokenManager manager = new IamTokenManager(options); + + String token = manager.getToken(); + assertEquals(ACCESS_TOKEN, token); + } + + /** + * Tests that if only an API key is stored, the user can get back a valid access token. + */ + @Test + public void getTokenFromApiKey() throws InterruptedException { + server.enqueue(jsonResponse(validTokenData)); + + IamOptions options = new IamOptions.Builder() + .apiKey(API_KEY) + .url(url) + .build(); + IamTokenManager manager = new IamTokenManager(options); + + String token = manager.getToken(); + assertEquals(validTokenData.getAccessToken(), token); + } + + /** + * Tests that if the stored access token is expired, it can be refreshed properly. + */ + @Test + public void getTokenAfterRefresh() { + server.enqueue(jsonResponse(expiredTokenData)); + + IamOptions options = new IamOptions.Builder() + .apiKey(API_KEY) + .url(url) + .build(); + IamTokenManager manager = new IamTokenManager(options); + + // setting expired token + manager.getToken(); + + // getting valid token + server.enqueue(jsonResponse(validTokenData)); + String newToken = manager.getToken(); + + assertEquals(validTokenData.getAccessToken(), newToken); + } +} diff --git a/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java b/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java index 5a2d6ff8e29..ee1e0437a7d 100644 --- a/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java +++ b/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java @@ -12,20 +12,19 @@ */ package com.ibm.watson.developer_cloud.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.InputStream; -import java.util.Hashtable; - +import com.ibm.watson.developer_cloud.WatsonServiceTest; +import com.ibm.watson.developer_cloud.util.CredentialUtils.ServiceCredentials; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import com.ibm.watson.developer_cloud.WatsonServiceTest; -import com.ibm.watson.developer_cloud.util.CredentialUtils.ServiceCredentials; +import java.io.InputStream; +import java.util.Hashtable; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; /** * The Class CredentialUtilsTest. @@ -54,6 +53,9 @@ public class CredentialUtilsTest extends WatsonServiceTest { private static final String PERSONALITY_INSIGHTS_URL = "https://gateway.watsonplatform.net/personality-insights/api"; + private static final String IAM_SERVICE_NAME = "language_translator"; + private static final String IAM_KEY_TEST_VALUE = "123456789"; + /** * Setup. */ @@ -125,6 +127,15 @@ public void testGetUserCredentialsWithPlan() { assertEquals(credentials.getPassword(), NOT_A_PASSWORD); } + /** + * Test getting IAM API key from VCAP_SERVICES. + */ + @Test + public void testGetIAMKey() { + String key = CredentialUtils.getIAMKey(IAM_SERVICE_NAME); + assertEquals(IAM_KEY_TEST_VALUE, key); + } + /** * Test getting the API URL using JDNI. We ignore this test in Travis because * it always fails there. diff --git a/core/src/test/resources/expired_iam_token.json b/core/src/test/resources/expired_iam_token.json new file mode 100644 index 00000000000..bce563ba19c --- /dev/null +++ b/core/src/test/resources/expired_iam_token.json @@ -0,0 +1,7 @@ +{ + "access_token": "wxyz-9876", + "refresh_token": "00000000", + "token_type": "Bearer", + "expires_in": 3600, + "expiration": 1522788645 +} \ No newline at end of file diff --git a/core/src/test/resources/valid_iam_token.json b/core/src/test/resources/valid_iam_token.json new file mode 100644 index 00000000000..7fed350545c --- /dev/null +++ b/core/src/test/resources/valid_iam_token.json @@ -0,0 +1,7 @@ +{ + "access_token": "aaaa-1111", + "refresh_token": "99999999", + "token_type": "Bearer", + "expires_in": 3600, + "expiration": 999999999999999999 +} \ No newline at end of file diff --git a/core/src/test/resources/vcap_services.json b/core/src/test/resources/vcap_services.json index 2b3cdeea9c1..b9e636b10a8 100644 --- a/core/src/test/resources/vcap_services.json +++ b/core/src/test/resources/vcap_services.json @@ -59,15 +59,19 @@ } } ], - "language_translation": [ + "language_translator": [ { - "name": "language_translation_docs", - "label": "language_translation", + "name": "language_translator_docs", + "label": "language_translator", "plan": "standard", "credentials": { - "url": "https://gateway.watsonplatform.net/language-translation/api", - "username": "not-a-username", - "password": "not-a-password" + "apikey": "123456789", + "iam_apikey_description": "Auto generated apikey...", + "iam_apikey_name": "auto-generated-apikey-111-222-333", + "iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Manager", + "iam_serviceid_crn": "crn:v1:staging:public:iam-identity::a/::serviceid:ServiceID-1234", + "url": "https://gateway.watsonplatform.net/language-translator/api", + "iam_url": "https://iam.ng.bluemix.net/identity/token" } } ], 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 c54866f46ea..cdb1a0bdd02 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 @@ -76,6 +76,7 @@ import com.ibm.watson.developer_cloud.http.RequestBuilder; import com.ibm.watson.developer_cloud.http.ServiceCall; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.RequestUtils; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; @@ -129,6 +130,20 @@ public Discovery(String versionDate, String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `Discovery` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @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 iamOptions the options for authenticating through IAM + */ + public Discovery(String versionDate, IamOptions iamOptions) { + this(versionDate); + setIamCredentials(iamOptions); + } + /** * Add an environment. * diff --git a/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/LanguageTranslator.java b/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/LanguageTranslator.java index 10d1d7c7615..473f6e04d27 100644 --- a/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/LanguageTranslator.java +++ b/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/LanguageTranslator.java @@ -28,6 +28,7 @@ import com.ibm.watson.developer_cloud.language_translator.v2.model.TranslationModels; import com.ibm.watson.developer_cloud.language_translator.v2.model.TranslationResult; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.RequestUtils; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; @@ -36,9 +37,10 @@ import okhttp3.RequestBody; /** - * Language Translator translates text from one language to another. The service offers multiple domain-specific models - * that you can customize based on your unique terminology and language. Use Language Translator to take news from - * across the globe and present it in your language, communicate with your customers in their own language, and more. + * IBM Watson Language Translator translates text from one language to another. The service offers multiple + * domain-specific models that you can customize based on your unique terminology and language. Use Language Translator + * to take news from across the globe and present it in your language, communicate with your customers in their own + * language, and more. * * @version v2 * @see Language Translator @@ -70,6 +72,18 @@ public LanguageTranslator(String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `LanguageTranslator` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @param iamOptions the options for authenticating through IAM + */ + public LanguageTranslator(IamOptions iamOptions) { + this(); + setIamCredentials(iamOptions); + } + /** * Translate. * diff --git a/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/model/TranslateOptions.java b/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/model/TranslateOptions.java index 6bf51271926..a28617c0f75 100644 --- a/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/model/TranslateOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/developer_cloud/language_translator/v2/model/TranslateOptions.java @@ -160,8 +160,8 @@ public List text() { /** * Gets the modelId. * - * Model ID of the translation model to use. If this is specified, the `source` and `target` parameters will be - * ignored. The method requires either a model ID or both the `source` and `target` parameters. + * Model ID of the translation model to use. If this is specified, the **source** and **target** parameters will be + * ignored. The method requires either a model ID or both the **source** and **target** parameters. * * @return the modelId */ diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifier.java b/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifier.java index 3d191b5ff3b..a75b5a5d2c2 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifier.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifier.java @@ -26,6 +26,7 @@ import com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.GetClassifierOptions; import com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.RequestUtils; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; @@ -75,6 +76,18 @@ public NaturalLanguageClassifier(String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `NaturalLanguageClassifier` 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 + * before this one expires. Failing to do so will result in authentication errors after this token expires. + * + * @param iamOptions the options for authenticating through IAM + */ + public NaturalLanguageClassifier(IamOptions iamOptions) { + this(); + setIamCredentials(iamOptions); + } + /** * Classify a phrase. * 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 820e2c60616..d555962cc34 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 @@ -21,6 +21,7 @@ import com.ibm.watson.developer_cloud.natural_language_understanding.v1.model.ListModelsOptions; import com.ibm.watson.developer_cloud.natural_language_understanding.v1.model.ListModelsResults; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; import com.ibm.watson.developer_cloud.util.Validator; @@ -30,42 +31,10 @@ * 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. * - * ### Concepts - * Identify general concepts that are referenced or alluded to in your content. Concepts that are detected typically - * have an associated link to a DBpedia resource. - * - * ### Entities - * Detect important people, places, geopolitical entities and other types of entities in your content. Entity detection - * recognizes consecutive coreferences of each entity. For example, analysis of the following text would count "Barack - * Obama" and "He" as the same entity: - * - * "Barack Obama was the 44th President of the United States. He took office in January 2009." - * - * ### Keywords - * Determine the most important keywords in your content. Keyword phrases are organized by relevance in the results. - * - * ### Categories - * Categorize your content into a hierarchical 5-level taxonomy. For example, "Leonardo DiCaprio won an Oscar" returns - * "/art and entertainment/movies and tv/movies" as the most confident classification. - * - * ### Sentiment - * Determine whether your content conveys postive or negative sentiment. Sentiment information can be returned for - * detected entities, keywords, or user-specified target phrases found in the text. - * - * ### Emotion - * Detect anger, disgust, fear, joy, or sadness that is conveyed by your content. Emotion information can be returned - * for detected entities, keywords, or user-specified target phrases found in the text. - * - * ### Relations - * Recognize when two entities are related, and identify the type of relation. For example, you can identify an - * "awardedTo" relation between an award and its recipient. - * - * ### Semantic Roles - * Parse sentences into subject-action-object form, and identify entities and keywords that are subjects or objects of - * an action. - * - * ### Metadata - * Get author information, publication date, and the title of your text/HTML content. + * You can create custom + * models with Watson Knowledge Studio that can be used to detect custom entities and relations in Natural Language + * Understanding. * * @version v1 * @see Natural Language @@ -108,6 +77,20 @@ public NaturalLanguageUnderstanding(String versionDate, String username, String setUsernameAndPassword(username, password); } + /** + * Instantiates a new `NaturalLanguageUnderstanding` 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 + * before this one expires. Failing to do so will result in authentication errors after this token expires. + * + * @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 iamOptions the options for authenticating through IAM + */ + public NaturalLanguageUnderstanding(String versionDate, IamOptions iamOptions) { + this(versionDate); + setIamCredentials(iamOptions); + } + /** * Analyze text, HTML, or a public webpage. * 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 7074d6a9c3d..3dadc36b243 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 @@ -19,41 +19,25 @@ import com.ibm.watson.developer_cloud.personality_insights.v3.model.Profile; import com.ibm.watson.developer_cloud.personality_insights.v3.model.ProfileOptions; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.GsonSingleton; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; import com.ibm.watson.developer_cloud.util.Validator; /** - * ### Service Overview - * The IBM Watson Personality Insights service provides a Representational State Transfer (REST) Application Programming - * Interface (API) that enables applications to derive insights from social media, enterprise data, or other digital - * communications. The service uses linguistic analytics to infer individuals' intrinsic personality characteristics, - * including Big Five, Needs, and Values, from digital communications such as email, text messages, tweets, and forum - * posts. The service can automatically infer, from potentially noisy social media, portraits of individuals that - * reflect their personality characteristics. The service can report consumption preferences based on the results of its - * analysis, and for JSON content that is timestamped, it can report temporal behavior. - * ### API Usage - * The following information provides details about using the service to obtain a personality profile: - * * **The profile method:** The service offers a single `/v3/profile` method that accepts up to 20 MB of input data and - * produces results in JSON or CSV format. The service accepts input in Arabic, English, Japanese, Korean, or Spanish - * and can produce output in a variety of languages. - * * **Authentication:** You authenticate to the service by using your service credentials. You can use your credentials - * to authenticate via a proxy server that resides in IBM Cloud, or you can use your credentials to obtain a token and - * contact the service directly. See [Service credentials for Watson - * services](https://console.bluemix.net/docs/services/watson/getting-started-credentials.html) and [Tokens for - * authentication](https://console.bluemix.net/docs/services/watson/getting-started-tokens.html). - * * **Request Logging:** By default, all Watson services log requests and their results. Data is collected only to - * improve the Watson services. If you do not want to share your data, set the header parameter - * `X-Watson-Learning-Opt-Out` to `true` for each request. Data is collected for any request that omits this header. See - * [Controlling request logging for Watson - * services](https://console.bluemix.net/docs/services/watson/getting-started-logging.html). + * The IBM Watson Personality Insights service enables applications to derive insights from social media, enterprise + * data, or other digital communications. The service uses linguistic analytics to infer individuals' intrinsic + * personality characteristics, including Big Five, Needs, and Values, from digital communications such as email, text + * messages, tweets, and forum posts. * - * For more information about the service, see [About Personality - * Insights](https://console.bluemix.net/docs/services/personality-insights/index.html). For information about calling - * the service and the responses it can generate, see [Requesting a - * profile](https://console.bluemix.net/docs/services/personality-insights/input.html), [Understanding a JSON - * profile](https://console.bluemix.net/docs/services/personality-insights/output.html), and [Understanding a CSV - * profile](https://console.bluemix.net/docs/services/personality-insights/output-csv.html). + * The service can automatically infer, from potentially noisy social media, portraits of individuals that reflect their + * personality characteristics. The service can infer consumption preferences based on the results of its analysis and, + * for JSON content that is timestamped, can report temporal behavior. + * + * For information about the meaning of the models that the service uses to describe personality characteristics, see + * [Personality models](https://console.bluemix.net/docs/services/personality-insights/models.html). For information + * about the meaning of the consumption preferences, see [Consumption + * preferences](https://console.bluemix.net/docs/services/personality-insights/preferences.html). * * @version v3 * @see Personality Insights @@ -95,14 +79,26 @@ public PersonalityInsights(String versionDate, String username, String password) setUsernameAndPassword(username, password); } + /** + * Instantiates a new `PersonalityInsights` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @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 iamOptions the options for authenticating through IAM + */ + public PersonalityInsights(String versionDate, IamOptions iamOptions) { + this(versionDate); + setIamCredentials(iamOptions); + } + /** * Generates a personality profile based on input text. * - * Derives personality insights for up to 20 MB of input content written by an author, though the service requires - * much less text to produce an accurate profile; for more information, see [Providing sufficient - * input](https://console.bluemix.net/docs/services/personality-insights/input.html#sufficient). Accepts input in - * Arabic, English, Japanese, Korean, or Spanish and produces output in one of eleven languages. Provide plain text, - * HTML, or JSON content, and receive results in JSON or CSV format. + * Generates a personality profile for the author of the input text. The service accepts a maximum of 20 MB of input + * content, but it requires much less text to produce an accurate profile; for more information, see [Providing + * sufficient input](https://console.bluemix.net/docs/services/personality-insights/input.html#sufficient). * * @param profileOptions the {@link ProfileOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Profile} @@ -134,13 +130,23 @@ public ServiceCall profile(ProfileOptions profileOptions) { } /** - * Generates a personality profile based on input text. + * Get profile. as csv * - * Derives personality insights for up to 20 MB of input content written by an author, though the service requires - * much less text to produce an accurate profile; for more information, see [Providing sufficient - * input](https://console.bluemix.net/docs/services/personality-insights/input.html#sufficient). Accepts input in - * Arabic, English, Japanese, Korean, or Spanish and produces output in one of eleven languages. Provide plain text, - * HTML, or JSON content, and receive results in JSON or CSV format. + * Generates a personality profile for the author of the input text. The service accepts a maximum of 20 MB of input + * content, but it requires much less text to produce an accurate profile; for more information, see [Providing + * sufficient input](https://console.bluemix.net/docs/services/personality-insights/input.html#sufficient). The + * service analyzes text in Arabic, English, Japanese, Korean, or Spanish and returns its results in a variety of + * languages. You can provide plain text, HTML, or JSON input by specifying the **Content-Type** parameter; the + * default is `text/plain`. Request a JSON or comma-separated values (CSV) response by specifying the **Accept** + * parameter; CSV output includes a fixed number of columns and optional headers. Per the JSON specification, the + * default character encoding for JSON content is effectively always UTF-8; per the HTTP specification, the default + * encoding for plain text and HTML is ISO-8859-1 (effectively, the ASCII character set). 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`. For detailed information about calling the service and the + * responses it can generate, see (Requesting a + * profile)[https://console.bluemix.net/docs/services/personality-insights/input.html], (Understanding a JSON + * profile)[https://console.bluemix.net/docs/services/personality-insights/output.html], and (Understanding a CSV + * profile)[https://console.bluemix.net/docs/services/personality-insights/output-csv.html]. * * @param profileOptions the {@link ProfileOptions} containing the options for the call * @param includeHeaders option to have the CSV headers returned with the response diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Behavior.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Behavior.java index 8f43aff76ab..1fa60de1ee9 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Behavior.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Behavior.java @@ -29,7 +29,8 @@ public class Behavior extends GenericModel { /** * Gets the traitId. * - * The unique identifier of the characteristic to which the results pertain. IDs have the form `behavior_{value}`. + * The unique, non-localized identifier of the characteristic to which the results pertain. IDs have the form + * `behavior_{value}`. * * @return the traitId */ @@ -40,7 +41,7 @@ public String getTraitId() { /** * Gets the name. * - * The user-visible name of the characteristic. + * The user-visible, localized name of the characteristic. * * @return the name */ diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferences.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferences.java index 022cc3bf9f3..d5b691b76c2 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferences.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferences.java @@ -28,7 +28,7 @@ public class ConsumptionPreferences extends GenericModel { /** * Gets the consumptionPreferenceId. * - * The unique identifier of the consumption preference to which the results pertain. IDs have the form + * The unique, non-localized identifier of the consumption preference to which the results pertain. IDs have the form * `consumption_preferences_{preference}`. * * @return the consumptionPreferenceId @@ -40,7 +40,7 @@ public String getConsumptionPreferenceId() { /** * Gets the name. * - * The user-visible name of the consumption preference. + * The user-visible, localized name of the consumption preference. * * @return the name */ diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferencesCategory.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferencesCategory.java index 5667a9d77ff..ce15138cee7 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferencesCategory.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferencesCategory.java @@ -31,8 +31,8 @@ public class ConsumptionPreferencesCategory extends GenericModel { /** * Gets the consumptionPreferenceCategoryId. * - * The unique identifier of the consumption preferences category to which the results pertain. IDs have the form - * `consumption_preferences_{category}`. + * The unique, non-localized identifier of the consumption preferences category to which the results pertain. IDs have + * the form `consumption_preferences_{category}`. * * @return the consumptionPreferenceCategoryId */ diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ContentItem.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ContentItem.java index c84e4820f42..848d7a49da7 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ContentItem.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ContentItem.java @@ -21,8 +21,8 @@ public class ContentItem extends GenericModel { /** - * MIME type of the content. The default is plain text. The tags are stripped from HTML content before it is analyzed; - * plain text is processed as submitted. + * The MIME type of the content. The default is plain text. The tags are stripped from HTML content before it is + * analyzed; plain text is processed as submitted. */ public interface Contenttype { /** text/plain. */ @@ -32,12 +32,12 @@ public interface Contenttype { } /** - * Language identifier (two-letter ISO 639-1 identifier) for the language of the content item. The default is `en` + * The language identifier (two-letter ISO 639-1 identifier) for the language of the content item. The default is `en` * (English). Regional variants are treated as their parent language; for example, `en-US` is interpreted as `en`. A - * language specified with the `Content-Type` header overrides the value of this parameter; any content items that - * specify a different language are ignored. Omit the `Content-Type` header to base the language on the most prevalent - * specification among the content items; again, content items that specify a different language are ignored. You can - * specify any combination of languages for the input and response content. + * language specified with the **Content-Type** parameter overrides the value of this parameter; any content items + * that specify a different language are ignored. Omit the **Content-Type** parameter to base the language on the most + * prevalent specification among the content items; again, content items that specify a different language are + * ignored. You can specify any combination of languages for the input and response content. */ public interface Language { /** ar. */ @@ -237,7 +237,8 @@ public Builder newBuilder() { /** * Gets the content. * - * Content that is to be analyzed. The service supports up to 20 MB of content for all items combined. + * The content that is to be analyzed. The service supports up to 20 MB of content for all `ContentItem` objects + * combined. * * @return the content */ @@ -248,7 +249,7 @@ public String content() { /** * Gets the id. * - * Unique identifier for this content item. + * A unique identifier for this content item. * * @return the id */ @@ -259,7 +260,7 @@ public String id() { /** * Gets the created. * - * Timestamp that identifies when this content was created. Specify a value in milliseconds since the UNIX Epoch + * A timestamp that identifies when this content was created. Specify a value in milliseconds since the UNIX Epoch * (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior data. * * @return the created @@ -271,8 +272,8 @@ public Long created() { /** * Gets the updated. * - * Timestamp that identifies when this content was last updated. Specify a value in milliseconds since the UNIX Epoch - * (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior data. + * A timestamp that identifies when this content was last updated. Specify a value in milliseconds since the UNIX + * Epoch (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior data. * * @return the updated */ @@ -283,8 +284,8 @@ public Long updated() { /** * Gets the contenttype. * - * MIME type of the content. The default is plain text. The tags are stripped from HTML content before it is analyzed; - * plain text is processed as submitted. + * The MIME type of the content. The default is plain text. The tags are stripped from HTML content before it is + * analyzed; plain text is processed as submitted. * * @return the contenttype */ @@ -295,12 +296,12 @@ public String contenttype() { /** * Gets the language. * - * Language identifier (two-letter ISO 639-1 identifier) for the language of the content item. The default is `en` + * The language identifier (two-letter ISO 639-1 identifier) for the language of the content item. The default is `en` * (English). Regional variants are treated as their parent language; for example, `en-US` is interpreted as `en`. A - * language specified with the `Content-Type` header overrides the value of this parameter; any content items that - * specify a different language are ignored. Omit the `Content-Type` header to base the language on the most prevalent - * specification among the content items; again, content items that specify a different language are ignored. You can - * specify any combination of languages for the input and response content. + * language specified with the **Content-Type** parameter overrides the value of this parameter; any content items + * that specify a different language are ignored. Omit the **Content-Type** parameter to base the language on the most + * prevalent specification among the content items; again, content items that specify a different language are + * ignored. You can specify any combination of languages for the input and response content. * * @return the language */ @@ -311,7 +312,7 @@ public String language() { /** * Gets the parentid. * - * Unique ID of the parent content item for this item. Used to identify hierarchical relationships between + * The unique ID of the parent content item for this item. Used to identify hierarchical relationships between * posts/replies, messages/replies, and so on. * * @return the parentid diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Profile.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Profile.java index a743b2bfbe0..d2fc4c058f2 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Profile.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Profile.java @@ -45,8 +45,8 @@ public interface ProcessedLanguage { @SerializedName("word_count_message") private String wordCountMessage; private List personality; - private List values; private List needs; + private List values; private List behavior; @SerializedName("consumption_preferences") private List consumptionPreferences; @@ -66,7 +66,7 @@ public String getProcessedLanguage() { /** * Gets the wordCount. * - * The number of words that were found in the input. + * The number of words from the input that were used to produce the profile. * * @return the wordCount */ @@ -89,7 +89,8 @@ public String getWordCountMessage() { /** * Gets the personality. * - * Detailed results for the Big Five personality characteristics (dimensions and facets) inferred from the input text. + * A recursive array of `Trait` objects that provides detailed results for the Big Five personality characteristics + * (dimensions and facets) inferred from the input text. * * @return the personality */ @@ -98,25 +99,25 @@ public List getPersonality() { } /** - * Gets the values. + * Gets the needs. * * Detailed results for the Needs characteristics inferred from the input text. * - * @return the values + * @return the needs */ - public List getValues() { - return values; + public List getNeeds() { + return needs; } /** - * Gets the needs. + * Gets the values. * * Detailed results for the Values characteristics inferred from the input text. * - * @return the needs + * @return the values */ - public List getNeeds() { - return needs; + public List getValues() { + return values; } /** @@ -135,7 +136,7 @@ public List getBehavior() { /** * Gets the consumptionPreferences. * - * If the `consumption_preferences` query parameter is `true`, detailed results for each category of consumption + * If the **consumption_preferences** parameter is `true`, detailed results for each category of consumption * preferences. Each element of the array provides information inferred from the input text for the individual * preferences of that category. * 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 d055290906b..b36cb4721b4 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 @@ -36,12 +36,12 @@ public interface ContentType { /** * The language of the input text for the request: Arabic, English, Japanese, Korean, or Spanish. Regional variants * are treated as their parent language; for example, `en-US` is interpreted as `en`. The effect of the - * `Content-Language` header depends on the `Content-Type` header. When `Content-Type` is `text/plain` or `text/html`, - * `Content-Language` is the only way to specify the language. When `Content-Type` is `application/json`, - * `Content-Language` overrides a language specified with the `language` parameter of a `ContentItem` object, and - * content items that specify a different language are ignored; omit this header to base the language on the - * specification of the content items. You can specify any combination of languages for `Content-Language` and - * `Accept-Language`. + * **Content-Language** parameter depends on the **Content-Type** parameter. When **Content-Type** is `text/plain` or + * `text/html`, **Content-Language** is the only way to specify the language. When **Content-Type** is + * `application/json`, **Content-Language** overrides a language specified with the `language` parameter of a + * `ContentItem` object, and content items that specify a different language are ignored; omit this parameter to base + * the language on the specification of the content items. You can specify any combination of languages for + * **Content-Language** and **Accept-Language**. */ public interface ContentLanguage { /** ar. */ @@ -237,7 +237,7 @@ public Builder newBuilder() { * * A maximum of 20 MB of content to analyze, though the service requires much less text; for more information, see * [Providing sufficient input](https://console.bluemix.net/docs/services/personality-insights/input.html#sufficient). - * A JSON request must conform to the `Content` model. + * For JSON input, provide an object of type `Content`. * * @return the content */ @@ -250,7 +250,7 @@ public Content 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://console.bluemix.net/docs/services/personality-insights/input.html#sufficient). - * A JSON request must conform to the `Content` model. + * For JSON input, provide an object of type `Content`. * * @return the body */ @@ -275,12 +275,12 @@ public String contentType() { * * The language of the input text for the request: Arabic, English, Japanese, Korean, or Spanish. Regional variants * are treated as their parent language; for example, `en-US` is interpreted as `en`. The effect of the - * `Content-Language` header depends on the `Content-Type` header. When `Content-Type` is `text/plain` or `text/html`, - * `Content-Language` is the only way to specify the language. When `Content-Type` is `application/json`, - * `Content-Language` overrides a language specified with the `language` parameter of a `ContentItem` object, and - * content items that specify a different language are ignored; omit this header to base the language on the - * specification of the content items. You can specify any combination of languages for `Content-Language` and - * `Accept-Language`. + * **Content-Language** parameter depends on the **Content-Type** parameter. When **Content-Type** is `text/plain` or + * `text/html`, **Content-Language** is the only way to specify the language. When **Content-Type** is + * `application/json`, **Content-Language** overrides a language specified with the `language` parameter of a + * `ContentItem` object, and content items that specify a different language are ignored; omit this parameter to base + * the language on the specification of the content items. You can specify any combination of languages for + * **Content-Language** and **Accept-Language**. * * @return the contentLanguage */ @@ -304,8 +304,8 @@ public String acceptLanguage() { /** * Gets the rawScores. * - * If `true`, a raw score in addition to a normalized percentile is returned for each characteristic; raw scores are - * not compared with a sample population. If `false` (the default), only normalized percentiles are returned. + * Indicates whether a raw score in addition to a normalized percentile is returned for each characteristic; raw + * scores are not compared with a sample population. By default, only normalized percentiles are returned. * * @return the rawScores */ @@ -316,8 +316,8 @@ public Boolean rawScores() { /** * Gets the consumptionPreferences. * - * If `true`, information about consumption preferences is returned with the results; if `false` (the default), the - * response does not include the information. + * Indicates whether consumption preferences are returned with the results. By default, no consumption preferences are + * returned. * * @return the consumptionPreferences */ diff --git a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Trait.java b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Trait.java index 069071fe792..6e385de4c9d 100644 --- a/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Trait.java +++ b/personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Trait.java @@ -48,9 +48,9 @@ public interface Category { /** * Gets the traitId. * - * The unique identifier of the characteristic to which the results pertain. IDs have the form `big5_{characteristic}` - * for Big Five personality characteristics, `need_{characteristic}` for Needs, or `value_{characteristic}` for - * Values. + * The unique, non-localized identifier of the characteristic to which the results pertain. IDs have the form * + * `big5_{characteristic}` for Big Five personality dimensions * `facet_{characteristic}` for Big Five personality + * facets * `need_{characteristic}` for Needs *`value_{characteristic}` for Values. * * @return the traitId */ @@ -61,7 +61,7 @@ public String getTraitId() { /** * Gets the name. * - * The user-visible name of the characteristic. + * The user-visible, localized name of the characteristic. * * @return the name */ 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 13562b7e2eb..db18bbfabf4 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 @@ -17,6 +17,7 @@ import com.ibm.watson.developer_cloud.http.RequestBuilder; import com.ibm.watson.developer_cloud.http.ServiceCall; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.speech_to_text.v1.model.AcousticModel; import com.ibm.watson.developer_cloud.speech_to_text.v1.model.AcousticModels; import com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddAudioOptions; @@ -84,9 +85,10 @@ import okhttp3.WebSocket; /** - * The Speech to Text service uses IBM's speech recognition capabilities to convert English speech into text. The - * transcription of incoming audio is continuously sent back to the client with minimal delay, and it is corrected as - * more speech is heard. + * The IBM Watson Speech to Text service provides an API that enables you to add IBM's speech recognition capabilities + * to your applications. The service transcribes speech from various languages and audio formats to text with low + * latency. For most languages, the service supports two sampling rates, broadband and narrowband. The service returns + * all JSON response content in the UTF-8 character set. * * @version v1 * @see Speech to Text @@ -118,10 +120,22 @@ public SpeechToText(String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `SpeechToText` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @param iamOptions the options for authenticating through IAM + */ + public SpeechToText(IamOptions iamOptions) { + this(); + setIamCredentials(iamOptions); + } + /** * Retrieves information about the model. * - * Returns information about a single specified language model that is available for use with the service. The + * Retrieves information about a single specified language model that is available for use with the service. The * information includes the name of the model and its minimum sampling rate in Hertz, among other things. * * @param getModelOptions the {@link GetModelOptions} containing the options for the call @@ -137,9 +151,9 @@ public ServiceCall getModel(GetModelOptions getModelOptions) { } /** - * Retrieves the models available for the service. + * Get models. * - * Returns a list of all language models that are available for use with the service. The information includes the + * Retrieves a list of all language models that are available for use with the service. The information includes the * name of the model and its minimum sampling rate in Hertz, among other things. * * @param listModelsOptions the {@link ListModelsOptions} containing the options for the call @@ -154,9 +168,9 @@ public ServiceCall listModels(ListModelsOptions listModelsOptions) } /** - * Retrieves the models available for the service. + * Get models. * - * Returns a list of all language models that are available for use with the service. The information includes the + * Retrieves a list of all language models that are available for use with the service. The information includes the * name of the model and its minimum sampling rate in Hertz, among other things. * * @return a {@link ServiceCall} with a response type of {@link SpeechModels} @@ -202,12 +216,12 @@ public ServiceCall recognize(RecognizeOptions recogniz if (recognizeOptions.acousticCustomizationId() != null) { builder.query("acoustic_customization_id", recognizeOptions.acousticCustomizationId()); } + if (recognizeOptions.version() != null) { + builder.query("base_model_version", recognizeOptions.version()); + } if (recognizeOptions.customizationWeight() != null) { builder.query("customization_weight", String.valueOf(recognizeOptions.customizationWeight())); } - if (recognizeOptions.version() != null) { - builder.query("version", recognizeOptions.version()); - } if (recognizeOptions.inactivityTimeout() != null) { builder.query("inactivity_timeout", String.valueOf(recognizeOptions.inactivityTimeout())); } @@ -279,7 +293,7 @@ public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, Reco urlBuilder.addQueryParameter("acoustic_customization_id", recognizeOptions.acousticCustomizationId()); } if (recognizeOptions.version() != null) { - urlBuilder.addQueryParameter("version", recognizeOptions.version()); + urlBuilder.addQueryParameter("base_model_version", recognizeOptions.version()); } if (recognizeOptions.customizationWeight() != null) { urlBuilder.addQueryParameter("customization_weight", @@ -298,14 +312,15 @@ public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, Reco } /** - * Checks the status of the specified asynchronous job. + * Check a job. * * Returns information about the specified job. The response always includes the status of the job and its creation * and update times. If the status is `completed`, the response includes the results of the recognition request. You * must submit the request with the service credentials of the user who created the job. You can use the method to * retrieve the results of any job, regardless of whether it was submitted with a callback URL and the * `recognitions.completed_with_results` event, and you can retrieve the results multiple times for as long as they - * remain available. + * remain available. Use the **Check jobs** method to request information about the most recent jobs associated with + * the calling user. * * @param checkJobOptions the {@link CheckJobOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link RecognitionJob} @@ -320,14 +335,14 @@ public ServiceCall checkJob(CheckJobOptions checkJobOptions) { } /** - * Checks the status of all asynchronous jobs. + * Check jobs. * * Returns the ID and status of the latest 100 outstanding jobs associated with the service credentials with which it * is called. The method also returns the creation and update times of each job, and, if a job was created with a * callback URL and a user token, the user token for the job. To obtain the results for a job whose status is - * `completed` or not one of the latest 100 outstanding jobs, use the `GET /v1/recognitions/{id}` method. A job and - * its results remain available until you delete them with the `DELETE /v1/recognitions/{id}` method or until the - * job's time to live expires, whichever comes first. + * `completed` or not one of the latest 100 outstanding jobs, use the **Check a job** method. A job and its results + * remain available until you delete them with the **Delete a job** method or until the job's time to live expires, + * whichever comes first. * * @param checkJobsOptions the {@link CheckJobsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link RecognitionJobs} @@ -341,14 +356,14 @@ public ServiceCall checkJobs(CheckJobsOptions checkJobsOptions) } /** - * Checks the status of all asynchronous jobs. + * Check jobs. * * Returns the ID and status of the latest 100 outstanding jobs associated with the service credentials with which it * is called. The method also returns the creation and update times of each job, and, if a job was created with a * callback URL and a user token, the user token for the job. To obtain the results for a job whose status is - * `completed` or not one of the latest 100 outstanding jobs, use the `GET /v1/recognitions/{id}` method. A job and - * its results remain available until you delete them with the `DELETE /v1/recognitions/{id}` method or until the - * job's time to live expires, whichever comes first. + * `completed` or not one of the latest 100 outstanding jobs, use the **Check a job** method. A job and its results + * remain available until you delete them with the **Delete a job** method or until the job's time to live expires, + * whichever comes first. * * @return a {@link ServiceCall} with a response type of {@link RecognitionJobs} */ @@ -357,25 +372,27 @@ public ServiceCall checkJobs() { } /** - * Creates a job for an asynchronous recognition request. + * Create a job. * * Creates a job for a new asynchronous recognition request. The job is owned by the user whose service credentials * are used to create it. How you learn the status and results of a job depends on the parameters you include with the - * job creation request: * By callback notification: Include the `callback_url` query parameter to specify a URL to - * which the service is to send callback notifications when the status of the job changes. Optionally, you can also - * include the `events` and `user_token` query parameters to subscribe to specific events and to specify a string that - * is to be included with each notification for the job. * By polling the service: Omit the `callback_url`, `events`, - * and `user_token` query parameters. You must then use the `GET /v1/recognitions` or `GET /v1/recognitions/{id}` - * methods to check the status of the job, using the latter to retrieve the results when the job is complete. The two - * approaches are not mutually exclusive. You can poll the service for job status or obtain results from the service - * manually even if you include a callback URL. In both cases, you can include the `results_ttl` parameter to specify - * how long the results are to remain available after the job is complete. Note that using the HTTPS `GET - * /v1/recognitions/{id}` method to retrieve results is more secure than receiving them via callback notification over - * HTTP because it provides confidentiality in addition to authentication and data integrity. The method supports the - * same basic parameters as other HTTP and WebSocket recognition requests. The service imposes a data size limit of - * 100 MB. It automatically detects the endianness of the incoming audio and, for audio that includes multiple - * channels, downmixes the audio to one-channel mono during transcoding. (For the `audio/l16` format, you can specify - * the endianness.). + * job creation request: * By callback notification: Include the `callback_url` parameter to specify a URL to which + * the service is to send callback notifications when the status of the job changes. Optionally, you can also include + * the `events` and `user_token` parameters to subscribe to specific events and to specify a string that is to be + * included with each notification for the job. * By polling the service: Omit the `callback_url`, `events`, and + * `user_token` parameters. You must then use the **Check jobs** or **Check a job** methods to check the status of the + * job, using the latter to retrieve the results when the job is complete. The two approaches are not mutually + * exclusive. You can poll the service for job status or obtain results from the service manually even if you include + * a callback URL. In both cases, you can include the `results_ttl` parameter to specify how long the results are to + * remain available after the job is complete. For detailed usage information about the two approaches, including + * callback notifications, see [Creating a + * job](https://console.bluemix.net/docs/services/speech-to-text/async.html#create). Note that using the HTTPS **Check + * a job** method to retrieve results is more secure than receiving them via callback notification over HTTP because + * it provides confidentiality in addition to authentication and data integrity. The method supports the same basic + * parameters as other HTTP and WebSocket recognition requests. The service imposes a data size limit of 100 MB. It + * automatically detects the endianness of the incoming audio and, for audio that includes multiple channels, + * downmixes the audio to one-channel mono during transcoding. (For the `audio/l16` format, you can specify the + * endianness.). * * @param createJobOptions the {@link CreateJobOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link RecognitionJob} @@ -406,12 +423,12 @@ public ServiceCall createJob(CreateJobOptions createJobOptions) if (createJobOptions.acousticCustomizationId() != null) { builder.query("acoustic_customization_id", createJobOptions.acousticCustomizationId()); } + if (createJobOptions.version() != null) { + builder.query("base_model_version", createJobOptions.version()); + } if (createJobOptions.customizationWeight() != null) { builder.query("customization_weight", String.valueOf(createJobOptions.customizationWeight())); } - if (createJobOptions.version() != null) { - builder.query("version", createJobOptions.version()); - } if (createJobOptions.inactivityTimeout() != null) { builder.query("inactivity_timeout", String.valueOf(createJobOptions.inactivityTimeout())); } @@ -448,7 +465,7 @@ public ServiceCall createJob(CreateJobOptions createJobOptions) } /** - * Deletes the specified asynchronous job. + * Delete a job. * * Deletes the specified job. You cannot delete a job that the service is actively processing. Once you delete a job, * its results are no longer available. The service automatically deletes a job and its results when the time to live @@ -467,24 +484,24 @@ public ServiceCall deleteJob(DeleteJobOptions deleteJobOptions) { } /** - * Registers a callback URL for use with the asynchronous interface. + * Register a callback. * * Registers a callback URL with the service for use with subsequent asynchronous recognition requests. The service * attempts to register, or white-list, the callback URL if it is not already registered by sending a `GET` request to - * the callback URL. The service passes a random alphanumeric challenge string via the `challenge_string` query - * parameter of the request. The request includes an `Accept` header that specifies `text/plain` as the required - * response type. To be registered successfully, the callback URL must respond to the `GET` request from the service. - * The response must send status code 200 and must include the challenge string in its body. Set the `Content-Type` - * response header to `text/plain`. Upon receiving this response, the service responds to the original `POST` - * registration request with response code 201. The service sends only a single `GET` request to the callback URL. If - * the service does not receive a reply with a response code of 200 and a body that echoes the challenge string sent - * by the service within five seconds, it does not white-list the URL; it instead sends status code 400 in response to - * the `POST` registration request. If the requested callback URL is already white-listed, the service responds to the - * initial registration request with response code 200. If you specify a user secret with the request, the service - * uses it as a key to calculate an HMAC-SHA1 signature of the challenge string in its response to the `POST` request. - * It sends this signature in the `X-Callback-Signature` header of its `GET` request to the URL during registration. - * It also uses the secret to calculate a signature over the payload of every callback notification that uses the URL. - * The signature provides authentication and data integrity for HTTP communications. Once you successfully register a + * the callback URL. The service passes a random alphanumeric challenge string via the `challenge_string` parameter of + * the request. The request includes an `Accept` header that specifies `text/plain` as the required response type. To + * be registered successfully, the callback URL must respond to the `GET` request from the service. The response must + * send status code 200 and must include the challenge string in its body. Set the `Content-Type` response header to + * `text/plain`. Upon receiving this response, the service responds to the original registration request with response + * code 201. The service sends only a single `GET` request to the callback URL. If the service does not receive a + * reply with a response code of 200 and a body that echoes the challenge string sent by the service within five + * seconds, it does not white-list the URL; it instead sends status code 400 in response to the **Register a + * callback** request. If the requested callback URL is already white-listed, the service responds to the initial + * registration request with response code 200. If you specify a user secret with the request, the service uses it as + * a key to calculate an HMAC-SHA1 signature of the challenge string in its response to the `POST` request. It sends + * this signature in the `X-Callback-Signature` header of its `GET` request to the URL during registration. It also + * uses the secret to calculate a signature over the payload of every callback notification that uses the URL. The + * signature provides authentication and data integrity for HTTP communications. After you successfully register a * callback URL, you can use it with an indefinite number of recognition requests. You can register a maximum of 20 * callback URLS in a one-hour span of time. For more information, see [Registering a callback * URL](https://console.bluemix.net/docs/services/speech-to-text/async.html#register). @@ -504,11 +521,10 @@ public ServiceCall registerCallback(RegisterCallbackOptions regi } /** - * Removes the registration for an asynchronous callback URL. + * Unregister a callback. * - * Unregisters a callback URL that was previously white-listed with a `POST register_callback` request for use with - * the asynchronous interface. Once unregistered, the URL can no longer be used with asynchronous recognition - * requests. + * Unregisters a callback URL that was previously white-listed with a **Register a callback** request for use with the + * asynchronous interface. Once unregistered, the URL can no longer be used with asynchronous recognition requests. * * @param unregisterCallbackOptions the {@link UnregisterCallbackOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -522,7 +538,7 @@ public ServiceCall unregisterCallback(UnregisterCallbackOptions unregister } /** - * Creates a custom language model. + * Create a custom language model. * * Creates a new custom language model for a specified base model. The custom language model can be used only with the * base model for which it is created. The model is owned by the instance of the service whose credentials are used to @@ -549,7 +565,7 @@ public ServiceCall createLanguageModel(CreateLanguageModelOptions } /** - * Deletes a custom language model. + * Delete a custom language model. * * Deletes an existing custom language model. The custom model cannot be deleted if another request, such as adding a * corpus to the model, is currently being processed. You must use credentials for the instance of the service that @@ -568,7 +584,7 @@ public ServiceCall deleteLanguageModel(DeleteLanguageModelOptions deleteLa } /** - * Lists information about a custom language model. + * List a custom language model. * * Lists information about a specified custom language model. You must use credentials for the instance of the service * that owns a model to list information about it. @@ -586,7 +602,7 @@ public ServiceCall getLanguageModel(GetLanguageModelOptions getLa } /** - * Lists information about all custom language models. + * List custom language models. * * Lists information about all custom language models that are owned by an instance of the service. Use the `language` * parameter to see all custom language models for the specified language; omit the parameter to see all custom @@ -608,7 +624,7 @@ public ServiceCall listLanguageModels(ListLanguageModelsOptions } /** - * Lists information about all custom language models. + * List custom language models. * * Lists information about all custom language models that are owned by an instance of the service. Use the `language` * parameter to see all custom language models for the specified language; omit the parameter to see all custom @@ -622,7 +638,7 @@ public ServiceCall listLanguageModels() { } /** - * Resets a custom language model. + * Reset a custom language model. * * Resets a custom language model by removing all corpora and words from the model. Resetting a custom language model * initializes the model to its state when it was first created. Metadata such as the name and language of the model @@ -642,7 +658,7 @@ public ServiceCall resetLanguageModel(ResetLanguageModelOptions resetLangu } /** - * Trains a custom language model. + * Train a custom language model. * * Initiates the training of a custom language model with new corpora, custom words, or both. After adding, modifying, * or deleting corpora or words for a custom language model, use this method to begin the actual training of the model @@ -651,14 +667,14 @@ public ServiceCall resetLanguageModel(ResetLanguageModelOptions resetLangu * instance of the service that owns a model to train it. The training method is asynchronous. It can take on the * order of minutes to complete depending on the amount of data on which the service is being trained and the current * load on the service. The method returns an HTTP 200 response code to indicate that the training process has begun. - * You can monitor the status of the training by using the `GET /v1/customizations/{customization_id}` method to poll - * the model's status. Use a loop to check the status every 10 seconds. The method returns a `Customization` object - * that includes `status` and `progress` fields. A status of `available` means that the custom model is trained and - * ready to use. The service cannot accept subsequent training requests, or requests to add new corpora or words, - * until the existing request completes. 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 a - * corpus or words to the model. * No training data (corpora or words) have been added to the custom model. * One or - * more words that were added to the custom model have invalid sounds-like pronunciations that you must fix. + * You can monitor the status of the training by using the **List a custom language model** method to poll the model's + * status. Use a loop to check the status every 10 seconds. The method returns a `Customization` object that includes + * `status` and `progress` fields. A status of `available` means that the custom model is trained and ready to use. + * The service cannot accept subsequent training requests, or requests to add new corpora or words, until the existing + * request completes. 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 a corpus or words to the + * model. * No training data (corpora or words) have been added to the custom model. * One or more words that were + * added to the custom model have invalid sounds-like pronunciations that you must fix. * * @param trainLanguageModelOptions the {@link TrainLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -679,18 +695,18 @@ public ServiceCall trainLanguageModel(TrainLanguageModelOptions trainLangu } /** - * Upgrades a custom language model. + * Upgrade a custom language model. * * Initiates the upgrade of a custom language model to the latest version of its base language model. The upgrade * method is asynchronous. It can take on the order of minutes to complete depending on the amount of data in the * custom model and the current load on the service. A custom model must be in the `ready` or `available` state to be * upgraded. You must use credentials for the instance of the service that owns a model to upgrade it. The method * returns an HTTP 200 response code to indicate that the upgrade process has begun successfully. You can monitor the - * status of the upgrade by using the `GET /v1/customizations/{customization_id}` method to poll the model's status. - * Use a loop to check the status every 10 seconds. While it is being upgraded, the custom model has the status - * `upgrading`. When the upgrade is complete, the model resumes the status that it had prior to upgrade. The service - * cannot accept subsequent requests for the model until the upgrade completes. For more information, see [Upgrading - * custom models](https://console.bluemix.net/docs/services/speech-to-text/custom-upgrade.html). + * status of the upgrade by using the **List a custom language model** method to poll the model's status. Use a loop + * to check the status every 10 seconds. While it is being upgraded, the custom model has the status `upgrading`. When + * the upgrade is complete, the model resumes the status that it had prior to upgrade. The service cannot accept + * subsequent requests for the model until the upgrade completes. For more information, see [Upgrading custom + * models](https://console.bluemix.net/docs/services/speech-to-text/custom-upgrade.html). * * @param upgradeLanguageModelOptions the {@link UpgradeLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -705,35 +721,33 @@ public ServiceCall upgradeLanguageModel(UpgradeLanguageModelOptions upgrad } /** - * Adds a corpus text file to a custom language model. + * Add a corpus. * * Adds a single corpus text file of new training data to a custom language model. Use multiple requests to submit * multiple corpus text files. You must use credentials for the instance of the service that owns a model to add a * corpus to it. Note that adding a corpus does not affect the custom language model until you train the model for the - * new data by using the `POST /v1/customizations/{customization_id}/train` method. Submit a plain text file that - * contains sample sentences from the domain of interest to enable the service to extract words in context. The more - * sentences you add that represent the context in which speakers use words from the domain, the better the service's - * recognition accuracy. For guidelines about adding a corpus text file and for information about how the service - * parses a corpus file, see [Preparing a corpus text + * new data by using the **Train a custom language model** method. Submit a plain text file that contains sample + * sentences from the domain of interest to enable the service to extract words in context. The more sentences you add + * that represent the context in which speakers use words from the domain, the better the service's recognition + * accuracy. For guidelines about adding a corpus text file and for information about how the service parses a corpus + * file, see [Preparing a corpus text * file](https://console.bluemix.net/docs/services/speech-to-text/language-resource.html#prepareCorpus). The call * returns an HTTP 201 response code if the corpus is valid. The service then asynchronously processes the contents of * the corpus and automatically extracts new words that it finds. This can take on the order of a minute or two to * complete depending on the total number of words and the number of new words in the corpus, as well as the current * load on the service. You cannot submit requests to add additional corpora or words to the custom model, or to train - * the model, until the service's analysis of the corpus for the current request completes. Use the `GET - * /v1/customizations/{customization_id}/corpora/{corpus_name}` method to check the status of the analysis. The - * service auto-populates the model's words resource with any word that is not found in its base vocabulary; these are - * referred to as out-of-vocabulary (OOV) words. You can use the `GET /v1/customizations/{customization_id}/words` - * method to examine the words resource, using other words method to eliminate typos and modify how words are - * pronounced as needed. To add a corpus file that has the same name as an existing corpus, set the allow_overwrite - * query parameter to true; otherwise, the request fails. Overwriting an existing corpus causes the service to process - * the corpus text file and extract OOV words anew. Before doing so, it removes any OOV words associated with the - * existing corpus from the model's words resource unless they were also added by another corpus or they have been - * modified in some way with the `POST /v1/customizations/{customization_id}/words` or `PUT - * /v1/customizations/{customization_id}/words/{word_name}` method. The service limits the overall amount of data that - * you can add to a custom model to a maximum of 10 million total words from all corpora combined. Also, you can add - * no more than 30 thousand new custom words to a model; this includes words that the service extracts from corpora - * and words that you add directly. + * the model, until the service's analysis of the corpus for the current request completes. Use the **List a corpus** + * method to check the status of the analysis. The service auto-populates the model's words resource with any word + * that is not found in its base vocabulary; these are referred to as out-of-vocabulary (OOV) words. You can use the + * **List custom words** method to examine the words resource, using other words method to eliminate typos and modify + * how words are pronounced as needed. To add a corpus file that has the same name as an existing corpus, set the + * `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting an existing corpus causes the + * service to process the corpus text file and extract OOV words anew. Before doing so, it removes any OOV words + * associated with the existing corpus from the model's words resource unless they were also added by another corpus + * or they have been modified in some way with the **Add custom words** or **Add a custom word** method. The service + * limits the overall amount of data that you can add to a custom model to a maximum of 10 million total words from + * all corpora combined. Also, you can add no more than 30 thousand new custom words to a model; this includes words + * that the service extracts from corpora and words that you add directly. * * @param addCorpusOptions the {@link AddCorpusOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -757,14 +771,13 @@ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { } /** - * Deletes a corpus from a custom language model. + * Delete a corpus. * * Deletes an existing corpus from a custom language model. The service removes any out-of-vocabulary (OOV) words * associated with the corpus from the custom model's words resource unless they were also added by another corpus or - * they have been modified in some way with the `POST /v1/customizations/{customization_id}/words` or `PUT - * /v1/customizations/{customization_id}/words/{word_name}` method. Removing a corpus does not affect the custom model - * until you train the model with the `POST /v1/customizations/{customization_id}/train` method. You must use - * credentials for the instance of the service that owns a model to delete its corpora. + * they have been modified in some way with the **Add custom words** or **Add a custom word** method. Removing a + * corpus does not affect the custom model until you train the model with the **Train a custom language model** + * method. You must use credentials for the instance of the service that owns a model to delete its corpora. * * @param deleteCorpusOptions the {@link DeleteCorpusOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -779,7 +792,7 @@ public ServiceCall deleteCorpus(DeleteCorpusOptions deleteCorpusOptions) { } /** - * Lists information about a corpus for a custom language model. + * List a corpus. * * Lists information about a corpus from a custom language model. The information includes the total number of words * and out-of-vocabulary (OOV) words, name, and status of the corpus. You must use credentials for the instance of the @@ -798,7 +811,7 @@ public ServiceCall getCorpus(GetCorpusOptions getCorpusOptions) { } /** - * Lists information about all corpora for a custom language model. + * List corpora. * * Lists information about all corpora from a custom language model. The information includes the total number of * words and out-of-vocabulary (OOV) words, name, and status of each corpus. You must use credentials for the instance @@ -817,20 +830,20 @@ public ServiceCall listCorpora(ListCorporaOptions listCorporaOptions) { } /** - * Adds a custom word to a custom language model. + * Add a custom word. * * Adds a custom word to a custom language model. The service populates the words resource for a custom model with * out-of-vocabulary (OOV) words found in each corpus added to the model. You can use this method to add additional * words or to modify existing words in the words resource. You must use credentials for the instance of the service * that owns a model to add or modify a custom word for the model. Adding or modifying a custom word does not affect - * the custom model until you train the model for the new data by using the `POST - * /v1/customizations/{customization_id}/train` method. Use the `word_name` path parameter to specify the custom word - * that is to be added or modified. Use the `CustomWord` object to provide one or both of the optional `sounds_like` - * and `display_as` fields for the word. * The `sounds_like` field provides an array of one or more pronunciations for - * the word. Use the parameter to specify how the word can be pronounced by users. Use the parameter for words that - * are difficult to pronounce, foreign words, acronyms, and so on. For example, you might specify that the word `IEEE` - * can sound like `i triple e`. You can specify a maximum of five sounds-like pronunciations for a word. For - * information about pronunciation rules, see [Using the sounds_like + * the custom model until you train the model for the new data by using the **Train a custom language model** method. + * Use the `word_name` parameter to specify the custom word that is to be added or modified. Use the `CustomWord` + * object to provide one or both of the optional `sounds_like` and `display_as` fields for the word. * The + * `sounds_like` field provides an array of one or more pronunciations for the word. Use the parameter to specify how + * the word can be pronounced by users. Use the parameter for words that are difficult to pronounce, foreign words, + * acronyms, and so on. For example, you might specify that the word `IEEE` can sound like `i triple e`. You can + * specify a maximum of five sounds-like pronunciations for a word. For information about pronunciation rules, see + * [Using the sounds_like * field](https://console.bluemix.net/docs/services/speech-to-text/language-resource.html#soundsLike). * The * `display_as` field provides a different way of spelling the word in a transcript. Use the parameter when you want * the word to appear different from its usual representation or from its spelling in corpora training data. For @@ -839,7 +852,7 @@ public ServiceCall listCorpora(ListCorporaOptions listCorporaOptions) { * field](https://console.bluemix.net/docs/services/speech-to-text/language-resource.html#displayAs). If you add a * custom word that already exists in the words resource for the custom model, the new definition overwrites the * existing data for the word. If the service encounters an error, it does not add the word to the words resource. Use - * the `GET /v1/customizations/{customization_id}/words/{word_name}` method to review the word that you add. + * the **List a custom word** method to review the word that you add. * * @param addWordOptions the {@link AddWordOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -865,21 +878,20 @@ public ServiceCall addWord(AddWordOptions addWordOptions) { } /** - * Adds one or more custom words to a custom language model. + * Add custom words. * * Adds one or more custom words to a custom language model. The service populates the words resource for a custom * model with out-of-vocabulary (OOV) words found in each corpus added to the model. You can use this method to add * additional words or to modify existing words in the words resource. You must use credentials for the instance of * the service that owns a model to add or modify custom words for the model. Adding or modifying custom words does - * not affect the custom model until you train the model for the new data by using the `POST - * /v1/customizations/{customization_id}/train` method. You add custom words by providing a `Words` object, which is - * an array of `Word` objects, one per word. You must use the object's word parameter to identify the word that is to - * be added. You can also provide one or both of the optional `sounds_like` and `display_as` fields for each word. * - * The `sounds_like` field provides an array of one or more pronunciations for the word. Use the parameter to specify - * how the word can be pronounced by users. Use the parameter for words that are difficult to pronounce, foreign - * words, acronyms, and so on. For example, you might specify that the word `IEEE` can sound like `i triple e`. You - * can specify a maximum of five sounds-like pronunciations for a word. For information about pronunciation rules, see - * [Using the sounds_like + * not affect the custom model until you train the model for the new data by using the **Train a custom language + * model** method. You add custom words by providing a `Words` object, which is an array of `Word` objects, one per + * word. You must use the object's word parameter to identify the word that is to be added. You can also provide one + * or both of the optional `sounds_like` and `display_as` fields for each word. * The `sounds_like` field provides an + * array of one or more pronunciations for the word. Use the parameter to specify how the word can be pronounced by + * users. Use the parameter for words that are difficult to pronounce, foreign words, acronyms, and so on. For + * example, you might specify that the word `IEEE` can sound like `i triple e`. You can specify a maximum of five + * sounds-like pronunciations for a word. For information about pronunciation rules, see [Using the sounds_like * field](https://console.bluemix.net/docs/services/speech-to-text/language-resource.html#soundsLike). * The * `display_as` field provides a different way of spelling the word in a transcript. Use the parameter when you want * the word to appear different from its usual representation or from its spelling in corpora training data. For @@ -891,14 +903,13 @@ public ServiceCall addWord(AddWordOptions addWordOptions) { * does not add any of the words to the words resource. The call returns an HTTP 201 response code if the input data * is valid. It then asynchronously processes the words to add them to the model's words resource. The time that it * takes for the analysis to complete depends on the number of new words that you add but is generally faster than - * adding a corpus or training a model. You can monitor the status of the request by using the `GET - * /v1/customizations/{customization_id}` method to poll the model's status. Use a loop to check the status every 10 - * seconds. The method returns a `Customization` object that includes a `status` field. A status of `ready` means that - * the words have been added to the custom model. The service cannot accept requests to add new corpora or words or to - * train the model until the existing request completes. You can use the `GET - * /v1/customizations/{customization_id}/words` or `GET /v1/customizations/{customization_id}/words/{word_name}` - * method to review the words that you add. Words with an invalid `sounds_like` field include an `error` field that - * describes the problem. You can use other words methods to correct errors, eliminate typos, and modify how words are + * adding a corpus or training a model. You can monitor the status of the request by using the **List a custom + * language model** method to poll the model's status. Use a loop to check the status every 10 seconds. The method + * returns a `Customization` object that includes a `status` field. A status of `ready` means that the words have been + * added to the custom model. The service cannot accept requests to add new corpora or words or to train the model + * until the existing request completes. You can use the **List custom words** or **List a custom word** method to + * review the words that you add. Words with an invalid `sounds_like` field include an `error` field that describes + * the problem. You can use other words methods to correct errors, eliminate typos, and modify how words are * pronounced as needed. * * @param addWordsOptions the {@link AddWordsOptions} containing the options for the call @@ -917,14 +928,13 @@ public ServiceCall addWords(AddWordsOptions addWordsOptions) { } /** - * Deletes a custom word from a custom language model. + * Delete a custom word. * * Deletes a custom word from a custom language model. You can remove any word that you added to the custom model's * words resource via any means. However, if the word also exists in the service's base vocabulary, the service * removes only the custom pronunciation for the word; the word remains in the base vocabulary. Removing a custom word - * does not affect the custom model until you train the model with the `POST - * /v1/customizations/{customization_id}/train` method. You must use credentials for the instance of the service that - * owns a model to delete its words. + * does not affect the custom model until you train the model with the **Train a custom language model** method. You + * must use credentials for the instance of the service that owns a model to delete its words. * * @param deleteWordOptions the {@link DeleteWordOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -939,7 +949,7 @@ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { } /** - * Lists a custom word from a custom language model. + * List a custom word. * * Lists information about a custom word from a custom language model. You must use credentials for the instance of * the service that owns a model to query information about its words. @@ -957,7 +967,7 @@ public ServiceCall getWord(GetWordOptions getWordOptions) { } /** - * Lists all custom words from a custom language model. + * List custom words. * * Lists information about custom words from a custom language model. You can list all words from the custom model's * words resource, only custom words that were added or modified by the user, or only out-of-vocabulary (OOV) words @@ -984,7 +994,7 @@ public ServiceCall listWords(ListWordsOptions listWordsOptions) { } /** - * Creates a custom acoustic model. + * Create a custom acoustic model. * * Creates a new custom acoustic model for a specified base model. The custom acoustic model can be used only with the * base model for which it is created. The model is owned by the instance of the service whose credentials are used to @@ -1008,7 +1018,7 @@ public ServiceCall createAcousticModel(CreateAcousticModelOptions } /** - * Deletes a custom acoustic model. + * Delete a custom acoustic model. * * Deletes an existing custom acoustic model. The custom model cannot be deleted if another request, such as adding an * audio resource to the model, is currently being processed. You must use credentials for the instance of the service @@ -1027,7 +1037,7 @@ public ServiceCall deleteAcousticModel(DeleteAcousticModelOptions deleteAc } /** - * Lists information about a custom acoustic model. + * List a custom acoustic model. * * Lists information about a specified custom acoustic model. You must use credentials for the instance of the service * that owns a model to list information about it. @@ -1045,7 +1055,7 @@ public ServiceCall getAcousticModel(GetAcousticModelOptions getAc } /** - * Lists information about all custom acoustic models. + * List custom acoustic models. * * Lists information about all custom acoustic models that are owned by an instance of the service. Use the `language` * parameter to see all custom acoustic models for the specified language; omit the parameter to see all custom @@ -1067,7 +1077,7 @@ public ServiceCall listAcousticModels(ListAcousticModelsOptions } /** - * Lists information about all custom acoustic models. + * List custom acoustic models. * * Lists information about all custom acoustic models that are owned by an instance of the service. Use the `language` * parameter to see all custom acoustic models for the specified language; omit the parameter to see all custom @@ -1081,7 +1091,7 @@ public ServiceCall listAcousticModels() { } /** - * Resets a custom acoustic model. + * Reset a custom acoustic model. * * Resets a custom acoustic model by removing all audio resources from the model. Resetting a custom acoustic model * initializes the model to its state when it was first created. Metadata such as the name and language of the model @@ -1101,26 +1111,26 @@ public ServiceCall resetAcousticModel(ResetAcousticModelOptions resetAcous } /** - * Trains a custom acoustic model. + * Train a custom acoustic model. * * Initiates the training of a custom acoustic model with new or changed audio resources. After adding or deleting * audio resources for a custom acoustic model, use this method to begin the actual training of the model on the * latest audio data. The custom acoustic model does not reflect its changed data until you train it. You must use * credentials for the instance of the service that owns a model to train it. The training method is asynchronous. It * can take on the order of minutes or hours to complete depending on the total amount of audio data on which the - * model is being trained and the current load on the service. Typically, training takes approximately two to four - * times the length of its audio data. The range of time depends on the model being trained and the nature of the - * audio, such as whether the audio is clean or noisy. The method returns an HTTP 200 response code to indicate that - * the training process has begun. You can monitor the status of the training by using the `GET - * /v1/acoustic_customizations/{customization_id}` method to poll the model's status. Use a loop to check the status - * once a minute. The method returns an `Customization` object that includes `status` and `progress` fields. A status - * of `available` indicates that the custom model is trained and ready to use. The service cannot accept subsequent + * custom acoustic model is being trained and the current load on the service. Typically, training a custom acoustic + * model takes approximately two to four times the length of its audio data. The range of time depends on the model + * being trained and the nature of the audio, such as whether the audio is clean or noisy. The method returns an HTTP + * 200 response code to indicate that the training process has begun. You can monitor the status of the training by + * using the **List a custom acoustic model** method to poll the model's status. Use a loop to check the status once a + * minute. The method returns an `Customization` object that includes `status` and `progress` fields. A status of + * `available` indicates that the custom model is trained and ready to use. The service cannot accept subsequent * training requests, or requests to add new audio resources, until the existing request completes. You can use the - * optional `custom_language_model_id` query 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 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 information about creating a separate custom language - * model, see [Creating a custom language + * 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 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 information about creating a separate custom language model, + * see [Creating a custom language * model](https://console.bluemix.net/docs/services/speech-to-text/language-create.html). 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 @@ -1142,7 +1152,7 @@ public ServiceCall trainAcousticModel(TrainAcousticModelOptions trainAcous } /** - * Upgrades a custom acoustic model. + * Upgrade a custom acoustic model. * * Initiates the upgrade of a custom acoustic model to the latest version of its base language model. The upgrade * method is asynchronous. It can take on the order of minutes or hours to complete depending on the amount of data in @@ -1150,14 +1160,14 @@ public ServiceCall trainAcousticModel(TrainAcousticModelOptions trainAcous * the total audio contained in the custom model. A custom model must be in the `ready` or `available` state to be * upgraded. You must use credentials for the instance of the service that owns a model to upgrade it. The method * returns an HTTP 200 response code to indicate that the upgrade process has begun successfully. You can monitor the - * status of the upgrade by using the `GET /v1/acoustic_customizations/{customization_id}` method to poll the model's - * status. Use a loop to check the status once a minute. While it is being upgraded, the custom model has the status - * `upgrading`. When the upgrade is complete, the model resumes the status that it had prior to upgrade. The service - * cannot accept subsequent requests for the model until the upgrade completes. If the custom acoustic model was - * trained with a separately created custom language model, you must use the `custom_language_model_id` query - * parameter to specify the GUID of that custom language model. The custom language model must be upgraded before the - * custom acoustic model can be upgraded. Omit the parameter if the custom acoustic model was not trained with a - * custom language model. For more information, see [Upgrading custom + * status of the upgrade by using the **List a custom acoustic model** method to poll the model's status. Use a loop + * to check the status once a minute. While it is being upgraded, the custom model has the status `upgrading`. When + * the upgrade is complete, the model resumes the status that it had prior to upgrade. The service cannot accept + * subsequent requests for the model until the upgrade completes. If the custom acoustic model was trained with a + * separately created custom language model, you must use the `custom_language_model_id` parameter to specify the GUID + * of that custom language model. The custom language model must be upgraded before the custom acoustic model can be + * upgraded. Omit the parameter if the custom acoustic model was not trained with a custom language model. For more + * information, see [Upgrading custom * models](https://console.bluemix.net/docs/services/speech-to-text/custom-upgrade.html). * * @param upgradeAcousticModelOptions the {@link UpgradeAcousticModelOptions} containing the options for the call @@ -1176,21 +1186,21 @@ public ServiceCall upgradeAcousticModel(UpgradeAcousticModelOptions upgrad } /** - * Adds an audio resource to a custom acoustic model. + * Add an audio resource. * * Adds an audio resource to a custom acoustic model. Add audio content that reflects the acoustic characteristics of * the audio that you plan to transcribe. You must use credentials for the instance of the service that owns a model * to add an audio resource to it. Adding audio data does not affect the custom acoustic model until you train the - * model for the new data by using the `POST /v1/acoustic_customizations/{customization_id}/train` method. You can add - * individual audio files or an archive file that contains multiple audio files. Adding multiple audio files via a - * single archive file is significantly more efficient than adding each file individually. * You can add an individual - * audio file in any format that the service supports for speech recognition. Use the `Content-Type` header to specify - * the format of the audio file. * You can add an archive file (**.zip** or **.tar.gz** file) that contains audio - * files in any format that the service supports for speech recognition. All audio files added with the same archive - * file must have the same audio format. Use the `Content-Type` header to specify the archive type, `application/zip` - * or `application/gzip`. Use the `Contained-Content-Type` header to specify the format of the contained audio files; - * the default format is `audio/wav`. You can use this method to add any number of audio resources to a custom model - * by calling the method once for each audio or archive file. But the addition of one audio resource must be fully + * model for the new data by using the **Train a custom acoustic model** method. You can add individual audio files or + * an archive file that contains multiple audio files. Adding multiple audio files via a single archive file is + * significantly more efficient than adding each file individually. * You can add an individual audio file in any + * format that the service supports for speech recognition. Use the `Content-Type` header to specify the format of the + * audio file. * You can add an archive file (**.zip** or **.tar.gz** file) that contains audio files in any format + * that the service supports for speech recognition. All audio files added with the same archive file must have the + * same audio format. Use the `Content-Type` header to specify the archive type, `application/zip` or + * `application/gzip`. Use the `Contained-Content-Type` header to specify the format of the contained audio files; the + * default format is `audio/wav`. You can use this method to add any number of audio resources to a custom model by + * calling the method once for each audio or archive file. But the addition of one audio resource must be fully * complete before you can add another. You must add a minimum of 10 minutes and a maximum of 50 hours of audio that * includes speech, not just silence, to a custom acoustic model before you can train it. No audio resource, audio- or * archive-type, can be larger than 100 MB. The method is asynchronous. It can take several seconds to complete @@ -1199,14 +1209,13 @@ public ServiceCall upgradeAcousticModel(UpgradeAcousticModelOptions upgrad * contents of the audio file or files and automatically extracts information about the audio such as its length, * sampling rate, and encoding. You cannot submit requests to add additional audio resources to a custom acoustic * model, or to train the model, until the service's analysis of all audio files for the current request completes. To - * determine the status of the service's analysis of the audio, use the `GET - * /v1/acoustic_customizations/{customization_id}/audio/{audio_name}` method to poll the status of the audio. The - * method accepts the GUID of the custom model and the name of the audio resource, and it returns the status of the - * resource. Use a loop to check the status of the audio every few seconds until it becomes `ok`. **Note:** The - * sampling rate of an audio file must match the sampling rate of the base model for the custom model: for broadband - * models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than - * the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the - * audio is lower than the minimum required rate, the service labels the audio file as `invalid`. + * determine the status of the service's analysis of the audio, use the **List an audio resource** method to poll the + * status of the audio. The method accepts the GUID of the custom model and the name of the audio resource, and it + * returns the status of the resource. Use a loop to check the status of the audio every few seconds until it becomes + * `ok`. **Note:** The sampling rate of an audio file must match the sampling rate of the base model for the custom + * model: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the + * audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the + * sampling rate of the audio is lower than the minimum required rate, the service labels the audio file as `invalid`. * * @param addAudioOptions the {@link AddAudioOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -1230,13 +1239,13 @@ public ServiceCall addAudio(AddAudioOptions addAudioOptions) { } /** - * Deletes an audio resource from a custom acoustic model. + * Delete an audio resource. * * Deletes an existing audio resource from a custom acoustic model. Deleting an archive-type audio resource removes * the entire archive of files; the current interface does not allow deletion of individual files from an archive * resource. Removing an audio resource does not affect the custom model until you train the model on its updated data - * by using the `POST /v1/acoustic_customizations/{customization_id}/train` method. You must use credentials for the - * instance of the service that owns a model to delete its audio resources. + * by using the **Train a custom acoustic model** method. You must use credentials for the instance of the service + * that owns a model to delete its audio resources. * * @param deleteAudioOptions the {@link DeleteAudioOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -1251,7 +1260,7 @@ public ServiceCall deleteAudio(DeleteAudioOptions deleteAudioOptions) { } /** - * Lists information about an audio resource for a custom acoustic model. + * List an audio resource. * * Lists information about an audio resource from a custom acoustic model. The method returns an `AudioListing` object * whose fields depend on the type of audio resource you specify with the method's `audio_name` parameter: * **For an @@ -1276,7 +1285,7 @@ public ServiceCall getAudio(GetAudioOptions getAudioOptions) { } /** - * Lists information about all audio resources for a custom acoustic model. + * List audio resources. * * Lists information about all audio resources from a custom acoustic model. The information includes the name of the * resource and information about its audio data, such as its duration. It also includes the status of the audio diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AcousticModel.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AcousticModel.java index 35e51394d1c..41f0f86429b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AcousticModel.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AcousticModel.java @@ -181,8 +181,8 @@ public Long getProgress() { /** * Gets the warnings. * - * If the request included unknown query parameters, the following message: `Unexpected query parameter(s) - * ['parameters'] detected`, where `parameters` is a list that includes a quoted string for each unknown parameter. + * If the request included unknown parameters, the following message: `Unexpected query parameter(s) ['parameters'] + * detected`, where `parameters` is a list that includes a quoted string for each unknown parameter. * * @return the warnings */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/CreateJobOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/CreateJobOptions.java index a7cba7e9a5d..52239d712a3 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/CreateJobOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/CreateJobOptions.java @@ -12,9 +12,6 @@ */ package com.ibm.watson.developer_cloud.speech_to_text.v1.model; -import com.ibm.watson.developer_cloud.service.model.GenericModel; -import com.ibm.watson.developer_cloud.util.Validator; - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -22,6 +19,9 @@ import java.util.ArrayList; import java.util.List; +import com.ibm.watson.developer_cloud.service.model.GenericModel; +import com.ibm.watson.developer_cloud.util.Validator; + /** * The createJob options. */ @@ -62,17 +62,7 @@ public interface ContentType { } /** - * Set to `chunked` to send the audio in streaming mode. The data does not need to exist fully before being streamed - * to the service. - */ - public interface TransferEncoding { - /** chunked. */ - String CHUNKED = "chunked"; - } - - /** - * The identifier of the model to be used for the recognition request. (Use `GET /v1/models` for a list of available - * models.). + * The identifier of the model that is to be used for the recognition request. */ public interface Model { /** ar-AR_BroadbandModel. */ @@ -95,6 +85,10 @@ public interface Model { String JA_JP_BROADBANDMODEL = "ja-JP_BroadbandModel"; /** ja-JP_NarrowbandModel. */ String JA_JP_NARROWBANDMODEL = "ja-JP_NarrowbandModel"; + /** ko-KR_BroadbandModel. */ + String KO_KR_BROADBANDMODEL = "ko-KR_BroadbandModel"; + /** ko-KR_NarrowbandModel. */ + String KO_KR_NARROWBANDMODEL = "ko-KR_NarrowbandModel"; /** pt-BR_BroadbandModel. */ String PT_BR_BROADBANDMODEL = "pt-BR_BroadbandModel"; /** pt-BR_NarrowbandModel. */ @@ -108,14 +102,14 @@ public interface Model { /** * If the job includes a callback URL, a comma-separated list of notification events to which to subscribe. Valid * events are: `recognitions.started` generates a callback notification when the service begins to process the job. - * `recognitions.completed` generates a callback notification when the job is complete; you must use the `GET - * /v1/recognitions/{id}` method to retrieve the results before they time out or are deleted. - * `recognitions.completed_with_results` generates a callback notification when the job is complete; the notification - * includes the results of the request. `recognitions.failed` generates a callback notification if the service - * experiences an error while processing the job. Omit the parameter to subscribe to the default events: - * `recognitions.started`, `recognitions.completed`, and `recognitions.failed`. The `recognitions.completed` and - * `recognitions.completed_with_results` events are incompatible; you can specify only of the two events. If the job - * does not include a callback URL, omit the parameter. + * `recognitions.completed` generates a callback notification when the job is complete; you must use the **Check a + * job** method to retrieve the results before they time out or are deleted. `recognitions.completed_with_results` + * generates a callback notification when the job is complete; the notification includes the results of the request. + * `recognitions.failed` generates a callback notification if the service experiences an error while processing the + * job. Omit the parameter to subscribe to the default events: `recognitions.started`, `recognitions.completed`, and + * `recognitions.failed`. The `recognitions.completed` and `recognitions.completed_with_results` events are + * incompatible; you can specify only of the two events. If the job does not include a callback URL, omit the + * parameter. */ public interface Events { /** recognitions.started. */ @@ -137,8 +131,8 @@ public interface Events { private Long resultsTtl; private String customizationId; private String acousticCustomizationId; - private Double customizationWeight; private String version; + private Double customizationWeight; private Long inactivityTimeout; private List keywords; private Float keywordsThreshold; @@ -163,8 +157,8 @@ public static class Builder { private Long resultsTtl; private String customizationId; private String acousticCustomizationId; - private Double customizationWeight; private String version; + private Double customizationWeight; private Long inactivityTimeout; private List keywords; private Float keywordsThreshold; @@ -186,8 +180,8 @@ private Builder(CreateJobOptions createJobOptions) { resultsTtl = createJobOptions.resultsTtl; customizationId = createJobOptions.customizationId; acousticCustomizationId = createJobOptions.acousticCustomizationId; - customizationWeight = createJobOptions.customizationWeight; version = createJobOptions.version; + customizationWeight = createJobOptions.customizationWeight; inactivityTimeout = createJobOptions.inactivityTimeout; keywords = createJobOptions.keywords; keywordsThreshold = createJobOptions.keywordsThreshold; @@ -330,24 +324,24 @@ public Builder acousticCustomizationId(String acousticCustomizationId) { } /** - * Set the customizationWeight. + * Set the version. * - * @param customizationWeight the customizationWeight + * @param version the version * @return the CreateJobOptions builder */ - public Builder customizationWeight(Double customizationWeight) { - this.customizationWeight = customizationWeight; + public Builder version(String version) { + this.version = version; return this; } /** - * Set the version. + * Set the customizationWeight. * - * @param version the version + * @param customizationWeight the customizationWeight * @return the CreateJobOptions builder */ - public Builder version(String version) { - this.version = version; + public Builder customizationWeight(Double customizationWeight) { + this.customizationWeight = customizationWeight; return this; } @@ -487,8 +481,8 @@ private CreateJobOptions(Builder builder) { resultsTtl = builder.resultsTtl; customizationId = builder.customizationId; acousticCustomizationId = builder.acousticCustomizationId; - customizationWeight = builder.customizationWeight; version = builder.version; + customizationWeight = builder.customizationWeight; inactivityTimeout = builder.inactivityTimeout; keywords = builder.keywords; keywordsThreshold = builder.keywordsThreshold; @@ -535,8 +529,7 @@ public String contentType() { /** * Gets the model. * - * The identifier of the model to be used for the recognition request. (Use `GET /v1/models` for a list of available - * models.). + * The identifier of the model that is to be used for the recognition request. * * @return the model */ @@ -548,9 +541,9 @@ public String model() { * Gets the callbackUrl. * * A URL to which callback notifications are to be sent. The URL must already be successfully white-listed by using - * the `POST /v1/register_callback` method. Omit the parameter to poll the service for job completion and results. You - * can include the same callback URL with any number of job creation requests. Use the `user_token` query parameter to - * specify a unique user-specified string with each job to differentiate the callback notifications for the jobs. + * the **Register a callback** method. Omit the parameter to poll the service for job completion and results. You can + * include the same callback URL with any number of job creation requests. Use the `user_token` parameter to specify a + * unique user-specified string with each job to differentiate the callback notifications for the jobs. * * @return the callbackUrl */ @@ -563,14 +556,14 @@ public String callbackUrl() { * * If the job includes a callback URL, a comma-separated list of notification events to which to subscribe. Valid * events are: `recognitions.started` generates a callback notification when the service begins to process the job. - * `recognitions.completed` generates a callback notification when the job is complete; you must use the `GET - * /v1/recognitions/{id}` method to retrieve the results before they time out or are deleted. - * `recognitions.completed_with_results` generates a callback notification when the job is complete; the notification - * includes the results of the request. `recognitions.failed` generates a callback notification if the service - * experiences an error while processing the job. Omit the parameter to subscribe to the default events: - * `recognitions.started`, `recognitions.completed`, and `recognitions.failed`. The `recognitions.completed` and - * `recognitions.completed_with_results` events are incompatible; you can specify only of the two events. If the job - * does not include a callback URL, omit the parameter. + * `recognitions.completed` generates a callback notification when the job is complete; you must use the **Check a + * job** method to retrieve the results before they time out or are deleted. `recognitions.completed_with_results` + * generates a callback notification when the job is complete; the notification includes the results of the request. + * `recognitions.failed` generates a callback notification if the service experiences an error while processing the + * job. Omit the parameter to subscribe to the default events: `recognitions.started`, `recognitions.completed`, and + * `recognitions.failed`. The `recognitions.completed` and `recognitions.completed_with_results` events are + * incompatible; you can specify only of the two events. If the job does not include a callback URL, omit the + * parameter. * * @return the events */ @@ -632,13 +625,28 @@ public String acousticCustomizationId() { return acousticCustomizationId; } + /** + * Gets the version. + * + * The version of the specified base model that is to be used with the request. Multiple versions of a base model can + * exist when a model is updated for internal improvements. The parameter is intended primarily for use with custom + * models that have been upgraded for a new base model. The default value depends on whether the parameter is used + * with or without a custom model. For more information, see [Base model + * version](https://console.bluemix.net/docs/services/speech-to-text/input.html#version). + * + * @return the version + */ + public String version() { + return version; + } + /** * Gets the customizationWeight. * - * If you specify a `customization_id` with the request, you can use the `customization_weight` parameter to tell the - * service how much weight to give to words from the custom language model compared to those from the base model for - * speech recognition. Specify a value between 0.0 and 1.0. Unless a different customization weight was specified for - * the custom model when it was trained, the default value is 0.3. A customization weight that you specify overrides a + * If you specify a customization ID with the request, you can use the customization weight to tell the service how + * much weight to give to words from the custom language model compared to those from the base model for speech + * recognition. Specify a value between 0.0 and 1.0. Unless a different customization weight was specified for the + * custom model when it was trained, the default value is 0.3. A customization weight that you specify overrides a * weight that was specified when the custom model was trained. The default value yields the best performance in * general. Assign a higher value if your audio makes frequent use of OOV words from the custom model. Use caution * when setting the weight: a higher value can improve the accuracy of phrases from the custom model's domain, but it @@ -650,21 +658,6 @@ public Double customizationWeight() { return customizationWeight; } - /** - * Gets the version. - * - * The version of the specified base `model` that is to be used with the request. Multiple versions of a base model - * can exist when a model is updated for internal improvements. The parameter is intended primarily for use with - * custom models that have been upgraded for a new base model. The default value depends on whether the parameter is - * used with or without a custom model. For more information, see [Base model - * version](https://console.bluemix.net/docs/services/speech-to-text/input.html#version). - * - * @return the version - */ - public String version() { - return version; - } - /** * Gets the inactivityTimeout. * @@ -683,7 +676,8 @@ public Long inactivityTimeout() { * * Array of keyword strings to spot in the audio. Each keyword string can include one or more tokens. Keywords are * spotted only in the final hypothesis, not in interim results. If you specify any keywords, you must also specify a - * keywords threshold. Omit the parameter or specify an empty array if you do not need to spot keywords. + * keywords threshold. You can spot a maximum of 1000 keywords. Omit the parameter or specify an empty array if you do + * not need to spot keywords. * * @return the keywords */ @@ -784,7 +778,7 @@ public Boolean smartFormatting() { * Indicates whether labels that identify which words were spoken by which participants in a multi-person exchange are * to be included in the response. The default is `false`; no speaker labels are returned. Setting `speaker_labels` to * `true` forces the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter. - * To determine whether a language model supports speaker labels, use the `GET /v1/models` method and check that the + * To determine whether a language model supports speaker labels, use the **Get models** method and check that the * attribute `speaker_labels` is set to `true`. You can also refer to [Speaker * labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels). * diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetModelOptions.java index d987debb05f..acdc483ff6a 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetModelOptions.java @@ -21,7 +21,7 @@ public class GetModelOptions extends GenericModel { /** - * The identifier of the desired model in the form of its `name` from the output of `GET /v1/models`. + * The identifier of the desired model in the form of its `name` from the output of **Get models**. */ public interface ModelId { /** ar-AR_BroadbandModel. */ @@ -44,6 +44,10 @@ public interface ModelId { String JA_JP_BROADBANDMODEL = "ja-JP_BroadbandModel"; /** ja-JP_NarrowbandModel. */ String JA_JP_NARROWBANDMODEL = "ja-JP_NarrowbandModel"; + /** ko-KR_BroadbandModel. */ + String KO_KR_BROADBANDMODEL = "ko-KR_BroadbandModel"; + /** ko-KR_NarrowbandModel. */ + String KO_KR_NARROWBANDMODEL = "ko-KR_NarrowbandModel"; /** pt-BR_BroadbandModel. */ String PT_BR_BROADBANDMODEL = "pt-BR_BroadbandModel"; /** pt-BR_NarrowbandModel. */ @@ -119,7 +123,7 @@ public Builder newBuilder() { /** * Gets the modelId. * - * The identifier of the desired model in the form of its `name` from the output of `GET /v1/models`. + * The identifier of the desired model in the form of its `name` from the output of **Get models**. * * @return the modelId */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/LanguageModel.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/LanguageModel.java index cc28869a06a..084f071e9aa 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/LanguageModel.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/LanguageModel.java @@ -196,8 +196,8 @@ public Long getProgress() { /** * Gets the warnings. * - * If the request included unknown query parameters, the following message: `Unexpected query parameter(s) - * ['parameters'] detected`, where `parameters` is a list that includes a quoted string for each unknown parameter. + * If the request included unknown parameters, the following message: `Unexpected query parameter(s) ['parameters'] + * detected`, where `parameters` is a list that includes a quoted string for each unknown parameter. * * @return the warnings */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/RecognitionJob.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/RecognitionJob.java index 1da91248b4b..14c33d2eaec 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/RecognitionJob.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/RecognitionJob.java @@ -106,8 +106,8 @@ public String getUpdated() { /** * Gets the url. * - * The URL to use to request information about the job with the `GET /v1/recognitions/{id}` method. **Note:** This - * field is returned only when you create a new job. + * The URL to use to request information about the job with the **Check a job** method. **Note:** This field is + * returned only when you create a new job. * * @return the url */ @@ -143,7 +143,7 @@ public List getResults() { /** * Gets the warnings. * - * An array of warning messages about invalid query parameters included with the request. Each warning includes a + * An array of warning messages about invalid parameters included with the request. Each warning includes a * descriptive message and a list of invalid argument strings, for example, `"unexpected query parameter 'user_token', * query parameter 'callback_url' was not specified"`. The request succeeds despite the warnings. **Note:** This field * can be returned only when you create a new job. diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechModel.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechModel.java index 3e91507c37b..c7beb6f10f7 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechModel.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechModel.java @@ -98,8 +98,8 @@ public String getDescription() { /** * Gets the sessions. * - * The URI for the model for use with the `POST /v1/sessions` method. (Returned only for requests for a single model - * with the `GET /v1/models/{model_id}` method.). + * The URI for the model for use with the **Create a session** method. (Returned only for requests for a single model + * with the **Get a model** method.). * * @return the sessions */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResult.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResult.java index ce1bb5cd5ea..005ba7b9c1d 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResult.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResult.java @@ -59,8 +59,8 @@ public List getAlternatives() { * Gets the keywordsResult. * * A dictionary (or associative array) whose keys are the strings specified for `keywords` if both that parameter and - * `keywords_threshold` are specified. A keyword for which no matches are found is omitted from the array. The array - * is omitted if no keywords are found. + * `keywords_threshold` are specified. A keyword for which no matches are found is omitted from the array. You can + * spot a maximum of 1000 keywords. The array is omitted if no keywords are found. * * @return the keywordsResult */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResults.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResults.java index 1bc97a3889e..9cb63297e9a 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResults.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SpeechRecognitionResults.java @@ -71,8 +71,8 @@ public List getSpeakerLabels() { /** * Gets the warnings. * - * An array of warning messages associated with the request: * Warnings for invalid query parameters or JSON fields - * can include a descriptive message and a list of invalid argument strings, for example, `"Unknown arguments:"` or + * An array of warning messages associated with the request: * Warnings for invalid parameters or JSON fields can + * include a descriptive message and a list of invalid argument strings, for example, `"Unknown arguments:"` or * `"Unknown url query arguments:"` followed by a list of the form `"invalid_arg_1, invalid_arg_2."` * The following * warning is returned if the request passes a custom model that is based on an older version of a base model for * which an updated version is available: `"Using previous version of base model, because your custom model has been diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SupportedFeatures.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SupportedFeatures.java index 30c422e1229..cbad90eb530 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SupportedFeatures.java +++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/SupportedFeatures.java @@ -40,7 +40,7 @@ public Boolean isCustomLanguageModel() { /** * Gets the speakerLabels. * - * Indicates whether the `speaker_labels` parameter can be used with the language model. + * Indicates whether the **speaker_labels** parameter can be used with the language model. * * @return the speakerLabels */ diff --git a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextIT.java b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextIT.java index 424558fe814..c662860357e 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextIT.java +++ b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextIT.java @@ -918,9 +918,8 @@ public void testAddAudioArchive() throws FileNotFoundException, InterruptedExcep GetAcousticModelOptions getOptions = new GetAcousticModelOptions.Builder() .customizationId(id) .build(); - for (int x = 0; - x < 30 && !service.getAcousticModel(getOptions).execute().getStatus().equals(AcousticModel.Status.AVAILABLE); - x++) { + for (int x = 0; x < 30 && !service.getAcousticModel(getOptions).execute().getStatus().equals( + AcousticModel.Status.AVAILABLE); x++) { Thread.sleep(5000); } 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 38a65fed3ca..76a5c8941b6 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 @@ -334,7 +334,7 @@ public void testRecognizeWithCustomization() throws FileNotFoundException, Inter final RecordedRequest request = server.takeRequest(); assertEquals("POST", request.getMethod()); - assertEquals(PATH_RECOGNIZE + "?customization_id=" + id + "&version=" + version, request.getPath()); + assertEquals(PATH_RECOGNIZE + "?customization_id=" + id + "&base_model_version=" + version, request.getPath()); assertEquals(recognition, GSON.toJsonTree(result)); } @@ -364,7 +364,7 @@ public void testRecognizeWithAcousticCustomization() throws FileNotFoundExceptio final RecordedRequest request = server.takeRequest(); assertEquals("POST", request.getMethod()); - assertEquals(PATH_RECOGNIZE + "?acoustic_customization_id=" + id + "&version=" + version, + assertEquals(PATH_RECOGNIZE + "?acoustic_customization_id=" + id + "&base_model_version=" + version, request.getPath()); assertEquals(recognition, GSON.toJsonTree(result)); } @@ -470,8 +470,8 @@ public void testCreateJob() throws InterruptedException, FileNotFoundException { + "&user_token=" + userToken + "&results_ttl=" + resultsTtl + "&customization_id=" + customizationId + + "&base_model_version=" + version + "&customization_weight=" + customizationWeight - + "&version=" + version + "&inactivity_timeout=" + inactivityTimeout + "&keywords=" + StringUtils.join(keywords, ',') + "&keywords_threshold=" + keywordsThreshold 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 9d826ff5a05..9028d3d0430 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 @@ -16,6 +16,7 @@ import com.ibm.watson.developer_cloud.http.RequestBuilder; import com.ibm.watson.developer_cloud.http.ServiceCall; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordOptions; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordsOptions; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.CreateVoiceModelOptions; @@ -43,19 +44,20 @@ import java.io.InputStream; /** + * ### Service Overview + * The IBM Watson Text to Speech service provides an API that uses IBM's speech-synthesis capabilities to synthesize + * text into natural-sounding speech in a variety of languages, dialects, and voices. The service supports at least one + * male or female voice, sometimes both, for each language. The audio is streamed back to the client with minimal delay. + * ### API Overview * The Text to Speech service consists of the following related endpoints: - * * `/v1/voices` provides information about the voices available for synthesized speech. - * * `/v1/synthesize` synthesizes written text to audio speech. - * * `/v1/pronunciation` returns the pronunciation for a specified word. The `/v1/pronunciation` method is currently - * beta functionality. - * * `/v1/customizations` and `/v1/customizations/{customization_id}` lets users create custom voice models, which are - * dictionaries of words and their translations for use in speech synthesis. All `/v1/customizations` methods are - * currently beta functionality. - * * `/v1/customizations/{customization_id}/words` and `/v1/customizations/{customization_id}/words/{word}` lets users - * manage the words in a custom voice model. - * - * For more information about the service and its various interfaces, see [About Text to - * Speech](https://console.bluemix.net/docs/services/text-to-speech/index.html). + * * **Voices** provides information about the voices available for synthesized speech. + * * **Synthesis** synthesizes written text to audio speech. + * * **Pronunciation** returns the pronunciation for a specified word. The **Get pronunciation** method is currently + * beta. + * * **Custom models** and let users create custom voice models, which are dictionaries of words and their translations + * for use in speech synthesis. All custom model methods are currently beta features. + * * **Custom words** let users manage the words in a custom voice model. All custom word methods are currently beta + * features. * * @version v1 * @see Text to Speech @@ -87,12 +89,24 @@ public TextToSpeech(String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `TextToSpeech` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @param iamOptions the options for authenticating through IAM + */ + public TextToSpeech(IamOptions iamOptions) { + this(); + setIamCredentials(iamOptions); + } + /** * Retrieves a specific voice available for speech synthesis. * - * Lists information about the voice specified with the `voice` path parameter. Specify the `customization_id` query - * parameter to obtain information for that custom voice model of the specified voice. Use the `GET /v1/voices` method - * to see a list of all available voices. + * Lists information about the specified voice. The information includes the name, language, gender, and other details + * about the voice. Specify a customization ID to obtain information for that custom voice model of the specified + * voice. * * @param getVoiceOptions the {@link GetVoiceOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Voice} @@ -110,10 +124,10 @@ public ServiceCall getVoice(GetVoiceOptions getVoiceOptions) { } /** - * Retrieves all voices available for speech synthesis. + * Get voices. * - * Lists information about all available voices. To see information about a specific voice, use the `GET - * /v1/voices/{voice}` method. + * Retrieves a list of all voices available for use with the service. The information includes the name, language, + * gender, and other details about the voice. * * @param listVoicesOptions the {@link ListVoicesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Voices} @@ -127,10 +141,10 @@ public ServiceCall listVoices(ListVoicesOptions listVoicesOptions) { } /** - * Retrieves all voices available for speech synthesis. + * Get voices. * - * Lists information about all available voices. To see information about a specific voice, use the `GET - * /v1/voices/{voice}` method. + * Retrieves a list of all voices available for use with the service. The information includes the name, language, + * gender, and other details about the voice. * * @return a {@link ServiceCall} with a response type of {@link Voices} */ @@ -139,17 +153,19 @@ public ServiceCall listVoices() { } /** - * Streaming speech synthesis of the text in the body parameter. - * - * Synthesizes text to spoken audio, returning the synthesized audio stream as an array of bytes. Identical to the - * `GET` method but passes longer text in the body of the request, not with the URL. Text size is limited to 5 KB. - * (For the `audio/l16` format, you can optionally specify `endianness=big-endian` or `endianness=little-endian`; the - * default is little endian.) If a request includes invalid query parameters, the service returns a `Warnings` - * response header that provides messages about the invalid parameters. The warning includes a descriptive message and - * a list of invalid argument strings. For example, a message such as `\"Unknown arguments:\"` or `\"Unknown url query - * arguments:\"` followed by a list of the form `\"invalid_arg_1, invalid_arg_2.\"` The request succeeds despite the - * warnings. **Note about the Try It Out feature:** The `Try it out!` button is **not** supported for use with the the - * `POST /v1/synthesize` method. For examples of calls to the method, see the [Text to Speech API + * Synthesize audio. + * + * Synthesizes text to spoken audio, returning the synthesized audio stream as an array of bytes. You can pass a + * maximum of 5 KB of text. Use the `Accept` header or the `accept` query parameter to specify the requested format + * (MIME type) of the response audio. By default, the service uses `audio/ogg;codecs=opus`. For detailed information + * about the supported audio formats and sampling rates, see [Specifying an audio + * format](https://console.bluemix.net/docs/services/text-to-speech/http.html#format). If a request includes invalid + * query parameters, the service returns a `Warnings` response header that provides messages about the invalid + * parameters. The warning includes a descriptive message and a list of invalid argument strings. For example, a + * message such as `\"Unknown arguments:\"` or `\"Unknown url query arguments:\"` followed by a list of the form + * `\"invalid_arg_1, invalid_arg_2.\"` The request succeeds despite the warnings. **Note about the Try It Out + * feature:** The `Try it out!` button is **not** supported for use with the the `POST /v1/synthesize` method. For + * examples of calls to the method, see the [Text to Speech API * reference](http://www.ibm.com/watson/developercloud/text-to-speech/api/v1/). * * @param synthesizeOptions the {@link SynthesizeOptions} containing the options for the call @@ -175,12 +191,12 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) } /** - * Gets the pronunciation for a word. + * Get pronunciation. * - * Returns the phonetic pronunciation for the word specified by the `text` parameter. You can request the - * pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default - * translation for the language of that voice or for a specific custom voice model to see the translation for that - * voice model. **Note:** This method is currently a beta release. + * Returns the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. + * You can also request the pronunciation for a specific voice to see the default translation for the language of that + * voice or for a specific custom voice model to see the translation for that voice model. **Note:** This method is + * currently a beta release. * * @param getPronunciationOptions the {@link GetPronunciationOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Pronunciation} @@ -203,10 +219,11 @@ public ServiceCall getPronunciation(GetPronunciationOptions getPr } /** - * Creates a new custom voice model. + * Create a custom model. * - * Creates a new empty custom voice model. The model is owned by the instance of the service whose credentials are - * used to create it. **Note:** This method is currently a beta release. + * Creates a new empty custom voice model. You must specify a name for the new custom model; you can optionally + * specify the language and a description of the new model. The model is owned by the instance of the service whose + * credentials are used to create it. **Note:** This method is currently a beta release. * * @param createVoiceModelOptions the {@link CreateVoiceModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link VoiceModel} @@ -228,10 +245,10 @@ public ServiceCall createVoiceModel(CreateVoiceModelOptions createVo } /** - * Deletes a custom voice model. + * Delete a custom model. * - * Deletes the custom voice model with the specified `customization_id`. You must use credentials for the instance of - * the service that owns a model to delete it. **Note:** This method is currently a beta release. + * Deletes the specified custom voice model. You must use credentials for the instance of the service that owns a + * model to delete it. **Note:** This method is currently a beta release. * * @param deleteVoiceModelOptions the {@link DeleteVoiceModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -246,13 +263,12 @@ public ServiceCall deleteVoiceModel(DeleteVoiceModelOptions deleteVoiceMod } /** - * Queries the contents of a custom voice model. + * List a custom model. * - * Lists all information about the custom voice model with the specified `customization_id`. In addition to metadata - * such as the name and description of the voice model, the output includes the words in the model and their - * translations as defined in the model. To see just the metadata for a voice model, use the `GET /v1/customizations` - * method. You must use credentials for the instance of the service that owns a model to list information about it. - * **Note:** This method is currently a beta release. + * Lists all information about a specified custom voice model. In addition to metadata such as the name and + * description of the voice model, the output includes the words and their translations as defined in the model. To + * see just the metadata for a voice model, use the **List custom models** method. **Note:** This method is currently + * a beta release. * * @param getVoiceModelOptions the {@link GetVoiceModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link VoiceModel} @@ -267,13 +283,13 @@ public ServiceCall getVoiceModel(GetVoiceModelOptions getVoiceModelO } /** - * Lists all available custom voice models for a language or for all languages. + * List custom models. * - * Lists metadata such as the name and description for the custom voice models that you own. Use the `language` query - * parameter to list the voice models that you own for the specified language only. Omit the parameter to see all - * voice models that you own for all languages. To see the words in addition to the metadata for a specific voice - * model, use the `GET /v1/customizations/{customization_id}` method. You must use credentials for the instance of the - * service that owns a model to list information about it. **Note:** This method is currently a beta release. + * Lists metadata such as the name and description for all custom voice models that are owned by an instance of the + * service. Specify a language to list the voice models for that language only. To see the words in addition to the + * metadata for a specific voice model, use the **List a custom model** method. You must use credentials for the + * instance of the service that owns a model to list information about it. **Note:** This method is currently a beta + * release. * * @param listVoiceModelsOptions the {@link ListVoiceModelsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link VoiceModels} @@ -290,13 +306,13 @@ public ServiceCall listVoiceModels(ListVoiceModelsOptions listVoice } /** - * Lists all available custom voice models for a language or for all languages. + * List custom models. * - * Lists metadata such as the name and description for the custom voice models that you own. Use the `language` query - * parameter to list the voice models that you own for the specified language only. Omit the parameter to see all - * voice models that you own for all languages. To see the words in addition to the metadata for a specific voice - * model, use the `GET /v1/customizations/{customization_id}` method. You must use credentials for the instance of the - * service that owns a model to list information about it. **Note:** This method is currently a beta release. + * Lists metadata such as the name and description for all custom voice models that are owned by an instance of the + * service. Specify a language to list the voice models for that language only. To see the words in addition to the + * metadata for a specific voice model, use the **List a custom model** method. You must use credentials for the + * instance of the service that owns a model to list information about it. **Note:** This method is currently a beta + * release. * * @return a {@link ServiceCall} with a response type of {@link VoiceModels} */ @@ -305,13 +321,13 @@ public ServiceCall listVoiceModels() { } /** - * Updates information and words for a custom voice model. + * Update a custom model. * - * Updates information for the custom voice model with the specified `customization_id`. You can update the metadata - * such as the name and description of the voice model. You can also update the words in the model and their - * translations. Adding a new translation for a word that already exists in a custom model overwrites the word's - * existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the - * instance of the service that owns a model to update it. **Note:** This method is currently a beta release. + * Updates information for the specified custom voice model. You can update metadata such as the name and description + * of the voice model. You can also update the words in the model and their translations. Adding a new translation for + * a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain + * no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to update + * it. **Note:** This method is currently a beta release. * * @param updateVoiceModelOptions the {@link UpdateVoiceModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -337,12 +353,11 @@ public ServiceCall updateVoiceModel(UpdateVoiceModelOptions updateVoiceMod } /** - * Adds a word to a custom voice model. + * Add a custom word. * - * Adds a single word and its translation to the custom voice model with the specified `customization_id`. Adding a - * new translation for a word that already exists in a custom model overwrites the word's existing translation. A - * custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that - * owns a model to add a word to it. **Note:** This method is currently a beta release. + * Adds a single word and its translation to the specified custom voice model. Adding a new translation for a word + * that already exists in a custom model overwrites the word's existing translation. A custom model can contain no + * more than 20,000 entries. **Note:** This method is currently a beta release. * * @param addWordOptions the {@link AddWordOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -365,12 +380,11 @@ public ServiceCall addWord(AddWordOptions addWordOptions) { } /** - * Adds one or more words to a custom voice model. + * Add custom words. * - * Adds one or more words and their translations to the custom voice model with the specified `customization_id`. - * Adding a new translation for a word that already exists in a custom model overwrites the word's existing - * translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of - * the service that owns a model to add words to it. **Note:** This method is currently a beta release. + * Adds one or more words and their translations to the specified custom voice model. Adding a new translation for a + * word that already exists in a custom model overwrites the word's existing translation. A custom model can contain + * no more than 20,000 entries. **Note:** This method is currently a beta release. * * @param addWordsOptions the {@link AddWordsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -390,10 +404,9 @@ public ServiceCall addWords(AddWordsOptions addWordsOptions) { } /** - * Deletes a word from a custom voice model. + * Delete a custom word. * - * Deletes a single word from the custom voice model with the specified `customization_id`. You must use credentials - * for the instance of the service that owns a model to delete it. **Note:** This method is currently a beta release. + * Deletes a single word from the specified custom voice model. **Note:** This method is currently a beta release. * * @param deleteWordOptions the {@link DeleteWordOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -408,11 +421,10 @@ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { } /** - * Queries details about a word in a custom voice model. + * List a custom word. * - * Returns the translation for a single word from the custom model with the specified `customization_id`. The output - * shows the translation as it is defined in the model. You must use credentials for the instance of the service that - * owns a model to query information about its words. **Note:** This method is currently a beta release. + * Returns the translation for a single word from the specified custom model. The output shows the translation as it + * is defined in the model. **Note:** This method is currently a beta release. * * @param getWordOptions the {@link GetWordOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Translation} @@ -427,11 +439,10 @@ public ServiceCall getWord(GetWordOptions getWordOptions) { } /** - * Queries details about the words in a custom voice model. + * List custom words. * - * Lists all of the words and their translations for the custom voice model with the specified `customization_id`. The - * output shows the translations as they are defined in the model. You must use credentials for the instance of the - * service that owns a model to query information about its words. **Note:** This method is currently a beta release. + * Lists all of the words and their translations for the specified custom voice model. The output shows the + * translations as they are defined in the model. **Note:** This method is currently a beta release. * * @param listWordsOptions the {@link ListWordsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Words} diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordOptions.java index 4b05c183b67..d566b4460ae 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordOptions.java @@ -188,8 +188,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model that is to be updated. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordsOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordsOptions.java index 125b3262f78..871ddf3984d 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordsOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/AddWordsOptions.java @@ -130,8 +130,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model that is to be updated. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ @@ -142,8 +142,11 @@ public String customizationId() { /** * Gets the words. * - * An array of words and their translations from the custom voice model. The words are listed in alphabetical order, - * with uppercase letters listed before lowercase letters. The array is empty if the custom model contains no words. + * **When adding words to a custom voice model,** an array of `Word` objects that provides one or more words that are + * to be added or updated for the custom voice model and the translation for each specified word. **When listing words + * from a custom voice model,** an array of `Word` objects that lists the words and their translations from the custom + * voice model. The words are listed in alphabetical order, with uppercase letters listed before lowercase letters. + * The array is empty if the custom model contains no words. * * @return the words */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteVoiceModelOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteVoiceModelOptions.java index 11cf8c62310..0f49cfac52c 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteVoiceModelOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteVoiceModelOptions.java @@ -85,8 +85,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model that is to be deleted. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteWordOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteWordOptions.java index 99fc3951576..eb1d6fa4c2f 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteWordOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/DeleteWordOptions.java @@ -103,8 +103,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model from which to delete a word. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetPronunciationOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetPronunciationOptions.java index 137f298fd81..469629af54a 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetPronunciationOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetPronunciationOptions.java @@ -22,7 +22,7 @@ public class GetPronunciationOptions extends GenericModel { /** * A voice that specifies the language in which the pronunciation is to be returned. All voices for the same language - * (for example, `en-US`) return the same translation. Retrieve available voices with the `GET /v1/voices` method. + * (for example, `en-US`) return the same translation. */ public interface Voice { /** en-US_AllisonVoice. */ @@ -188,7 +188,7 @@ public String text() { * Gets the voice. * * A voice that specifies the language in which the pronunciation is to be returned. All voices for the same language - * (for example, `en-US`) return the same translation. Retrieve available voices with the `GET /v1/voices` method. + * (for example, `en-US`) return the same translation. * * @return the voice */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceModelOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceModelOptions.java index 37f34c8e3df..9e5df5f5b1f 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceModelOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceModelOptions.java @@ -85,8 +85,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model that is to be queried. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceOptions.java index dbe66089c9d..ab860a887dc 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetVoiceOptions.java @@ -21,7 +21,7 @@ public class GetVoiceOptions extends GenericModel { /** - * The voice for which information is to be returned. Retrieve available voices with the `GET /v1/voices` method. + * The voice for which information is to be returned. */ public interface Voice { /** en-US_AllisonVoice. */ @@ -134,7 +134,7 @@ public Builder newBuilder() { /** * Gets the voice. * - * The voice for which information is to be returned. Retrieve available voices with the `GET /v1/voices` method. + * The voice for which information is to be returned. * * @return the voice */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetWordOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetWordOptions.java index b85bc5b15fd..a93d276c76d 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetWordOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/GetWordOptions.java @@ -103,8 +103,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model from which to query a word. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/ListWordsOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/ListWordsOptions.java index aee973d4f43..0b49615315f 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/ListWordsOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/ListWordsOptions.java @@ -85,8 +85,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model that is to be queried. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ 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 c17155bb676..04996338271 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 @@ -55,7 +55,7 @@ public interface Accept { } /** - * The voice to use for synthesis. Retrieve available voices with the `GET /v1/voices` method. + * The voice to use for synthesis. */ public interface Voice { /** en-US_AllisonVoice. */ @@ -222,7 +222,7 @@ public String accept() { /** * Gets the voice. * - * The voice to use for synthesis. Retrieve available voices with the `GET /v1/voices` method. + * The voice to use for synthesis. * * @return the voice */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/UpdateVoiceModelOptions.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/UpdateVoiceModelOptions.java index 6179ea043ab..f29b1f4ee42 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/UpdateVoiceModelOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/UpdateVoiceModelOptions.java @@ -149,8 +149,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The GUID of the custom voice model that is to be updated. You must make the request with service credentials - * created for the instance of the service that owns the custom model. + * The GUID of the custom voice model. You must make the request with service credentials created for the instance of + * the service that owns the custom model. * * @return the customizationId */ @@ -183,8 +183,8 @@ public String description() { /** * Gets the words. * - * An array of words and their translations that are to be added or updated for the custom voice model. Pass an empty - * array to make no additions or updates. + * An array of `Word` objects that provides the words and their translations that are to be added or updated for the + * custom voice model. Pass an empty array to make no additions or updates. * * @return the words */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/VoiceModel.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/VoiceModel.java index b77d53be52c..68c68eadf98 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/VoiceModel.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/VoiceModel.java @@ -117,9 +117,10 @@ public String getDescription() { /** * Gets the words. * - * An array of words and their translations from the custom voice model. The words are listed in alphabetical order, - * with uppercase letters listed before lowercase letters. The array is empty if the custom model contains no words. - * **Note:** This field is returned only when you list information about a specific custom voice model. + * An array of `Word` objects that lists the words and their translations from the custom voice model. The words are + * listed in alphabetical order, with uppercase letters listed before lowercase letters. The array is empty if the + * custom model contains no words. **Note:** This field is returned only when you list information about a specific + * custom voice model. * * @return the words */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/Words.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/Words.java index f00c7a7cb7f..7bbf6415178 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/Words.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/Words.java @@ -26,8 +26,11 @@ public class Words extends GenericModel { /** * Gets the words. * - * An array of words and their translations from the custom voice model. The words are listed in alphabetical order, - * with uppercase letters listed before lowercase letters. The array is empty if the custom model contains no words. + * **When adding words to a custom voice model,** an array of `Word` objects that provides one or more words that are + * to be added or updated for the custom voice model and the translation for each specified word. **When listing words + * from a custom voice model,** an array of `Word` objects that lists the words and their translations from the custom + * voice model. The words are listed in alphabetical order, with uppercase letters listed before lowercase letters. + * The array is empty if the custom model contains no words. * * @return the words */ diff --git a/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzer.java b/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzer.java index 4d08b52bd79..3e08790635e 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzer.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzer.java @@ -16,6 +16,7 @@ import com.ibm.watson.developer_cloud.http.RequestBuilder; import com.ibm.watson.developer_cloud.http.ServiceCall; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis; import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneChatOptions; import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneOptions; @@ -72,6 +73,20 @@ public ToneAnalyzer(String versionDate, String username, String password) { setUsernameAndPassword(username, password); } + /** + * Instantiates a new `ToneAnalyzer` 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @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 iamOptions the options for authenticating through IAM + */ + public ToneAnalyzer(String versionDate, IamOptions iamOptions) { + this(versionDate); + setIamCredentials(iamOptions); + } + /** * Analyze general tone. * diff --git a/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneChatOptions.java b/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneChatOptions.java index 485e5d295e1..2e8aa306497 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneChatOptions.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneChatOptions.java @@ -12,12 +12,12 @@ */ package com.ibm.watson.developer_cloud.tone_analyzer.v3.model; -import com.ibm.watson.developer_cloud.service.model.GenericModel; -import com.ibm.watson.developer_cloud.util.Validator; - import java.util.ArrayList; import java.util.List; +import com.ibm.watson.developer_cloud.service.model.GenericModel; +import com.ibm.watson.developer_cloud.util.Validator; + /** * The toneChat options. */ @@ -26,8 +26,8 @@ public class ToneChatOptions extends GenericModel { /** * The language of the input text for the request: English or French. Regional variants are treated as their parent * language; for example, `en-US` is interpreted as `en`. The input content must match the specified language. Do not - * submit content that contains both languages. You can specify any combination of languages for `Content-Language` - * and `Accept-Language`. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. + * submit content that contains both languages. You can use different languages for **Content-Language** and + * **Accept-Language**. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. */ public interface ContentLanguage { /** en. */ @@ -38,7 +38,8 @@ public interface ContentLanguage { /** * The desired language of the response. For two-character arguments, regional variants are treated as their parent - * language; for example, `en-US` is interpreted as `en`. + * language; for example, `en-US` is interpreted as `en`. You can use different languages for **Content-Language** and + * **Accept-Language**. */ public interface AcceptLanguage { /** ar. */ @@ -189,8 +190,8 @@ public List utterances() { * * The language of the input text for the request: English or French. Regional variants are treated as their parent * language; for example, `en-US` is interpreted as `en`. The input content must match the specified language. Do not - * submit content that contains both languages. You can specify any combination of languages for `Content-Language` - * and `Accept-Language`. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. + * submit content that contains both languages. You can use different languages for **Content-Language** and + * **Accept-Language**. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. * * @return the contentLanguage */ @@ -202,7 +203,8 @@ public String contentLanguage() { * Gets the acceptLanguage. * * The desired language of the response. For two-character arguments, regional variants are treated as their parent - * language; for example, `en-US` is interpreted as `en`. + * language; for example, `en-US` is interpreted as `en`. You can use different languages for **Content-Language** and + * **Accept-Language**. * * @return the acceptLanguage */ diff --git a/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneOptions.java b/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneOptions.java index a6d9aa1fccd..be20fd6b3bb 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneOptions.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneOptions.java @@ -48,8 +48,8 @@ public interface Tone { /** * The language of the input text for the request: English or French. Regional variants are treated as their parent * language; for example, `en-US` is interpreted as `en`. The input content must match the specified language. Do not - * submit content that contains both languages. You can specify any combination of languages for `Content-Language` - * and `Accept-Language`. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. + * submit content that contains both languages. You can use different languages for **Content-Language** and + * **Accept-Language**. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. */ public interface ContentLanguage { /** en. */ @@ -60,8 +60,8 @@ public interface ContentLanguage { /** * The desired language of the response. For two-character arguments, regional variants are treated as their parent - * language; for example, `en-US` is interpreted as `en`. You can specify any combination of languages for - * `Content-Language` and `Accept-Language`. + * language; for example, `en-US` is interpreted as `en`. You can use different languages for **Content-Language** and + * **Accept-Language**. */ public interface AcceptLanguage { /** ar. */ @@ -318,8 +318,8 @@ public List tones() { * * The language of the input text for the request: English or French. Regional variants are treated as their parent * language; for example, `en-US` is interpreted as `en`. The input content must match the specified language. Do not - * submit content that contains both languages. You can specify any combination of languages for `Content-Language` - * and `Accept-Language`. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. + * submit content that contains both languages. You can use different languages for **Content-Language** and + * **Accept-Language**. * **`2017-09-21`:** Accepts `en` or `fr`. * **`2016-05-19`:** Accepts only `en`. * * @return the contentLanguage */ @@ -331,8 +331,8 @@ public String contentLanguage() { * Gets the acceptLanguage. * * The desired language of the response. For two-character arguments, regional variants are treated as their parent - * language; for example, `en-US` is interpreted as `en`. You can specify any combination of languages for - * `Content-Language` and `Accept-Language`. + * language; for example, `en-US` is interpreted as `en`. You can use different languages for **Content-Language** and + * **Accept-Language**. * * @return the acceptLanguage */ 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 6ca4e72e906..1a6f511cc46 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 @@ -15,6 +15,7 @@ import com.ibm.watson.developer_cloud.http.RequestBuilder; import com.ibm.watson.developer_cloud.http.ServiceCall; import com.ibm.watson.developer_cloud.service.WatsonService; +import com.ibm.watson.developer_cloud.service.security.IamOptions; import com.ibm.watson.developer_cloud.util.RequestUtils; import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; import com.ibm.watson.developer_cloud.util.Validator; @@ -101,6 +102,20 @@ protected void setAuthentication(okhttp3.Request.Builder builder) { } } + /** + * 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 before this one + * expires. Failing to do so will result in authentication errors after this token expires. + * + * @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 iamOptions the options for authenticating through IAM + */ + public VisualRecognition(String versionDate, IamOptions iamOptions) { + this(versionDate); + setIamCredentials(iamOptions); + } + /** * Classify images. *