diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index aee48443ecd..345299d01e8 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 6.6.0
+current_version = 6.7.0
commit = True
message = docs: Update version numbers from {current_version} -> {new_version}
diff --git a/.travis.yml b/.travis.yml
index b5d09ffa746..51816dd7119 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,7 +41,7 @@ before_script:
- 'if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then chmod a+x ./appscan/ASOC.sh; fi'
script:
- - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_b248e84a4806_key -iv $encrypted_b248e84a4806_iv -in config.properties.enc -out core/src/test/resources/config.properties -d || true'
+ - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_42d9c68e608d_key -iv $encrypted_42d9c68e608d_iv -in config.properties.enc -out core/src/test/resources/config.properties -d || true'
- 'if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then ./appscan/ASOC.sh; fi'
- ./gradlew install -x check
- ./gradlew checkstyleMain
diff --git a/README.md b/README.md
index 0edad536be3..c025d0145b2 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ Java client library to use the [Watson APIs][wdc].
* [Tradeoff Analytics](tradeoff-analytics)
* [Visual Recognition](visual-recognition)
* [Android](#android)
- * [Using a proxy](#using-a-proxy)
+ * [Configuring the HTTP client](#configuring-the-http-client)
* [Default headers](#default-headers)
* [Sending request headers](#sending-request-headers)
* [Parsing HTTP response info](#parsing-http-response-info)
@@ -60,7 +60,7 @@ All the services:
com.ibm.watson.developer_cloud
java-sdk
- 6.6.0
+ 6.7.0
```
@@ -70,7 +70,7 @@ Only Discovery:
com.ibm.watson.developer_cloud
discovery
- 6.6.0
+ 6.7.0
```
@@ -79,13 +79,13 @@ Only Discovery:
All the services:
```gradle
-'com.ibm.watson.developer_cloud:java-sdk:6.6.0'
+'com.ibm.watson.developer_cloud:java-sdk:6.7.0'
```
Only Assistant:
```gradle
-'com.ibm.watson.developer_cloud:assistant:6.6.0'
+'com.ibm.watson.developer_cloud:assistant:6.7.0'
```
##### Development snapshots
@@ -108,7 +108,7 @@ And then reference the snapshot version on your app module gradle
Only Speech to Text:
```gradle
-'com.ibm.watson.developer_cloud:speech-to-text:6.6.1-SNAPSHOT'
+'com.ibm.watson.developer_cloud:speech-to-text:6.7.1-SNAPSHOT'
```
##### JAR
@@ -228,33 +228,24 @@ service.setApiKey("");
The Android SDK utilizes the Java SDK while making some Android-specific additions. This repository can be found [here](https://github.com/watson-developer-cloud/android-sdk). It depends on [OkHttp][] and [gson][].
-## Using a proxy
+## Configuring the HTTP client
-Override the `configureHttpClient()` method and add the proxy using the `OkHttpClient.Builder` object.
+The HTTP client can be configured by using the `configureClient()` method on your service object, passing in an `HttpConfigOptions` object. Currently, the following options are supported:
+- Disabling SSL verification (only do this if you really mean to!) ⚠️
+- Using a proxy (more info here: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564))
-For example:
+Here's an example of setting both of the above:
```java
-Assistant service = new Assistant("2018-02-16") {
- @Override
- protected OkHttpClient configureHttpClient() {
- Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080));
- return super.configureHttpClient().newBuilder().proxy(proxy).build();
- }
-};
-
-service.setUsernameAndPassword("", "");
-
-WorkspaceCollection workspaces = service.listWorkspaces().execute();
-System.out.println(workspaces);
-```
+Discovery service = new Discovery("2017-11-07");
-For more information see: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564)
+// setting configuration options
+HttpConfigOptions options = new HttpConfigOptions.Builder()
+ .disableSslVerification(true)
+ .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080)))
+ .build();
-```java
-PersonalityInsights service = new PersonalityInsights("2016-10-19");
-String apiKey = CredentialUtils.getAPIKey(service.getName(), CredentialUtils.PLAN_STANDARD);
-service.setApiKey(apiKey);
+service.configureClient(options);
```
## Sending request headers
@@ -375,7 +366,7 @@ Gradle:
```sh
cd java-sdk
-gradle jar # build jar file (build/libs/watson-developer-cloud-6.6.0.jar)
+gradle jar # build jar file (build/libs/watson-developer-cloud-6.7.0.jar)
gradle test # run tests
gradle check # performs quality checks on source files and generates reports
gradle testReport # run tests and generate the aggregated test report (build/reports/allTests)
@@ -428,4 +419,4 @@ or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
[ibm-cloud-onboarding]: http://console.bluemix.net/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Java
-[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-6.6.0/java-sdk-6.6.0-jar-with-dependencies.jar
+[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-6.7.0/java-sdk-6.7.0-jar-with-dependencies.jar
diff --git a/assistant/README.md b/assistant/README.md
index 92f1b02f110..1483f8999d4 100644
--- a/assistant/README.md
+++ b/assistant/README.md
@@ -1,5 +1,8 @@
# Assistant
+## Assistant v2 is now available :tada::tada::tada:
+Check it out in the `assistant/v2` folder.
+
## Installation
##### Maven
@@ -7,20 +10,23 @@
com.ibm.watson.developer_cloud
assistant
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:assistant:6.6.0'
+'com.ibm.watson.developer_cloud:assistant:6.7.0'
```
## Usage
-
Use the [Assistant][assistant] service to identify intents, entities, and conduct conversations.
+### Using Assistant v1
```java
+// make sure to use the Assistant v1 import!
+import com.ibm.watson.developer_cloud.assistant.v1.Assistant;
+
Assistant service = new Assistant("2018-02-16");
service.setUsernameAndPassword("", "");
@@ -32,9 +38,11 @@ MessageResponse response = service.message(options).execute();
System.out.println(response);
```
-Moving from Node 1 to Node 2.
-
+Maintaining context across messages:
```java
+// make sure to use the Assistant v1 import!
+import com.ibm.watson.developer_cloud.assistant.v1.Assistant;
+
Context context = null;
// first message
@@ -45,12 +53,13 @@ MessageOptions newMessageOptions = new MessageOptions.Builder()
.build();
MessageResponse response = service.message(newMessageOptions).execute();
+context = response.getContext();
// second message
newMessageOptions = new MessageOptions.Builder()
.workspaceId("")
.input(new InputData.Builder("Second message").build())
- .context(response.getContext()) // output context from the first message
+ .context(context) // using context from the first message
.build();
response = service.message(newMessageOptions).execute();
@@ -58,4 +67,63 @@ response = service.message(newMessageOptions).execute();
System.out.println(response);
```
+---
+
+### Using Assistant v2
+```java
+// make sure to use the Assistant v2 import!
+import com.ibm.watson.developer_cloud.assistant.v2.Assistant;
+
+Assistant service = new Assistant("2018-09-20");
+service.setUsernameAndPassword("", "");
+
+MessageInput input = new MessageInput.Builder()
+ .text("Hi")
+ .build();
+MessageOptions messageOptions = new MessageOptions.Builder()
+ .assistantId("")
+ .sessionId("")
+ .input(input)
+ .build();
+MessageResponse messageResponse = service.message(messageOptions).execute();
+
+System.out.println(messageResponse);
+```
+
+Maintaining context across messages:
+```java
+// make sure to use the Assistant v2 import!
+import com.ibm.watson.developer_cloud.assistant.v2.Assistant;
+
+MessageContext context = new MessageContext();
+
+// first message
+MessageInput input = new MessageInput.Builder()
+ .text("First message")
+ .build();
+MessageOptions messageOptions = new MessageOptions.Builder()
+ .assistantId(assistantId)
+ .sessionId(sessionId)
+ .input(input)
+ .context(context)
+ .build();
+
+MessageResponse messageResponse = service.message(messageOptions).execute();
+context = messageResponse.getContext();
+
+// second message
+input = new MessageInput.Builder()
+ .text("Second message")
+ .build();
+messageOptions = new MessageOptions.Builder()
+ .assistantId(assistantId)
+ .sessionId(sessionId)
+ .input(input)
+ .context(context) // using context from first message
+ .build();
+
+messageResponse = service.message(messageOptions).execute();
+
+System.out.println(messageResponse);
+```
[assistant]: https://console.bluemix.net/docs/services/assistant/index.html
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/OutputData.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/OutputData.java
index 9a1377c2a13..49ccaeabb2c 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/OutputData.java
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/OutputData.java
@@ -34,8 +34,6 @@ public class OutputData extends DynamicModel {
}.getType();
private Type nodesVisitedDetailsType = new TypeToken>() {
}.getType();
- private Type actionsType = new TypeToken>() {
- }.getType();
/**
* Gets the logMessages.
@@ -83,15 +81,6 @@ public List getNodesVisitedDetails() {
nodesVisitedDetailsType);
}
- /**
- * Gets the actions.
- *
- * @return the actions
- */
- public List getActions() {
- return GsonSerializationHelper.serializeDynamicModelProperty(this.get("actions"), actionsType);
- }
-
/**
* Sets the logMessages.
*
@@ -136,13 +125,4 @@ public void setNodesVisited(final List nodesVisited) {
public void setNodesVisitedDetails(final List nodesVisitedDetails) {
this.put("nodes_visited_details", nodesVisitedDetails);
}
-
- /**
- * Sets the actions.
- *
- * @param actions the new actions
- */
- public void setActions(final List actions) {
- this.put("actions", actions);
- }
}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/Assistant.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/Assistant.java
new file mode 100644
index 00000000000..3a43900468c
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/Assistant.java
@@ -0,0 +1,154 @@
+/*
+ * 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.assistant.v2;
+
+import com.google.gson.JsonObject;
+import com.ibm.watson.developer_cloud.assistant.v2.model.CreateSessionOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.DeleteSessionOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageResponse;
+import com.ibm.watson.developer_cloud.assistant.v2.model.SessionResponse;
+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;
+
+/**
+ * The IBM Watson™ Assistant service combines machine learning, natural language understanding, and integrated
+ * dialog tools to create conversation flows between your apps and your users.
+ *
+ * @version v2
+ * @see Assistant
+ */
+public class Assistant extends WatsonService {
+
+ private static final String SERVICE_NAME = "assistant";
+ private static final String URL = "https://gateway.watsonplatform.net/assistant/api";
+
+ private String versionDate;
+
+ /**
+ * Instantiates a new `Assistant`.
+ *
+ * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API
+ * calls from failing when the service introduces breaking changes.
+ */
+ public Assistant(String versionDate) {
+ super(SERVICE_NAME);
+ if ((getEndPoint() == null) || getEndPoint().isEmpty()) {
+ setEndPoint(URL);
+ }
+
+ Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null.");
+
+ this.versionDate = versionDate;
+ }
+
+ /**
+ * Instantiates a new `Assistant` with username and password.
+ *
+ * @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 username the username
+ * @param password the password
+ */
+ public Assistant(String versionDate, String username, String password) {
+ this(versionDate);
+ 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 or after receiving a 401 error from the service. 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);
+ }
+
+ /**
+ * Create a session.
+ *
+ * Create a new session. A session is used to send user input to a skill and receive responses. It also maintains the
+ * state of the conversation.
+ *
+ * @param createSessionOptions the {@link CreateSessionOptions} containing the options for the call
+ * @return a {@link ServiceCall} with a response type of {@link SessionResponse}
+ */
+ public ServiceCall createSession(CreateSessionOptions createSessionOptions) {
+ Validator.notNull(createSessionOptions, "createSessionOptions cannot be null");
+ String[] pathSegments = { "v2/assistants", "sessions" };
+ String[] pathParameters = { createSessionOptions.assistantId() };
+ RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
+ pathParameters));
+ builder.query(VERSION, versionDate);
+ return createServiceCall(builder.build(), ResponseConverterUtils.getObject(SessionResponse.class));
+ }
+
+ /**
+ * Delete session.
+ *
+ * Deletes a session explicitly before it times out.
+ *
+ * @param deleteSessionOptions the {@link DeleteSessionOptions} containing the options for the call
+ * @return a {@link ServiceCall} with a response type of Void
+ */
+ public ServiceCall deleteSession(DeleteSessionOptions deleteSessionOptions) {
+ Validator.notNull(deleteSessionOptions, "deleteSessionOptions cannot be null");
+ String[] pathSegments = { "v2/assistants", "sessions" };
+ String[] pathParameters = { deleteSessionOptions.assistantId(), deleteSessionOptions.sessionId() };
+ RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
+ pathParameters));
+ builder.query(VERSION, versionDate);
+ return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
+ }
+
+ /**
+ * Send user input to assistant.
+ *
+ * Send user input to an assistant and receive a response.
+ *
+ * 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 = { "v2/assistants", "sessions", "message" };
+ String[] pathParameters = { messageOptions.assistantId(), messageOptions.sessionId() };
+ RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
+ pathParameters));
+ builder.query(VERSION, versionDate);
+ final JsonObject contentJson = new JsonObject();
+ if (messageOptions.input() != null) {
+ contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input()));
+ }
+ if (messageOptions.context() != null) {
+ contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context()));
+ }
+ builder.bodyJson(contentJson);
+ return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MessageResponse.class));
+ }
+
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/CaptureGroup.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/CaptureGroup.java
new file mode 100644
index 00000000000..56723fd7d9a
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/CaptureGroup.java
@@ -0,0 +1,66 @@
+/*
+ * 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.assistant.v2.model;
+
+import java.util.List;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * CaptureGroup.
+ */
+public class CaptureGroup extends GenericModel {
+
+ private String group;
+ private List location;
+
+ /**
+ * Gets the group.
+ *
+ * A recognized capture group for the entity.
+ *
+ * @return the group
+ */
+ public String getGroup() {
+ return group;
+ }
+
+ /**
+ * Gets the location.
+ *
+ * Zero-based character offsets that indicate where the entity value begins and ends in the input text.
+ *
+ * @return the location
+ */
+ public List getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets the group.
+ *
+ * @param group the new group
+ */
+ public void setGroup(final String group) {
+ this.group = group;
+ }
+
+ /**
+ * Sets the location.
+ *
+ * @param location the new location
+ */
+ public void setLocation(final List location) {
+ this.location = location;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/CreateSessionOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/CreateSessionOptions.java
new file mode 100644
index 00000000000..b85e2318f58
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/CreateSessionOptions.java
@@ -0,0 +1,99 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+import com.ibm.watson.developer_cloud.util.Validator;
+
+/**
+ * The createSession options.
+ */
+public class CreateSessionOptions extends GenericModel {
+
+ private String assistantId;
+
+ /**
+ * Builder.
+ */
+ public static class Builder {
+ private String assistantId;
+
+ private Builder(CreateSessionOptions createSessionOptions) {
+ assistantId = createSessionOptions.assistantId;
+ }
+
+ /**
+ * Instantiates a new builder.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Instantiates a new builder with required properties.
+ *
+ * @param assistantId the assistantId
+ */
+ public Builder(String assistantId) {
+ this.assistantId = assistantId;
+ }
+
+ /**
+ * Builds a CreateSessionOptions.
+ *
+ * @return the createSessionOptions
+ */
+ public CreateSessionOptions build() {
+ return new CreateSessionOptions(this);
+ }
+
+ /**
+ * Set the assistantId.
+ *
+ * @param assistantId the assistantId
+ * @return the CreateSessionOptions builder
+ */
+ public Builder assistantId(String assistantId) {
+ this.assistantId = assistantId;
+ return this;
+ }
+ }
+
+ private CreateSessionOptions(Builder builder) {
+ Validator.notEmpty(builder.assistantId, "assistantId cannot be empty");
+ assistantId = builder.assistantId;
+ }
+
+ /**
+ * New builder.
+ *
+ * @return a CreateSessionOptions builder
+ */
+ public Builder newBuilder() {
+ return new Builder(this);
+ }
+
+ /**
+ * Gets the assistantId.
+ *
+ * Unique identifier of the assistant. You can find the assistant ID of an assistant on the **Assistants** tab of the
+ * Watson Assistant tool. For information about creating assistants, see the
+ * [documentation](https://console.bluemix.net/docs/services/assistant/create-assistant.html#creating-assistants).
+ *
+ * **Note:** Currently, the v2 API does not support creating assistants.
+ *
+ * @return the assistantId
+ */
+ public String assistantId() {
+ return assistantId;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DeleteSessionOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DeleteSessionOptions.java
new file mode 100644
index 00000000000..d26247c8b95
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DeleteSessionOptions.java
@@ -0,0 +1,128 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+import com.ibm.watson.developer_cloud.util.Validator;
+
+/**
+ * The deleteSession options.
+ */
+public class DeleteSessionOptions extends GenericModel {
+
+ private String assistantId;
+ private String sessionId;
+
+ /**
+ * Builder.
+ */
+ public static class Builder {
+ private String assistantId;
+ private String sessionId;
+
+ private Builder(DeleteSessionOptions deleteSessionOptions) {
+ assistantId = deleteSessionOptions.assistantId;
+ sessionId = deleteSessionOptions.sessionId;
+ }
+
+ /**
+ * Instantiates a new builder.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Instantiates a new builder with required properties.
+ *
+ * @param assistantId the assistantId
+ * @param sessionId the sessionId
+ */
+ public Builder(String assistantId, String sessionId) {
+ this.assistantId = assistantId;
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * Builds a DeleteSessionOptions.
+ *
+ * @return the deleteSessionOptions
+ */
+ public DeleteSessionOptions build() {
+ return new DeleteSessionOptions(this);
+ }
+
+ /**
+ * Set the assistantId.
+ *
+ * @param assistantId the assistantId
+ * @return the DeleteSessionOptions builder
+ */
+ public Builder assistantId(String assistantId) {
+ this.assistantId = assistantId;
+ return this;
+ }
+
+ /**
+ * Set the sessionId.
+ *
+ * @param sessionId the sessionId
+ * @return the DeleteSessionOptions builder
+ */
+ public Builder sessionId(String sessionId) {
+ this.sessionId = sessionId;
+ return this;
+ }
+ }
+
+ private DeleteSessionOptions(Builder builder) {
+ Validator.notEmpty(builder.assistantId, "assistantId cannot be empty");
+ Validator.notEmpty(builder.sessionId, "sessionId cannot be empty");
+ assistantId = builder.assistantId;
+ sessionId = builder.sessionId;
+ }
+
+ /**
+ * New builder.
+ *
+ * @return a DeleteSessionOptions builder
+ */
+ public Builder newBuilder() {
+ return new Builder(this);
+ }
+
+ /**
+ * Gets the assistantId.
+ *
+ * Unique identifier of the assistant. You can find the assistant ID of an assistant on the **Assistants** tab of the
+ * Watson Assistant tool. For information about creating assistants, see the
+ * [documentation](https://console.bluemix.net/docs/services/assistant/create-assistant.html#creating-assistants).
+ *
+ * **Note:** Currently, the v2 API does not support creating assistants.
+ *
+ * @return the assistantId
+ */
+ public String assistantId() {
+ return assistantId;
+ }
+
+ /**
+ * Gets the sessionId.
+ *
+ * Unique identifier of the session.
+ *
+ * @return the sessionId
+ */
+ public String sessionId() {
+ return sessionId;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogLogMessage.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogLogMessage.java
new file mode 100644
index 00000000000..71728637a52
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogLogMessage.java
@@ -0,0 +1,58 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * Dialog log message details.
+ */
+public class DialogLogMessage extends GenericModel {
+
+ /**
+ * The severity of the log message.
+ */
+ public interface Level {
+ /** info. */
+ String INFO = "info";
+ /** error. */
+ String ERROR = "error";
+ /** warn. */
+ String WARN = "warn";
+ }
+
+ private String level;
+ private String message;
+
+ /**
+ * Gets the level.
+ *
+ * The severity of the log message.
+ *
+ * @return the level
+ */
+ public String getLevel() {
+ return level;
+ }
+
+ /**
+ * Gets the message.
+ *
+ * The text of the log message.
+ *
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeAction.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeAction.java
new file mode 100644
index 00000000000..aeb4455d3da
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeAction.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.assistant.v2.model;
+
+import java.util.Map;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * DialogNodeAction.
+ */
+public class DialogNodeAction extends GenericModel {
+
+ /**
+ * The type of action to invoke.
+ */
+ public interface ActionType {
+ /** client. */
+ String CLIENT = "client";
+ /** server. */
+ String SERVER = "server";
+ }
+
+ private String name;
+ @SerializedName("type")
+ private String actionType;
+ private Map parameters;
+ @SerializedName("result_variable")
+ private String resultVariable;
+ private String credentials;
+
+ /**
+ * Gets the name.
+ *
+ * The name of the action.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the actionType.
+ *
+ * The type of action to invoke.
+ *
+ * @return the actionType
+ */
+ public String getActionType() {
+ return actionType;
+ }
+
+ /**
+ * Gets the parameters.
+ *
+ * A map of key/value pairs to be provided to the action.
+ *
+ * @return the parameters
+ */
+ public Map getParameters() {
+ return parameters;
+ }
+
+ /**
+ * Gets the resultVariable.
+ *
+ * The location in the dialog context where the result of the action is stored.
+ *
+ * @return the resultVariable
+ */
+ public String getResultVariable() {
+ return resultVariable;
+ }
+
+ /**
+ * Gets the credentials.
+ *
+ * The name of the context variable that the client application will use to pass in credentials for the action.
+ *
+ * @return the credentials
+ */
+ public String getCredentials() {
+ return credentials;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeOutputOptionsElement.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeOutputOptionsElement.java
new file mode 100644
index 00000000000..d8d182d56b2
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeOutputOptionsElement.java
@@ -0,0 +1,46 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * DialogNodeOutputOptionsElement.
+ */
+public class DialogNodeOutputOptionsElement extends GenericModel {
+
+ private String label;
+ private DialogNodeOutputOptionsElementValue value;
+
+ /**
+ * Gets the label.
+ *
+ * The user-facing label for the option.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * Gets the value.
+ *
+ * An object defining the message input to be sent to the assistant if the user selects the corresponding option.
+ *
+ * @return the value
+ */
+ public DialogNodeOutputOptionsElementValue getValue() {
+ return value;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeOutputOptionsElementValue.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeOutputOptionsElementValue.java
new file mode 100644
index 00000000000..b30ba44662f
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodeOutputOptionsElementValue.java
@@ -0,0 +1,34 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * An object defining the message input to be sent to the assistant if the user selects the corresponding option.
+ */
+public class DialogNodeOutputOptionsElementValue extends GenericModel {
+
+ private MessageInput input;
+
+ /**
+ * Gets the input.
+ *
+ * The user input.
+ *
+ * @return the input
+ */
+ public MessageInput getInput() {
+ return input;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodesVisited.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodesVisited.java
new file mode 100644
index 00000000000..f14d6af3648
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogNodesVisited.java
@@ -0,0 +1,60 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * DialogNodesVisited.
+ */
+public class DialogNodesVisited extends GenericModel {
+
+ @SerializedName("dialog_node")
+ private String dialogNode;
+ private String title;
+ private String conditions;
+
+ /**
+ * Gets the dialogNode.
+ *
+ * A dialog node that was triggered during processing of the input message.
+ *
+ * @return the dialogNode
+ */
+ public String getDialogNode() {
+ return dialogNode;
+ }
+
+ /**
+ * Gets the title.
+ *
+ * The title of the dialog node.
+ *
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Gets the conditions.
+ *
+ * The conditions that trigger the dialog node.
+ *
+ * @return the conditions
+ */
+ public String getConditions() {
+ return conditions;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogRuntimeResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogRuntimeResponseGeneric.java
new file mode 100644
index 00000000000..c89966756d2
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogRuntimeResponseGeneric.java
@@ -0,0 +1,210 @@
+/*
+ * 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.assistant.v2.model;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * DialogRuntimeResponseGeneric.
+ */
+public class DialogRuntimeResponseGeneric extends GenericModel {
+
+ /**
+ * The type of response returned by the dialog node. The specified response type must be supported by the client
+ * application or channel.
+ *
+ * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for
+ * Premium users.
+ */
+ public interface ResponseType {
+ /** text. */
+ String TEXT = "text";
+ /** pause. */
+ String PAUSE = "pause";
+ /** image. */
+ String IMAGE = "image";
+ /** option. */
+ String OPTION = "option";
+ /** connect_to_agent. */
+ String CONNECT_TO_AGENT = "connect_to_agent";
+ /** suggestion. */
+ String SUGGESTION = "suggestion";
+ }
+
+ /**
+ * The preferred type of control to display.
+ */
+ public interface Preference {
+ /** dropdown. */
+ String DROPDOWN = "dropdown";
+ /** button. */
+ String BUTTON = "button";
+ }
+
+ @SerializedName("response_type")
+ private String responseType;
+ private String text;
+ private Long time;
+ private Boolean typing;
+ private String source;
+ private String title;
+ private String description;
+ private String preference;
+ private List options;
+ @SerializedName("message_to_human_agent")
+ private String messageToHumanAgent;
+ private String topic;
+ private List suggestions;
+
+ /**
+ * Gets the responseType.
+ *
+ * The type of response returned by the dialog node. The specified response type must be supported by the client
+ * application or channel.
+ *
+ * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for
+ * Premium users.
+ *
+ * @return the responseType
+ */
+ public String getResponseType() {
+ return responseType;
+ }
+
+ /**
+ * Gets the text.
+ *
+ * The text of the response.
+ *
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Gets the time.
+ *
+ * How long to pause, in milliseconds.
+ *
+ * @return the time
+ */
+ public Long getTime() {
+ return time;
+ }
+
+ /**
+ * Gets the typing.
+ *
+ * Whether to send a "user is typing" event during the pause.
+ *
+ * @return the typing
+ */
+ public Boolean isTyping() {
+ return typing;
+ }
+
+ /**
+ * Gets the source.
+ *
+ * The URL of the image.
+ *
+ * @return the source
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * Gets the title.
+ *
+ * The title to show before the response.
+ *
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * The description to show with the the response.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the preference.
+ *
+ * The preferred type of control to display.
+ *
+ * @return the preference
+ */
+ public String getPreference() {
+ return preference;
+ }
+
+ /**
+ * Gets the options.
+ *
+ * An array of objects describing the options from which the user can choose.
+ *
+ * @return the options
+ */
+ public List getOptions() {
+ return options;
+ }
+
+ /**
+ * Gets the messageToHumanAgent.
+ *
+ * A message to be sent to the human agent who will be taking over the conversation.
+ *
+ * @return the messageToHumanAgent
+ */
+ public String getMessageToHumanAgent() {
+ return messageToHumanAgent;
+ }
+
+ /**
+ * Gets the topic.
+ *
+ * A label identifying the topic of the conversation, derived from the **user_label** property of the relevant node.
+ *
+ * @return the topic
+ */
+ public String getTopic() {
+ return topic;
+ }
+
+ /**
+ * Gets the suggestions.
+ *
+ * An array of objects describing the possible matching dialog nodes from which the user can choose.
+ *
+ * **Note:** The **suggestions** property is part of the disambiguation feature, which is only available for Premium
+ * users.
+ *
+ * @return the suggestions
+ */
+ public List getSuggestions() {
+ return suggestions;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogSuggestion.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogSuggestion.java
new file mode 100644
index 00000000000..2cfe70b59a0
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogSuggestion.java
@@ -0,0 +1,63 @@
+/*
+ * 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.assistant.v2.model;
+
+import java.util.Map;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * DialogSuggestion.
+ */
+public class DialogSuggestion extends GenericModel {
+
+ private String label;
+ private DialogSuggestionValue value;
+ private Map output;
+
+ /**
+ * Gets the label.
+ *
+ * The user-facing label for the disambiguation option. This label is taken from the **user_label** property of the
+ * corresponding dialog node.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * Gets the value.
+ *
+ * An object defining the message input to be sent to the assistant if the user selects the corresponding
+ * disambiguation option.
+ *
+ * @return the value
+ */
+ public DialogSuggestionValue getValue() {
+ return value;
+ }
+
+ /**
+ * Gets the output.
+ *
+ * The dialog output that will be returned from the Watson Assistant service if the user selects the corresponding
+ * option.
+ *
+ * @return the output
+ */
+ public Map getOutput() {
+ return output;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogSuggestionValue.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogSuggestionValue.java
new file mode 100644
index 00000000000..a6d1d16dc72
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/DialogSuggestionValue.java
@@ -0,0 +1,35 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * An object defining the message input to be sent to the assistant if the user selects the corresponding disambiguation
+ * option.
+ */
+public class DialogSuggestionValue extends GenericModel {
+
+ private MessageInput input;
+
+ /**
+ * Gets the input.
+ *
+ * The user input.
+ *
+ * @return the input
+ */
+ public MessageInput getInput() {
+ return input;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContext.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContext.java
new file mode 100644
index 00000000000..e8499a426da
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContext.java
@@ -0,0 +1,64 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * State information for the conversation.
+ */
+public class MessageContext extends GenericModel {
+
+ private MessageContextGlobal global;
+ private MessageContextSkills skills;
+
+ /**
+ * Gets the global.
+ *
+ * Contains information that can be shared by all skills within the Assistant.
+ *
+ * @return the global
+ */
+ public MessageContextGlobal getGlobal() {
+ return global;
+ }
+
+ /**
+ * Gets the skills.
+ *
+ * Contains information specific to particular skills within the Assistant.
+ *
+ * @return the skills
+ */
+ public MessageContextSkills getSkills() {
+ return skills;
+ }
+
+ /**
+ * Sets the global.
+ *
+ * @param global the new global
+ */
+ public void setGlobal(final MessageContextGlobal global) {
+ this.global = global;
+ }
+
+ /**
+ * Sets the skills.
+ *
+ * @param skills the new skills
+ */
+ public void setSkills(final MessageContextSkills skills) {
+ this.skills = skills;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextGlobal.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextGlobal.java
new file mode 100644
index 00000000000..82eb75815b3
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextGlobal.java
@@ -0,0 +1,43 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * Contains information that can be shared by all skills within the Assistant.
+ */
+public class MessageContextGlobal extends GenericModel {
+
+ private MessageContextGlobalSystem system;
+
+ /**
+ * Gets the system.
+ *
+ * Properties interpreted by the Assistant that are shared across all skills within the Assistant.
+ *
+ * @return the system
+ */
+ public MessageContextGlobalSystem getSystem() {
+ return system;
+ }
+
+ /**
+ * Sets the system.
+ *
+ * @param system the new system
+ */
+ public void setSystem(final MessageContextGlobalSystem system) {
+ this.system = system;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextGlobalSystem.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextGlobalSystem.java
new file mode 100644
index 00000000000..ab02ea249e9
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextGlobalSystem.java
@@ -0,0 +1,92 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * Properties that are shared by all skills used by the assistant.
+ */
+public class MessageContextGlobalSystem extends GenericModel {
+
+ private String timezone;
+ @SerializedName("user_id")
+ private String userId;
+ @SerializedName("turn_count")
+ private Long turnCount;
+
+ /**
+ * Gets the timezone.
+ *
+ * The user time zone. The assistant uses the time zone to correctly resolve relative time references.
+ *
+ * @return the timezone
+ */
+ public String getTimezone() {
+ return timezone;
+ }
+
+ /**
+ * Gets the userId.
+ *
+ * String value provided by the API client that should be unique per each distinct end user of the service powered by
+ * Assistant.
+ *
+ * @return the userId
+ */
+ public String getUserId() {
+ return userId;
+ }
+
+ /**
+ * Gets the turnCount.
+ *
+ * This property is normally set by the Assistant which sets this to 1 during the first conversation turn and then
+ * increments it by 1 with every subsequent turn. A turn count equal to 0 (or > 0) informs the Assistant that this is
+ * (or is not) the first turn in a conversation which influences the behavior of some skills. The Conversation skill
+ * uses this to evaluate its `welcome` and `conversation_start` conditions.
+ *
+ * @return the turnCount
+ */
+ public Long getTurnCount() {
+ return turnCount;
+ }
+
+ /**
+ * Sets the timezone.
+ *
+ * @param timezone the new timezone
+ */
+ public void setTimezone(final String timezone) {
+ this.timezone = timezone;
+ }
+
+ /**
+ * Sets the userId.
+ *
+ * @param userId the new userId
+ */
+ public void setUserId(final String userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Sets the turnCount.
+ *
+ * @param turnCount the new turnCount
+ */
+ public void setTurnCount(final long turnCount) {
+ this.turnCount = turnCount;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextSkills.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextSkills.java
new file mode 100644
index 00000000000..cc61c3e3d82
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageContextSkills.java
@@ -0,0 +1,22 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.DynamicModel;
+
+/**
+ * Contains information specific to particular skills within the Assistant.
+ */
+public class MessageContextSkills extends DynamicModel {
+
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageInput.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageInput.java
new file mode 100644
index 00000000000..0d9a4c3515a
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageInput.java
@@ -0,0 +1,264 @@
+/*
+ * 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.assistant.v2.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+import com.ibm.watson.developer_cloud.util.Validator;
+
+/**
+ * The user input.
+ */
+public class MessageInput extends GenericModel {
+
+ /**
+ * The type of user input. Currently, only text input is supported.
+ */
+ public interface MessageType {
+ /** text. */
+ String TEXT = "text";
+ }
+
+ @SerializedName("message_type")
+ private String messageType;
+ private String text;
+ private MessageInputOptions options;
+ private List intents;
+ private List entities;
+ @SerializedName("suggestion_id")
+ private String suggestionId;
+
+ /**
+ * Builder.
+ */
+ public static class Builder {
+ private String messageType;
+ private String text;
+ private MessageInputOptions options;
+ private List intents;
+ private List entities;
+ private String suggestionId;
+
+ private Builder(MessageInput messageInput) {
+ messageType = messageInput.messageType;
+ text = messageInput.text;
+ options = messageInput.options;
+ intents = messageInput.intents;
+ entities = messageInput.entities;
+ suggestionId = messageInput.suggestionId;
+ }
+
+ /**
+ * Instantiates a new builder.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Builds a MessageInput.
+ *
+ * @return the messageInput
+ */
+ public MessageInput build() {
+ return new MessageInput(this);
+ }
+
+ /**
+ * Adds an intent to intents.
+ *
+ * @param intent the new intent
+ * @return the MessageInput builder
+ */
+ public Builder addIntent(RuntimeIntent intent) {
+ Validator.notNull(intent, "intent cannot be null");
+ if (this.intents == null) {
+ this.intents = new ArrayList();
+ }
+ this.intents.add(intent);
+ return this;
+ }
+
+ /**
+ * Adds an entity to entities.
+ *
+ * @param entity the new entity
+ * @return the MessageInput builder
+ */
+ public Builder addEntity(RuntimeEntity entity) {
+ Validator.notNull(entity, "entity cannot be null");
+ if (this.entities == null) {
+ this.entities = new ArrayList();
+ }
+ this.entities.add(entity);
+ return this;
+ }
+
+ /**
+ * Set the messageType.
+ *
+ * @param messageType the messageType
+ * @return the MessageInput builder
+ */
+ public Builder messageType(String messageType) {
+ this.messageType = messageType;
+ return this;
+ }
+
+ /**
+ * Set the text.
+ *
+ * @param text the text
+ * @return the MessageInput builder
+ */
+ public Builder text(String text) {
+ this.text = text;
+ return this;
+ }
+
+ /**
+ * Set the options.
+ *
+ * @param options the options
+ * @return the MessageInput builder
+ */
+ public Builder options(MessageInputOptions options) {
+ this.options = options;
+ return this;
+ }
+
+ /**
+ * Set the intents.
+ * Existing intents will be replaced.
+ *
+ * @param intents the intents
+ * @return the MessageInput builder
+ */
+ public Builder intents(List intents) {
+ this.intents = intents;
+ return this;
+ }
+
+ /**
+ * Set the entities.
+ * Existing entities will be replaced.
+ *
+ * @param entities the entities
+ * @return the MessageInput builder
+ */
+ public Builder entities(List entities) {
+ this.entities = entities;
+ return this;
+ }
+
+ /**
+ * Set the suggestionId.
+ *
+ * @param suggestionId the suggestionId
+ * @return the MessageInput builder
+ */
+ public Builder suggestionId(String suggestionId) {
+ this.suggestionId = suggestionId;
+ return this;
+ }
+ }
+
+ private MessageInput(Builder builder) {
+ messageType = builder.messageType;
+ text = builder.text;
+ options = builder.options;
+ intents = builder.intents;
+ entities = builder.entities;
+ suggestionId = builder.suggestionId;
+ }
+
+ /**
+ * New builder.
+ *
+ * @return a MessageInput builder
+ */
+ public Builder newBuilder() {
+ return new Builder(this);
+ }
+
+ /**
+ * Gets the messageType.
+ *
+ * The type of user input. Currently, only text input is supported.
+ *
+ * @return the messageType
+ */
+ public String messageType() {
+ return messageType;
+ }
+
+ /**
+ * Gets the text.
+ *
+ * The text of the user input. This string cannot contain carriage return, newline, or tab characters, and it must be
+ * no longer than 2048 characters.
+ *
+ * @return the text
+ */
+ public String text() {
+ return text;
+ }
+
+ /**
+ * Gets the options.
+ *
+ * Properties that control how the assistant responds.
+ *
+ * @return the options
+ */
+ public MessageInputOptions options() {
+ return options;
+ }
+
+ /**
+ * Gets the intents.
+ *
+ * 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
+ */
+ public List intents() {
+ return intents;
+ }
+
+ /**
+ * Gets the entities.
+ *
+ * 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
+ */
+ public List entities() {
+ return entities;
+ }
+
+ /**
+ * Gets the suggestionId.
+ *
+ * For internal use only.
+ *
+ * @return the suggestionId
+ */
+ public String suggestionId() {
+ return suggestionId;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageInputOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageInputOptions.java
new file mode 100644
index 00000000000..b80aec993fa
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageInputOptions.java
@@ -0,0 +1,112 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * Optional properties that control how the assistant responds.
+ */
+public class MessageInputOptions extends GenericModel {
+
+ private Boolean debug;
+ private Boolean restart;
+ @SerializedName("alternate_intents")
+ private Boolean alternateIntents;
+ @SerializedName("return_context")
+ private Boolean returnContext;
+
+ /**
+ * Gets the debug.
+ *
+ * Whether to return additional diagnostic information. Set to `true` to return additional information under the
+ * `output.debug` key.
+ *
+ * @return the debug
+ */
+ public Boolean isDebug() {
+ return debug;
+ }
+
+ /**
+ * Gets the restart.
+ *
+ * Whether to start a new conversation with this user input. Specify `true` to clear the state information stored by
+ * the session.
+ *
+ * @return the restart
+ */
+ public Boolean isRestart() {
+ return restart;
+ }
+
+ /**
+ * Gets the alternateIntents.
+ *
+ * Whether to return more than one intent. Set to `true` to return all matching intents.
+ *
+ * @return the alternateIntents
+ */
+ public Boolean isAlternateIntents() {
+ return alternateIntents;
+ }
+
+ /**
+ * Gets the returnContext.
+ *
+ * Whether to return session context with the response. If you specify `true`, the response will include the `context`
+ * property.
+ *
+ * @return the returnContext
+ */
+ public Boolean isReturnContext() {
+ return returnContext;
+ }
+
+ /**
+ * Sets the debug.
+ *
+ * @param debug the new debug
+ */
+ public void setDebug(final Boolean debug) {
+ this.debug = debug;
+ }
+
+ /**
+ * Sets the restart.
+ *
+ * @param restart the new restart
+ */
+ public void setRestart(final Boolean restart) {
+ this.restart = restart;
+ }
+
+ /**
+ * Sets the alternateIntents.
+ *
+ * @param alternateIntents the new alternateIntents
+ */
+ public void setAlternateIntents(final Boolean alternateIntents) {
+ this.alternateIntents = alternateIntents;
+ }
+
+ /**
+ * Sets the returnContext.
+ *
+ * @param returnContext the new returnContext
+ */
+ public void setReturnContext(final Boolean returnContext) {
+ this.returnContext = returnContext;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOptions.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOptions.java
new file mode 100644
index 00000000000..a594cb2d7f3
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOptions.java
@@ -0,0 +1,180 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+import com.ibm.watson.developer_cloud.util.Validator;
+
+/**
+ * The message options.
+ */
+public class MessageOptions extends GenericModel {
+
+ private String assistantId;
+ private String sessionId;
+ private MessageInput input;
+ private MessageContext context;
+
+ /**
+ * Builder.
+ */
+ public static class Builder {
+ private String assistantId;
+ private String sessionId;
+ private MessageInput input;
+ private MessageContext context;
+
+ private Builder(MessageOptions messageOptions) {
+ assistantId = messageOptions.assistantId;
+ sessionId = messageOptions.sessionId;
+ input = messageOptions.input;
+ context = messageOptions.context;
+ }
+
+ /**
+ * Instantiates a new builder.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Instantiates a new builder with required properties.
+ *
+ * @param assistantId the assistantId
+ * @param sessionId the sessionId
+ */
+ public Builder(String assistantId, String sessionId) {
+ this.assistantId = assistantId;
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * Builds a MessageOptions.
+ *
+ * @return the messageOptions
+ */
+ public MessageOptions build() {
+ return new MessageOptions(this);
+ }
+
+ /**
+ * Set the assistantId.
+ *
+ * @param assistantId the assistantId
+ * @return the MessageOptions builder
+ */
+ public Builder assistantId(String assistantId) {
+ this.assistantId = assistantId;
+ return this;
+ }
+
+ /**
+ * Set the sessionId.
+ *
+ * @param sessionId the sessionId
+ * @return the MessageOptions builder
+ */
+ public Builder sessionId(String sessionId) {
+ this.sessionId = sessionId;
+ return this;
+ }
+
+ /**
+ * Set the input.
+ *
+ * @param input the input
+ * @return the MessageOptions builder
+ */
+ public Builder input(MessageInput input) {
+ this.input = input;
+ return this;
+ }
+
+ /**
+ * Set the context.
+ *
+ * @param context the context
+ * @return the MessageOptions builder
+ */
+ public Builder context(MessageContext context) {
+ this.context = context;
+ return this;
+ }
+ }
+
+ private MessageOptions(Builder builder) {
+ Validator.notEmpty(builder.assistantId, "assistantId cannot be empty");
+ Validator.notEmpty(builder.sessionId, "sessionId cannot be empty");
+ assistantId = builder.assistantId;
+ sessionId = builder.sessionId;
+ input = builder.input;
+ context = builder.context;
+ }
+
+ /**
+ * New builder.
+ *
+ * @return a MessageOptions builder
+ */
+ public Builder newBuilder() {
+ return new Builder(this);
+ }
+
+ /**
+ * Gets the assistantId.
+ *
+ * Unique identifier of the assistant. You can find the assistant ID of an assistant on the **Assistants** tab of the
+ * Watson Assistant tool. For information about creating assistants, see the
+ * [documentation](https://console.bluemix.net/docs/services/assistant/create-assistant.html#creating-assistants).
+ *
+ * **Note:** Currently, the v2 API does not support creating assistants.
+ *
+ * @return the assistantId
+ */
+ public String assistantId() {
+ return assistantId;
+ }
+
+ /**
+ * Gets the sessionId.
+ *
+ * Unique identifier of the session.
+ *
+ * @return the sessionId
+ */
+ public String sessionId() {
+ return sessionId;
+ }
+
+ /**
+ * Gets the input.
+ *
+ * An input object that includes the input text.
+ *
+ * @return the input
+ */
+ public MessageInput input() {
+ return input;
+ }
+
+ /**
+ * Gets the context.
+ *
+ * State information for the conversation.
+ *
+ * @return the context
+ */
+ public MessageContext context() {
+ return context;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOutput.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOutput.java
new file mode 100644
index 00000000000..1576a8c05d1
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOutput.java
@@ -0,0 +1,85 @@
+/*
+ * 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.assistant.v2.model;
+
+import java.util.List;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * Assistant output to be rendered or processed by the client.
+ */
+public class MessageOutput extends GenericModel {
+
+ private List generic;
+ private List intents;
+ private List entities;
+ private List actions;
+ private MessageOutputDebug debug;
+
+ /**
+ * Gets the generic.
+ *
+ * Output intended for any channel. It is the responsibility of the client application to implement the supported
+ * response types.
+ *
+ * @return the generic
+ */
+ public List getGeneric() {
+ return generic;
+ }
+
+ /**
+ * Gets the intents.
+ *
+ * An array of intents recognized in the user input, sorted in descending order of confidence.
+ *
+ * @return the intents
+ */
+ public List getIntents() {
+ return intents;
+ }
+
+ /**
+ * Gets the entities.
+ *
+ * An array of entities identified in the user input.
+ *
+ * @return the entities
+ */
+ public List getEntities() {
+ return entities;
+ }
+
+ /**
+ * Gets the actions.
+ *
+ * An array of objects describing any actions requested by the dialog node.
+ *
+ * @return the actions
+ */
+ public List getActions() {
+ return actions;
+ }
+
+ /**
+ * Gets the debug.
+ *
+ * Additional detailed information about a message response and how it was generated.
+ *
+ * @return the debug
+ */
+ public MessageOutputDebug getDebug() {
+ return debug;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOutputDebug.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOutputDebug.java
new file mode 100644
index 00000000000..61297236f6f
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageOutputDebug.java
@@ -0,0 +1,90 @@
+/*
+ * 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.assistant.v2.model;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * Additional detailed information about a message response and how it was generated.
+ */
+public class MessageOutputDebug extends GenericModel {
+
+ /**
+ * When `branch_exited` is set to `true` by the Assistant, the `branch_exited_reason` specifies whether the dialog
+ * completed by itself or got interrupted.
+ */
+ public interface BranchExitedReason {
+ /** completed. */
+ String COMPLETED = "completed";
+ /** fallback. */
+ String FALLBACK = "fallback";
+ }
+
+ @SerializedName("nodes_visited")
+ private List nodesVisited;
+ @SerializedName("log_messages")
+ private List logMessages;
+ @SerializedName("branch_exited")
+ private Boolean branchExited;
+ @SerializedName("branch_exited_reason")
+ private String branchExitedReason;
+
+ /**
+ * Gets the nodesVisited.
+ *
+ * An array of objects containing detailed diagnostic information about the nodes that were triggered during
+ * processing of the input message.
+ *
+ * @return the nodesVisited
+ */
+ public List getNodesVisited() {
+ return nodesVisited;
+ }
+
+ /**
+ * Gets the logMessages.
+ *
+ * An array of up to 50 messages logged with the request.
+ *
+ * @return the logMessages
+ */
+ public List getLogMessages() {
+ return logMessages;
+ }
+
+ /**
+ * Gets the branchExited.
+ *
+ * Assistant sets this to true when this message response concludes or interrupts a dialog.
+ *
+ * @return the branchExited
+ */
+ public Boolean isBranchExited() {
+ return branchExited;
+ }
+
+ /**
+ * Gets the branchExitedReason.
+ *
+ * When `branch_exited` is set to `true` by the Assistant, the `branch_exited_reason` specifies whether the dialog
+ * completed by itself or got interrupted.
+ *
+ * @return the branchExitedReason
+ */
+ public String getBranchExitedReason() {
+ return branchExitedReason;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageResponse.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageResponse.java
new file mode 100644
index 00000000000..0df146e72bd
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/MessageResponse.java
@@ -0,0 +1,47 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * A response from the Watson Assistant service.
+ */
+public class MessageResponse extends GenericModel {
+
+ private MessageOutput output;
+ private MessageContext context;
+
+ /**
+ * Gets the output.
+ *
+ * Assistant output to be rendered or processed by the client.
+ *
+ * @return the output
+ */
+ public MessageOutput getOutput() {
+ return output;
+ }
+
+ /**
+ * Gets the context.
+ *
+ * The current session context. Included in the response if the `return_context` property of the message input was set
+ * to `true`.
+ *
+ * @return the context
+ */
+ public MessageContext getContext() {
+ return context;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/RuntimeEntity.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/RuntimeEntity.java
new file mode 100644
index 00000000000..0cb6d9358e3
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/RuntimeEntity.java
@@ -0,0 +1,152 @@
+/*
+ * 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.assistant.v2.model;
+
+import java.util.List;
+import java.util.Map;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * A term from the request that was identified as an entity.
+ */
+public class RuntimeEntity extends GenericModel {
+
+ private String entity;
+ private List location;
+ private String value;
+ private Double confidence;
+ private Map metadata;
+ private List groups;
+
+ /**
+ * Gets the entity.
+ *
+ * An entity detected in the input.
+ *
+ * @return the entity
+ */
+ public String getEntity() {
+ return entity;
+ }
+
+ /**
+ * Gets the location.
+ *
+ * An array of zero-based character offsets that indicate where the detected entity values begin and end in the input
+ * text.
+ *
+ * @return the location
+ */
+ public List getLocation() {
+ return location;
+ }
+
+ /**
+ * Gets the value.
+ *
+ * The term in the input text that was recognized as an entity value.
+ *
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Gets the confidence.
+ *
+ * A decimal percentage that represents Watson's confidence in the entity.
+ *
+ * @return the confidence
+ */
+ public Double getConfidence() {
+ return confidence;
+ }
+
+ /**
+ * Gets the metadata.
+ *
+ * Any metadata for the entity.
+ *
+ * @return the metadata
+ */
+ public Map getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Gets the groups.
+ *
+ * The recognized capture groups for the entity, as defined by the entity pattern.
+ *
+ * @return the groups
+ */
+ public List getGroups() {
+ return groups;
+ }
+
+ /**
+ * Sets the entity.
+ *
+ * @param entity the new entity
+ */
+ public void setEntity(final String entity) {
+ this.entity = entity;
+ }
+
+ /**
+ * Sets the location.
+ *
+ * @param location the new location
+ */
+ public void setLocation(final List location) {
+ this.location = location;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param value the new value
+ */
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+ /**
+ * Sets the confidence.
+ *
+ * @param confidence the new confidence
+ */
+ public void setConfidence(final Double confidence) {
+ this.confidence = confidence;
+ }
+
+ /**
+ * Sets the metadata.
+ *
+ * @param metadata the new metadata
+ */
+ public void setMetadata(final Map metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Sets the groups.
+ *
+ * @param groups the new groups
+ */
+ public void setGroups(final List groups) {
+ this.groups = groups;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/RuntimeIntent.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/RuntimeIntent.java
new file mode 100644
index 00000000000..a039e3dff77
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/RuntimeIntent.java
@@ -0,0 +1,64 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * An intent identified in the user input.
+ */
+public class RuntimeIntent extends GenericModel {
+
+ private String intent;
+ private Double confidence;
+
+ /**
+ * Gets the intent.
+ *
+ * The name of the recognized intent.
+ *
+ * @return the intent
+ */
+ public String getIntent() {
+ return intent;
+ }
+
+ /**
+ * Gets the confidence.
+ *
+ * A decimal percentage that represents Watson's confidence in the intent.
+ *
+ * @return the confidence
+ */
+ public Double getConfidence() {
+ return confidence;
+ }
+
+ /**
+ * Sets the intent.
+ *
+ * @param intent the new intent
+ */
+ public void setIntent(final String intent) {
+ this.intent = intent;
+ }
+
+ /**
+ * Sets the confidence.
+ *
+ * @param confidence the new confidence
+ */
+ public void setConfidence(final Double confidence) {
+ this.confidence = confidence;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/SessionResponse.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/SessionResponse.java
new file mode 100644
index 00000000000..dc43a49c616
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/model/SessionResponse.java
@@ -0,0 +1,36 @@
+/*
+ * 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.assistant.v2.model;
+
+import com.google.gson.annotations.SerializedName;
+import com.ibm.watson.developer_cloud.service.model.GenericModel;
+
+/**
+ * SessionResponse.
+ */
+public class SessionResponse extends GenericModel {
+
+ @SerializedName("session_id")
+ private String sessionId;
+
+ /**
+ * Gets the sessionId.
+ *
+ * The session ID.
+ *
+ * @return the sessionId
+ */
+ public String getSessionId() {
+ return sessionId;
+ }
+}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/package-info.java b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/package-info.java
new file mode 100644
index 00000000000..2d4cefead82
--- /dev/null
+++ b/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v2/package-info.java
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+/**
+ * Watson Assistant v2.
+ */
+package com.ibm.watson.developer_cloud.assistant.v2;
diff --git a/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantServiceIT.java b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantServiceIT.java
index 9a1ecb0649b..660f4a21d7b 100644
--- a/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantServiceIT.java
+++ b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v1/AssistantServiceIT.java
@@ -54,7 +54,6 @@
import com.ibm.watson.developer_cloud.assistant.v1.model.ListWorkspacesOptions;
import com.ibm.watson.developer_cloud.assistant.v1.model.LogCollection;
import com.ibm.watson.developer_cloud.assistant.v1.model.LogExport;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Mentions;
import com.ibm.watson.developer_cloud.assistant.v1.model.MessageOptions;
import com.ibm.watson.developer_cloud.assistant.v1.model.MessageResponse;
import com.ibm.watson.developer_cloud.assistant.v1.model.OutputData;
@@ -83,7 +82,6 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -517,13 +515,7 @@ public void testCreateExample() {
createExampleIntent();
String exampleText = "Howdy " + UUID.randomUUID().toString(); // gotta be unique
- Mentions mentions = new Mentions();
- mentions.setEntity("entity");
- mentions.setLocation(Arrays.asList(0L, 10L));
- List mentionsList = new ArrayList<>();
- mentionsList.add(mentions);
CreateExampleOptions createOptions = new CreateExampleOptions.Builder(workspaceId, exampleIntent, exampleText)
- .mentions(mentionsList)
.build();
Example response = service.createExample(createOptions).execute();
@@ -531,7 +523,6 @@ public void testCreateExample() {
assertNotNull(response);
assertNotNull(response.getExampleText());
assertEquals(response.getExampleText(), exampleText);
- assertEquals(response.getMentions(), mentionsList);
} catch (Exception ex) {
fail(ex.getMessage());
} finally {
@@ -746,20 +737,13 @@ public void testUpdateExample() {
service.createExample(createOptions).execute();
try {
- Mentions mentions = new Mentions();
- mentions.setEntity("entity");
- mentions.setLocation(Arrays.asList(0L, 10L));
- List mentionsList = new ArrayList<>();
- mentionsList.add(mentions);
UpdateExampleOptions updateOptions = new UpdateExampleOptions.Builder(workspaceId, exampleIntent, exampleText)
.newText(exampleText2)
- .newMentions(mentionsList)
.build();
Example response = service.updateExample(updateOptions).execute();
assertNotNull(response);
assertNotNull(response.getExampleText());
assertEquals(response.getExampleText(), exampleText2);
- assertEquals(response.getMentions(), mentionsList);
} catch (Exception ex) {
fail(ex.getMessage());
} finally {
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 a05b8319e48..278d99cf017 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
@@ -180,12 +180,6 @@ public void testSendMessage() throws IOException, InterruptedException {
assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getTitle());
assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions());
assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions());
- assertNotNull(serviceResponse.getOutput().getActions());
- assertNotNull(serviceResponse.getOutput().getActions().get(0).getName());
- assertNotNull(serviceResponse.getOutput().getActions().get(0).getCredentials());
- assertNotNull(serviceResponse.getOutput().getActions().get(0).getActionType());
- assertNotNull(serviceResponse.getOutput().getActions().get(0).getParameters());
- assertNotNull(serviceResponse.getOutput().getActions().get(0).getResultVariable());
assertEquals(serviceResponse, mockResponse);
}
diff --git a/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantServiceIT.java b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantServiceIT.java
new file mode 100644
index 00000000000..daf92c983f5
--- /dev/null
+++ b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantServiceIT.java
@@ -0,0 +1,111 @@
+/*
+ * 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.assistant.v2;
+
+import com.ibm.watson.developer_cloud.assistant.v2.model.CreateSessionOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.DeleteSessionOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.DialogRuntimeResponseGeneric;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageContext;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageInput;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageInputOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageResponse;
+import com.ibm.watson.developer_cloud.assistant.v2.model.SessionResponse;
+import com.ibm.watson.developer_cloud.util.RetryRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Integration tests for Assistant v2.
+ */
+@RunWith(RetryRunner.class)
+public class AssistantServiceIT extends AssistantServiceTest {
+ private Assistant service;
+ private String assistantId;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ this.service = getService();
+ this.assistantId = getAssistantId();
+ }
+
+ @Test
+ public void testSendMessages() {
+ // get session ID
+ CreateSessionOptions createSessionOptions = new CreateSessionOptions.Builder()
+ .assistantId(assistantId)
+ .build();
+ SessionResponse sessionResponse = service.createSession(createSessionOptions).execute();
+ String sessionId = sessionResponse.getSessionId();
+
+ final List messages = Arrays.asList(
+ "I want some pizza.",
+ "I'd like 3 pizzas.",
+ "Large"
+ );
+ MessageContext context = new MessageContext();
+
+ try {
+ // send messages
+ for (String message : messages) {
+ MessageInputOptions inputOptions = new MessageInputOptions();
+ inputOptions.setDebug(true);
+ MessageInput input = new MessageInput.Builder()
+ .text(message)
+ .messageType(MessageInput.MessageType.TEXT)
+ .options(inputOptions)
+ .build();
+ MessageOptions messageOptions = new MessageOptions.Builder()
+ .assistantId(assistantId)
+ .sessionId(sessionId)
+ .input(input)
+ .context(context)
+ .build();
+ MessageResponse messageResponse = service.message(messageOptions).execute();
+
+ // message assertions
+ List genericResponses = messageResponse.getOutput().getGeneric();
+ assertNotNull(genericResponses);
+ boolean foundTextResponse = false;
+ for (DialogRuntimeResponseGeneric generic : genericResponses) {
+ if (generic.getResponseType().equals(DialogRuntimeResponseGeneric.ResponseType.TEXT)) {
+ foundTextResponse = true;
+ break;
+ }
+ }
+ assertTrue(foundTextResponse);
+ assertNotNull(messageResponse.getOutput().getEntities());
+ assertNotNull(messageResponse.getOutput().getIntents());
+ assertNotNull(messageResponse.getOutput().getDebug());
+
+ context = messageResponse.getContext();
+ }
+ } finally {
+ // delete session
+ DeleteSessionOptions deleteSessionOptions = new DeleteSessionOptions.Builder()
+ .assistantId(assistantId)
+ .sessionId(sessionId)
+ .build();
+ service.deleteSession(deleteSessionOptions).execute();
+ }
+ }
+}
diff --git a/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantServiceTest.java b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantServiceTest.java
new file mode 100644
index 00000000000..da4b440b650
--- /dev/null
+++ b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantServiceTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.assistant.v2;
+
+import com.ibm.watson.developer_cloud.WatsonServiceTest;
+import org.junit.Assume;
+import org.junit.Before;
+
+import java.util.Date;
+
+public class AssistantServiceTest extends WatsonServiceTest {
+
+ private Assistant service;
+ private String assistantId;
+
+ public Assistant getService() {
+ return this.service;
+ }
+
+ public String getAssistantId() {
+ return this.assistantId;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp()
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ String username = getProperty("assistant.v2.username");
+ String password = getProperty("assistant.v2.password");
+ assistantId = getProperty("assistant.v2.assistant_id");
+
+ Assume.assumeFalse("config.properties doesn't have valid credentials.",
+ (username == null) || username.equals(PLACEHOLDER));
+
+ service = new Assistant("2018-07-10");
+ service.setEndPoint(getProperty("assistant.v2.url"));
+ service.setUsernameAndPassword(username, password);
+ service.setDefaultHeaders(getDefaultHeaders());
+ }
+
+ private long tolerance = 2000; // 2 secs in ms
+
+ /**
+ * return `true` if ldate before rdate within tolerance.
+ */
+ public boolean fuzzyBefore(Date ldate, Date rdate) {
+ return (ldate.getTime() - rdate.getTime()) < tolerance;
+ }
+
+ /**
+ * return `true` if ldate after rdate within tolerance.
+ */
+ public boolean fuzzyAfter(Date ldate, Date rdate) {
+ return (rdate.getTime() - ldate.getTime()) < tolerance;
+ }
+
+}
diff --git a/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantTest.java b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantTest.java
new file mode 100644
index 00000000000..04735c76b9f
--- /dev/null
+++ b/assistant/src/test/java/com/ibm/watson/developer_cloud/assistant/v2/AssistantTest.java
@@ -0,0 +1,376 @@
+/*
+ * 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.assistant.v2;
+
+import com.ibm.watson.developer_cloud.WatsonServiceUnitTest;
+import com.ibm.watson.developer_cloud.assistant.v2.model.CaptureGroup;
+import com.ibm.watson.developer_cloud.assistant.v2.model.CreateSessionOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.DeleteSessionOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.DialogLogMessage;
+import com.ibm.watson.developer_cloud.assistant.v2.model.DialogNodeAction;
+import com.ibm.watson.developer_cloud.assistant.v2.model.DialogRuntimeResponseGeneric;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageContext;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageContextGlobal;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageContextGlobalSystem;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageContextSkills;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageInput;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageInputOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageOptions;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageOutputDebug;
+import com.ibm.watson.developer_cloud.assistant.v2.model.MessageResponse;
+import com.ibm.watson.developer_cloud.assistant.v2.model.RuntimeEntity;
+import com.ibm.watson.developer_cloud.assistant.v2.model.RuntimeIntent;
+import com.ibm.watson.developer_cloud.assistant.v2.model.SessionResponse;
+import okhttp3.mockwebserver.MockResponse;
+import okhttp3.mockwebserver.RecordedRequest;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit tests for Assistant v2.
+ */
+public class AssistantTest extends WatsonServiceUnitTest {
+ private static final String ASSISTANT_ID = "assistant_id";
+ private static final String SESSION_ID = "session_id";
+ private static final String TIMEZONE = "timezone";
+ private static final Long TURN_COUNT = 10L;
+ private static final String USER_ID = "user_id";
+ private static final String GROUP = "group";
+ private static final List LOCATION = Arrays.asList(1L, 2L);
+ private static final Double CONFIDENCE = 0.0;
+ private static final String ENTITY = "entity";
+ private static final Map MAP = new HashMap<>();
+ private static final String VALUE = "value";
+ private static final String INTENT = "intent";
+ private static final String TEXT = "text";
+ private static final String SUGGESTION_ID = "suggestion_id";
+ private static final String MESSAGE = "message";
+ private static final String CONDITIONS = "conditions";
+ private static final String TITLE = "title";
+ private static final String DIALOG_NODE = "dialog_node";
+ private static final String NAME = "name";
+ private static final String RESULT_VARIABLE = "result_variable";
+ private static final String CREDENTIALS = "credentials";
+ private static final String DESCRIPTION = "description";
+ private static final Long TIME = 1234L;
+ private static final String SOURCE = "source";
+ private static final String TOPIC = "topic";
+ private static final String LABEL = "label";
+
+ private static final String VERSION = "2018-09-20";
+ private static final String RESOURCE = "src/test/resources/assistant/";
+ private static final String MESSAGE_PATH = String.format(
+ "/v2/assistants/%s/sessions/%s/message?version=%s",
+ ASSISTANT_ID,
+ SESSION_ID,
+ VERSION
+ );
+ private static final String CREATE_SESSION_PATH = String.format(
+ "/v2/assistants/%s/sessions?version=%s",
+ ASSISTANT_ID,
+ VERSION
+ );
+ private static final String DELETE_SESSION_PATH = String.format(
+ "/v2/assistants/%s/sessions/%s?version=%s",
+ ASSISTANT_ID,
+ SESSION_ID,
+ VERSION
+ );
+
+ private MessageResponse messageResponse;
+ private SessionResponse sessionResponse;
+
+ private Assistant service;
+
+ /*
+ * (non-Javadoc)
+ * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp()
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ MAP.put("key", "value");
+
+ messageResponse = loadFixture(RESOURCE + "message_response.json", MessageResponse.class);
+ sessionResponse = loadFixture(RESOURCE + "session_response.json", SessionResponse.class);
+
+ service = new Assistant(VERSION);
+ service.setUsernameAndPassword("", "");
+ service.setEndPoint(getMockWebServerUrl());
+ }
+
+ @Test
+ public void testCaptureGroup() {
+ CaptureGroup captureGroup = new CaptureGroup();
+ captureGroup.setGroup(GROUP);
+ captureGroup.setLocation(LOCATION);
+
+ assertEquals(GROUP, captureGroup.getGroup());
+ assertEquals(LOCATION, captureGroup.getLocation());
+ }
+
+ @Test
+ public void testCreateSessionOptions() {
+ CreateSessionOptions createSessionOptions = new CreateSessionOptions.Builder()
+ .assistantId(ASSISTANT_ID)
+ .build();
+ createSessionOptions = createSessionOptions.newBuilder().build();
+
+ assertEquals(ASSISTANT_ID, createSessionOptions.assistantId());
+ }
+
+ @Test
+ public void testDeleteSessionOptions() {
+ DeleteSessionOptions deleteSessionOptions = new DeleteSessionOptions.Builder()
+ .assistantId(ASSISTANT_ID)
+ .sessionId(SESSION_ID)
+ .build();
+ deleteSessionOptions = deleteSessionOptions.newBuilder().build();
+
+ assertEquals(ASSISTANT_ID, deleteSessionOptions.assistantId());
+ assertEquals(SESSION_ID, deleteSessionOptions.sessionId());
+ }
+
+ @Test
+ public void testMessageContextGlobalSystem() {
+ MessageContextGlobalSystem messageContextGlobalSystem = new MessageContextGlobalSystem();
+ messageContextGlobalSystem.setTimezone(TIMEZONE);
+ messageContextGlobalSystem.setTurnCount(TURN_COUNT);
+ messageContextGlobalSystem.setUserId(USER_ID);
+
+ assertEquals(TIMEZONE, messageContextGlobalSystem.getTimezone());
+ assertEquals(TURN_COUNT, messageContextGlobalSystem.getTurnCount());
+ assertEquals(USER_ID, messageContextGlobalSystem.getUserId());
+ }
+
+ @Test
+ public void testMessageContextGlobal() {
+ MessageContextGlobalSystem messageContextGlobalSystem = new MessageContextGlobalSystem();
+
+ MessageContextGlobal messageContextGlobal = new MessageContextGlobal();
+ messageContextGlobal.setSystem(messageContextGlobalSystem);
+
+ assertEquals(messageContextGlobalSystem, messageContextGlobal.getSystem());
+ }
+
+ @Test
+ public void testMessageContext() {
+ MessageContextGlobal messageContextGlobal = new MessageContextGlobal();
+ MessageContextSkills messageContextSkills = new MessageContextSkills();
+
+ MessageContext messageContext = new MessageContext();
+ messageContext.setGlobal(messageContextGlobal);
+ messageContext.setSkills(messageContextSkills);
+
+ assertEquals(messageContextGlobal, messageContext.getGlobal());
+ assertEquals(messageContextSkills, messageContext.getSkills());
+ }
+
+ @Test
+ public void testMessageInput() {
+ RuntimeEntity entity1 = new RuntimeEntity();
+ entity1.setEntity(ENTITY);
+ entity1.setLocation(LOCATION);
+ entity1.setValue(VALUE);
+ RuntimeEntity entity2 = new RuntimeEntity();
+ entity2.setEntity(ENTITY);
+ entity2.setLocation(LOCATION);
+ entity2.setValue(VALUE);
+ List entityList = new ArrayList<>();
+ entityList.add(entity1);
+ RuntimeIntent intent1 = new RuntimeIntent();
+ intent1.setConfidence(CONFIDENCE);
+ intent1.setIntent(INTENT);
+ RuntimeIntent intent2 = new RuntimeIntent();
+ intent2.setConfidence(CONFIDENCE);
+ intent2.setIntent(INTENT);
+ List intentList = new ArrayList<>();
+ intentList.add(intent1);
+ MessageInputOptions inputOptions = new MessageInputOptions();
+
+ MessageInput messageInput = new MessageInput.Builder()
+ .messageType(MessageInput.MessageType.TEXT)
+ .entities(entityList)
+ .addEntity(entity2)
+ .intents(intentList)
+ .addIntent(intent2)
+ .options(inputOptions)
+ .suggestionId(SUGGESTION_ID)
+ .text(TEXT)
+ .build();
+ messageInput = messageInput.newBuilder().build();
+
+ entityList.add(entity2);
+ intentList.add(intent2);
+ assertEquals(MessageInput.MessageType.TEXT, messageInput.messageType());
+ assertEquals(entityList, messageInput.entities());
+ assertEquals(intentList, messageInput.intents());
+ assertEquals(inputOptions, messageInput.options());
+ assertEquals(SUGGESTION_ID, messageInput.suggestionId());
+ assertEquals(TEXT, messageInput.text());
+ }
+
+ @Test
+ public void testMessageInputOptions() {
+ MessageInputOptions inputOptions = new MessageInputOptions();
+ inputOptions.setAlternateIntents(true);
+ inputOptions.setDebug(true);
+ inputOptions.setRestart(true);
+ inputOptions.setReturnContext(true);
+
+ assertTrue(inputOptions.isAlternateIntents());
+ assertTrue(inputOptions.isDebug());
+ assertTrue(inputOptions.isRestart());
+ assertTrue(inputOptions.isReturnContext());
+ }
+
+ @Test
+ public void testMessageOptions() {
+ MessageContext messageContext = new MessageContext();
+ MessageInput messageInput = new MessageInput.Builder().build();
+
+ MessageOptions messageOptions = new MessageOptions.Builder()
+ .assistantId(ASSISTANT_ID)
+ .context(messageContext)
+ .input(messageInput)
+ .sessionId(SESSION_ID)
+ .build();
+ messageOptions = messageOptions.newBuilder().build();
+
+ assertEquals(ASSISTANT_ID, messageOptions.assistantId());
+ assertEquals(messageContext, messageOptions.context());
+ assertEquals(messageInput, messageOptions.input());
+ assertEquals(SESSION_ID, messageOptions.sessionId());
+ }
+
+ @Test
+ public void testRuntimeEntity() {
+ CaptureGroup captureGroup = new CaptureGroup();
+ captureGroup.setGroup(GROUP);
+ List captureGroupList = Collections.singletonList(captureGroup);
+
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setConfidence(CONFIDENCE);
+ runtimeEntity.setEntity(ENTITY);
+ runtimeEntity.setGroups(captureGroupList);
+ runtimeEntity.setLocation(LOCATION);
+ runtimeEntity.setMetadata(MAP);
+ runtimeEntity.setValue(VALUE);
+
+ assertEquals(CONFIDENCE, runtimeEntity.getConfidence());
+ assertEquals(ENTITY, runtimeEntity.getEntity());
+ assertEquals(captureGroupList, runtimeEntity.getGroups());
+ assertEquals(LOCATION, runtimeEntity.getLocation());
+ assertEquals(MAP, runtimeEntity.getMetadata());
+ assertEquals(VALUE, runtimeEntity.getValue());
+ }
+
+ @Test
+ public void testRuntimeIntent() {
+ RuntimeIntent runtimeIntent = new RuntimeIntent();
+ runtimeIntent.setConfidence(CONFIDENCE);
+ runtimeIntent.setIntent(INTENT);
+
+ assertEquals(CONFIDENCE, runtimeIntent.getConfidence());
+ assertEquals(INTENT, runtimeIntent.getIntent());
+ }
+
+ @Test
+ public void testMessage() throws InterruptedException {
+ server.enqueue(jsonResponse(messageResponse));
+
+ MessageOptions messageOptions = new MessageOptions.Builder()
+ .assistantId(ASSISTANT_ID)
+ .sessionId(SESSION_ID)
+ .build();
+ MessageResponse response = service.message(messageOptions).execute();
+ RecordedRequest request = server.takeRequest();
+
+ assertEquals(MESSAGE_PATH, request.getPath());
+ assertNotNull(response.getContext());
+ assertNotNull(response.getOutput());
+
+ assertEquals(DialogNodeAction.ActionType.CLIENT, response.getOutput().getActions().get(0).getActionType());
+ assertEquals(NAME, response.getOutput().getActions().get(0).getName());
+ assertEquals(MAP, response.getOutput().getActions().get(0).getParameters());
+ assertEquals(RESULT_VARIABLE, response.getOutput().getActions().get(0).getResultVariable());
+ assertEquals(CREDENTIALS, response.getOutput().getActions().get(0).getCredentials());
+ assertEquals(MessageOutputDebug.BranchExitedReason.COMPLETED,
+ response.getOutput().getDebug().getBranchExitedReason());
+ assertEquals(DialogLogMessage.Level.INFO, response.getOutput().getDebug().getLogMessages().get(0).getLevel());
+ assertEquals(MESSAGE, response.getOutput().getDebug().getLogMessages().get(0).getMessage());
+ assertEquals(CONDITIONS, response.getOutput().getDebug().getNodesVisited().get(0).getConditions());
+ assertEquals(TITLE, response.getOutput().getDebug().getNodesVisited().get(0).getTitle());
+ assertEquals(DIALOG_NODE, response.getOutput().getDebug().getNodesVisited().get(0).getDialogNode());
+ assertTrue(response.getOutput().getDebug().isBranchExited());
+ assertEquals(DESCRIPTION, response.getOutput().getGeneric().get(0).getDescription());
+ assertEquals(DialogRuntimeResponseGeneric.ResponseType.TEXT,
+ response.getOutput().getGeneric().get(0).getResponseType());
+ assertEquals(DialogRuntimeResponseGeneric.Preference.BUTTON,
+ response.getOutput().getGeneric().get(0).getPreference());
+ assertEquals(TEXT, response.getOutput().getGeneric().get(0).getText());
+ assertEquals(TIME, response.getOutput().getGeneric().get(0).getTime());
+ assertTrue(response.getOutput().getGeneric().get(0).isTyping());
+ assertEquals(SOURCE, response.getOutput().getGeneric().get(0).getSource());
+ assertEquals(TITLE, response.getOutput().getGeneric().get(0).getTitle());
+ assertEquals(MESSAGE, response.getOutput().getGeneric().get(0).getMessageToHumanAgent());
+ assertEquals(TOPIC, response.getOutput().getGeneric().get(0).getTopic());
+ assertEquals(LABEL, response.getOutput().getGeneric().get(0).getOptions().get(0).getLabel());
+ assertNotNull(response.getOutput().getGeneric().get(0).getOptions().get(0).getValue().getInput());
+ assertEquals(LABEL, response.getOutput().getGeneric().get(0).getSuggestions().get(0).getLabel());
+ assertNotNull(response.getOutput().getGeneric().get(0).getSuggestions().get(0).getValue());
+ }
+
+ @Test
+ public void testCreateSession() throws InterruptedException {
+ server.enqueue(jsonResponse(sessionResponse));
+
+ CreateSessionOptions createSessionOptions = new CreateSessionOptions.Builder()
+ .assistantId(ASSISTANT_ID)
+ .build();
+ SessionResponse response = service.createSession(createSessionOptions).execute();
+ RecordedRequest request = server.takeRequest();
+
+ assertNotNull(response);
+ assertEquals(CREATE_SESSION_PATH, request.getPath());
+
+ assertEquals(SESSION_ID, response.getSessionId());
+ }
+
+ @Test
+ public void testDeleteSession() throws InterruptedException {
+ server.enqueue(new MockResponse());
+
+ DeleteSessionOptions deleteSessionOptions = new DeleteSessionOptions.Builder()
+ .assistantId(ASSISTANT_ID)
+ .sessionId(SESSION_ID)
+ .build();
+ service.deleteSession(deleteSessionOptions).execute();
+ RecordedRequest request = server.takeRequest();
+
+ assertEquals(DELETE_SESSION_PATH, request.getPath());
+ }
+}
diff --git a/assistant/src/test/resources/assistant/assistant.json b/assistant/src/test/resources/assistant/assistant.json
index 5606d80dc95..5cbf5f13537 100644
--- a/assistant/src/test/resources/assistant/assistant.json
+++ b/assistant/src/test/resources/assistant/assistant.json
@@ -47,17 +47,6 @@
"Genre On Off Check",
"node_3_1484628332751"
],
- "actions": [
- {
- "name": "test_action",
- "type": "client",
- "parameters": {
- "param_1": "val_1"
- },
- "result_variable": "var",
- "credentials": "creds"
- }
- ],
"nodes_visited_details": [
{
"dialog_node": "Entry Point For On Off Commands",
diff --git a/assistant/src/test/resources/assistant/message_response.json b/assistant/src/test/resources/assistant/message_response.json
new file mode 100644
index 00000000000..7d8c1c2e818
--- /dev/null
+++ b/assistant/src/test/resources/assistant/message_response.json
@@ -0,0 +1,184 @@
+{
+ "context": {
+ "global": {
+ "system": {
+ "timezone": "timezone",
+ "user_id": "user_id",
+ "turn_count": "10"
+ }
+ },
+ "skills": {
+ "skill_key": "skill_var"
+ }
+ },
+ "output": {
+ "generic": [
+ {
+ "response_type": "text",
+ "text": "text",
+ "time": 1234,
+ "typing": true,
+ "source": "source",
+ "title": "title",
+ "description": "description",
+ "preference": "button",
+ "options": [
+ {
+ "label": "label",
+ "value": {
+ "input": {
+ "message_type": "text",
+ "text": "text",
+ "options": {
+ "debug": true,
+ "restart": true,
+ "alternate_intents": true,
+ "return_context": true
+ },
+ "intents": [
+ {
+ "intent": "intent",
+ "confidence": 0.0
+ }
+ ],
+ "entities": [
+ {
+ "entity": "entity",
+ "location": [
+ 1,
+ 2
+ ],
+ "value": "value",
+ "confidence": 0.0,
+ "metadata": {
+ "key": "value"
+ },
+ "groups": [
+ {
+ "group": "group",
+ "location": [
+ 1,
+ 2
+ ]
+ }
+ ]
+ }
+ ],
+ "suggestion_id": "suggestion_id"
+ }
+ }
+ }
+ ],
+ "message_to_human_agent": "message",
+ "topic": "topic",
+ "suggestions": [
+ {
+ "label": "label",
+ "value": {
+ "input": {
+ "message_type": "text",
+ "text": "text",
+ "options": {
+ "debug": true,
+ "restart": true,
+ "alternate_intents": true,
+ "return_context": true
+ },
+ "intents": [
+ {
+ "intent": "intent",
+ "confidence": 0.0
+ }
+ ],
+ "entities": [
+ {
+ "entity": "entity",
+ "location": [
+ 1,
+ 2
+ ],
+ "value": "value",
+ "confidence": 0.0,
+ "metadata": {
+ "key": "value"
+ },
+ "groups": [
+ {
+ "group": "group",
+ "location": [
+ 1,
+ 2
+ ]
+ }
+ ]
+ }
+ ],
+ "suggestion_id": "suggestion_id"
+ }
+ },
+ "output": {
+ "key": "value"
+ }
+ }
+ ]
+ }
+ ],
+ "intents": [
+ {
+ "intent": "intent",
+ "confidence": 0.0
+ }
+ ],
+ "entities": [
+ {
+ "entity": "entity",
+ "location": [
+ 1,
+ 2
+ ],
+ "value": "value",
+ "confidence": 0.0,
+ "metadata": {
+ "key": "value"
+ },
+ "groups": [
+ {
+ "group": "group",
+ "location": [
+ 1,
+ 2
+ ]
+ }
+ ]
+ }
+ ],
+ "actions": [
+ {
+ "name": "name",
+ "type": "client",
+ "parameters": {
+ "key": "value"
+ },
+ "result_variable": "result_variable",
+ "credentials": "credentials"
+ }
+ ],
+ "debug": {
+ "nodes_visited": [
+ {
+ "dialog_node": "dialog_node",
+ "title": "title",
+ "conditions": "conditions"
+ }
+ ],
+ "log_messages": [
+ {
+ "level": "info",
+ "message": "message"
+ }
+ ],
+ "branch_exited": true,
+ "branch_exited_reason": "completed"
+ }
+ }
+}
diff --git a/assistant/src/test/resources/assistant/session_response.json b/assistant/src/test/resources/assistant/session_response.json
new file mode 100644
index 00000000000..af8c87828c8
--- /dev/null
+++ b/assistant/src/test/resources/assistant/session_response.json
@@ -0,0 +1,3 @@
+{
+ "session_id": "session_id"
+}
diff --git a/build.gradle b/build.gradle
index 0921b0446a6..0d6af60e8c7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -33,6 +33,14 @@ task docs(type: Javadoc) {
destinationDir = file("$buildDir/docs/all")
}
+if (JavaVersion.current().isJava8Compatible()) {
+ allprojects {
+ tasks.withType(Javadoc) {
+ options.addStringOption('Xdoclint:none', '-quiet')
+ }
+ }
+}
+
task copyJars(type: Copy) {
from subprojects.collect { it.tasks.withType(Jar) }
into "$buildDir/allJars"
diff --git a/config.properties.enc b/config.properties.enc
index fa2aaa868de..8c902b11778 100644
Binary files a/config.properties.enc and b/config.properties.enc differ
diff --git a/conversation/README.md b/conversation/README.md
index 8994b275af3..a5f679e3045 100644
--- a/conversation/README.md
+++ b/conversation/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
conversation
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:conversation:6.6.0'
+'com.ibm.watson.developer_cloud:conversation:6.7.0'
```
## Usage
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 e03d2fac4c2..98e227d3d9a 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
@@ -54,7 +54,6 @@
import com.ibm.watson.developer_cloud.conversation.v1.model.ListWorkspacesOptions;
import com.ibm.watson.developer_cloud.conversation.v1.model.LogCollection;
import com.ibm.watson.developer_cloud.conversation.v1.model.LogExport;
-import com.ibm.watson.developer_cloud.conversation.v1.model.Mentions;
import com.ibm.watson.developer_cloud.conversation.v1.model.MessageOptions;
import com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse;
import com.ibm.watson.developer_cloud.conversation.v1.model.OutputData;
@@ -83,7 +82,6 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -523,13 +521,7 @@ public void testCreateExample() {
createExampleIntent();
String exampleText = "Howdy " + UUID.randomUUID().toString(); // gotta be unique
- Mentions mentions = new Mentions();
- mentions.setEntity("entity");
- mentions.setLocation(Arrays.asList(0L, 10L));
- List mentionsList = new ArrayList<>();
- mentionsList.add(mentions);
CreateExampleOptions createOptions = new CreateExampleOptions.Builder(workspaceId, exampleIntent, exampleText)
- .mentions(mentionsList)
.build();
Example response = service.createExample(createOptions).execute();
@@ -537,7 +529,6 @@ public void testCreateExample() {
assertNotNull(response);
assertNotNull(response.getExampleText());
assertEquals(response.getExampleText(), exampleText);
- assertEquals(response.getMentions(), mentionsList);
} catch (Exception ex) {
fail(ex.getMessage());
} finally {
@@ -752,20 +743,13 @@ public void testUpdateExample() {
service.createExample(createOptions).execute();
try {
- Mentions mentions = new Mentions();
- mentions.setEntity("entity");
- mentions.setLocation(Arrays.asList(0L, 10L));
- List mentionsList = new ArrayList<>();
- mentionsList.add(mentions);
UpdateExampleOptions updateOptions = new UpdateExampleOptions.Builder(workspaceId, exampleIntent, exampleText)
.newText(exampleText2)
- .newMentions(mentionsList)
.build();
Example response = service.updateExample(updateOptions).execute();
assertNotNull(response);
assertNotNull(response.getExampleText());
assertEquals(response.getExampleText(), exampleText2);
- assertEquals(response.getMentions(), mentionsList);
} catch (Exception ex) {
fail(ex.getMessage());
} finally {
diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/http/HttpClientSingleton.java b/core/src/main/java/com/ibm/watson/developer_cloud/http/HttpClientSingleton.java
index 62de2c36446..e6daa4d4516 100644
--- a/core/src/main/java/com/ibm/watson/developer_cloud/http/HttpClientSingleton.java
+++ b/core/src/main/java/com/ibm/watson/developer_cloud/http/HttpClientSingleton.java
@@ -20,7 +20,9 @@
import okhttp3.OkHttpClient.Builder;
import okhttp3.TlsVersion;
+import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
@@ -29,10 +31,12 @@
import java.io.IOException;
import java.net.CookieManager;
import java.net.CookiePolicy;
+import java.net.Proxy;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
@@ -49,6 +53,28 @@ public class HttpClientSingleton {
private static final Logger LOG = Logger.getLogger(WatsonService.class.getName());
+ /**
+ * TrustManager for disabling SSL verification, which essentially lets everything through.
+ */
+ private static final TrustManager[] trustAllCerts = new TrustManager[] {
+ new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws
+ CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws
+ CertificateException {
+ }
+
+ @Override
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+ return new java.security.cert.X509Certificate[]{};
+ }
+ }
+ };
+
/**
* Gets the single instance of HttpClientSingleton.
*
@@ -106,6 +132,41 @@ private void addCookieJar(final OkHttpClient.Builder builder) {
builder.cookieJar(new WatsonCookieJar(cookieManager));
}
+ /**
+ * Modifies the current {@link OkHttpClient} instance to not verify SSL certificates.
+ */
+ private void disableSslVerification() {
+ SSLContext trustAllSslContext;
+ try {
+ trustAllSslContext = SSLContext.getInstance("SSL");
+ trustAllSslContext.init(null, trustAllCerts, new java.security.SecureRandom());
+ } catch (NoSuchAlgorithmException | KeyManagementException e) {
+ throw new RuntimeException(e);
+ }
+
+ SSLSocketFactory trustAllSslSocketFactory = trustAllSslContext.getSocketFactory();
+
+ OkHttpClient.Builder builder = okHttpClient.newBuilder();
+ builder.sslSocketFactory(trustAllSslSocketFactory, (X509TrustManager) trustAllCerts[0]);
+ builder.hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ });
+
+ okHttpClient = builder.build();
+ }
+
+ /**
+ * Sets a proxy for the current {@link OkHttpClient} instance.
+ *
+ * @param proxy the {@link Proxy}
+ */
+ private void setProxy(Proxy proxy) {
+ OkHttpClient.Builder builder = okHttpClient.newBuilder().proxy(proxy);
+ okHttpClient = builder.build();
+ }
/**
* Specifically enable all TLS protocols. See: https://github.com/watson-developer-cloud/java-sdk/issues/610
@@ -160,4 +221,22 @@ public OkHttpClient createHttpClient() {
addCookieJar(builder);
return builder.build();
}
+
+ /**
+ * Configures the current {@link OkHttpClient} instance based on the passed-in options.
+ *
+ * @param options the {@link HttpConfigOptions} object for modifying the client
+ */
+ public void configureClient(HttpConfigOptions options) {
+ if (options == null) {
+ return;
+ }
+
+ if (options.shouldDisableSslVerification()) {
+ disableSslVerification();
+ }
+ if (options.getProxy() != null) {
+ setProxy(options.getProxy());
+ }
+ }
}
diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/http/HttpConfigOptions.java b/core/src/main/java/com/ibm/watson/developer_cloud/http/HttpConfigOptions.java
new file mode 100644
index 00000000000..9f8b3754c0b
--- /dev/null
+++ b/core/src/main/java/com/ibm/watson/developer_cloud/http/HttpConfigOptions.java
@@ -0,0 +1,56 @@
+package com.ibm.watson.developer_cloud.http;
+
+import java.net.Proxy;
+
+/**
+ * Options class for configuring the HTTP client.
+ */
+public class HttpConfigOptions {
+ private boolean disableSslVerification;
+ private Proxy proxy;
+
+ public boolean shouldDisableSslVerification() {
+ return this.disableSslVerification;
+ }
+
+ public Proxy getProxy() {
+ return this.proxy;
+ }
+
+ public static class Builder {
+ private boolean disableSslVerification;
+ private Proxy proxy;
+
+ public HttpConfigOptions build() {
+ return new HttpConfigOptions(this);
+ }
+
+ /**
+ * Sets flag to disable any SSL certificate verification during HTTP requests. This should ONLY be used if truly
+ * intended, as it's unsafe otherwise.
+ *
+ * @param disableSslVerification whether to disable SSL verification or not
+ * @return the builder
+ */
+ public Builder disableSslVerification(boolean disableSslVerification) {
+ this.disableSslVerification = disableSslVerification;
+ return this;
+ }
+
+ /**
+ * Sets HTTP proxy to be used by connections with the current client.
+ *
+ * @param proxy the desired {@link Proxy}
+ * @return the builder
+ */
+ public Builder proxy(Proxy proxy) {
+ this.proxy = proxy;
+ return this;
+ }
+ }
+
+ private HttpConfigOptions(Builder builder) {
+ this.disableSslVerification = builder.disableSslVerification;
+ this.proxy = builder.proxy;
+ }
+}
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 065cad989ac..c4c13207a3e 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
@@ -14,6 +14,7 @@
import com.google.gson.JsonObject;
import com.ibm.watson.developer_cloud.http.HttpClientSingleton;
+import com.ibm.watson.developer_cloud.http.HttpConfigOptions;
import com.ibm.watson.developer_cloud.http.HttpHeaders;
import com.ibm.watson.developer_cloud.http.HttpMediaType;
import com.ibm.watson.developer_cloud.http.HttpStatus;
@@ -165,6 +166,15 @@ protected OkHttpClient configureHttpClient() {
return HttpClientSingleton.getInstance().createHttpClient();
}
+ /**
+ * Configures the inner HTML client based on the passed-in options.
+ *
+ * @param options the {@link HttpConfigOptions} object for modifying the client
+ */
+ public void configureClient(HttpConfigOptions options) {
+ HttpClientSingleton.getInstance().configureClient(options);
+ }
+
/**
* Execute the HTTP request. Okhttp3 compliant.
*
diff --git a/core/src/test/java/com/ibm/watson/developer_cloud/http/HttpConfigTest.java b/core/src/test/java/com/ibm/watson/developer_cloud/http/HttpConfigTest.java
new file mode 100644
index 00000000000..62188cc5966
--- /dev/null
+++ b/core/src/test/java/com/ibm/watson/developer_cloud/http/HttpConfigTest.java
@@ -0,0 +1,26 @@
+package com.ibm.watson.developer_cloud.http;
+
+import org.junit.Test;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for the HttpConfigOptions object.
+ */
+public class HttpConfigTest {
+
+ @Test
+ public void testHttpConfigOptions() {
+ Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080));
+ HttpConfigOptions configOptions = new HttpConfigOptions.Builder()
+ .disableSslVerification(true)
+ .proxy(proxy)
+ .build();
+
+ assertEquals(true, configOptions.shouldDisableSslVerification());
+ assertEquals(proxy, configOptions.getProxy());
+ }
+}
diff --git a/core/src/test/java/com/ibm/watson/developer_cloud/service/WatsonServiceTest.java b/core/src/test/java/com/ibm/watson/developer_cloud/service/WatsonServiceTest.java
index ad62f2b21a8..4b28ef26686 100644
--- a/core/src/test/java/com/ibm/watson/developer_cloud/service/WatsonServiceTest.java
+++ b/core/src/test/java/com/ibm/watson/developer_cloud/service/WatsonServiceTest.java
@@ -23,28 +23,27 @@
*/
public class WatsonServiceTest {
+ @Test
+ public void testMimeTypes() {
+ assertTrue(WatsonService.isJsonMimeType("application/json"));
+ assertTrue(WatsonService.isJsonMimeType("application/json; charset=utf-8"));
+ assertTrue(WatsonService.isJsonMimeType("application/json;charset=utf-8"));
+ assertTrue(WatsonService.isJsonMimeType("APPLICATION/JSON;charset=utf-16"));
+ assertFalse(WatsonService.isJsonMimeType("application/notjson"));
+ assertFalse(WatsonService.isJsonMimeType("application/json-patch+json"));
+ assertFalse(WatsonService.isJsonMimeType("APPlication/JSON-patCH+jSoN;charset=utf-8"));
+ assertTrue(WatsonService.isJsonPatchMimeType("APPlication/JSON-patCH+jSoN;charset=utf-8"));
+ assertTrue(WatsonService.isJsonMimeType("application/merge-patch+json"));
+ assertTrue(WatsonService.isJsonMimeType("application/merge-patch+json;charset=utf-8"));
+ assertFalse(WatsonService.isJsonMimeType("application/json2-patch+json"));
+ assertFalse(WatsonService.isJsonMimeType("application/merge-patch+json-blah"));
+ assertFalse(WatsonService.isJsonMimeType("application/merge patch json"));
- @Test
- public void testMimeTypes() {
- assertTrue(WatsonService.isJsonMimeType("application/json"));
- assertTrue(WatsonService.isJsonMimeType("application/json; charset=utf-8"));
- assertTrue(WatsonService.isJsonMimeType("application/json;charset=utf-8"));
- assertTrue(WatsonService.isJsonMimeType("APPLICATION/JSON;charset=utf-16"));
- assertFalse(WatsonService.isJsonMimeType("application/notjson"));
- assertFalse(WatsonService.isJsonMimeType("application/json-patch+json"));
- assertFalse(WatsonService.isJsonMimeType("APPlication/JSON-patCH+jSoN;charset=utf-8"));
- assertTrue(WatsonService.isJsonPatchMimeType("APPlication/JSON-patCH+jSoN;charset=utf-8"));
- assertTrue(WatsonService.isJsonMimeType("application/merge-patch+json"));
- assertTrue(WatsonService.isJsonMimeType("application/merge-patch+json;charset=utf-8"));
- assertFalse(WatsonService.isJsonMimeType("application/json2-patch+json"));
- assertFalse(WatsonService.isJsonMimeType("application/merge-patch+json-blah"));
- assertFalse(WatsonService.isJsonMimeType("application/merge patch json"));
-
- assertTrue(WatsonService.isJsonPatchMimeType("application/json-patch+json"));
- assertTrue(WatsonService.isJsonPatchMimeType("application/json-patch+json;charset=utf-8"));
- assertFalse(WatsonService.isJsonPatchMimeType("application/json"));
- assertFalse(WatsonService.isJsonPatchMimeType("APPLICATION/JsOn; charset=utf-8"));
- assertFalse(WatsonService.isJsonPatchMimeType("application/merge-patch+json"));
- assertFalse(WatsonService.isJsonPatchMimeType("application/merge-patch+json;charset=utf-8"));
- }
+ assertTrue(WatsonService.isJsonPatchMimeType("application/json-patch+json"));
+ assertTrue(WatsonService.isJsonPatchMimeType("application/json-patch+json;charset=utf-8"));
+ assertFalse(WatsonService.isJsonPatchMimeType("application/json"));
+ assertFalse(WatsonService.isJsonPatchMimeType("APPLICATION/JsOn; charset=utf-8"));
+ assertFalse(WatsonService.isJsonPatchMimeType("application/merge-patch+json"));
+ assertFalse(WatsonService.isJsonPatchMimeType("application/merge-patch+json;charset=utf-8"));
+ }
}
diff --git a/discovery/README.md b/discovery/README.md
index c2d8d4f0319..49db891aba1 100644
--- a/discovery/README.md
+++ b/discovery/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
discovery
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:discovery:6.6.0'
+'com.ibm.watson.developer_cloud:discovery:6.7.0'
```
## Usage
diff --git a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java
index e0db4395a37..00f8899e44b 100644
--- a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java
+++ b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java
@@ -1741,6 +1741,8 @@ public void deleteUserDataIsSuccessful() {
}
}
+ // ignoring temporarily while the service is having problems :/
+ @Ignore
@Test
public void credentialsOperationsAreSuccessful() {
String url = "https://login.salesforce.com";
diff --git a/language-translator/README.md b/language-translator/README.md
index 5ef627677fa..063748c70fc 100644
--- a/language-translator/README.md
+++ b/language-translator/README.md
@@ -10,13 +10,13 @@ Language Translator v3 is now available. The v2 Language Translator API will no
com.ibm.watson.developer_cloud
language-translator
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:language-translator:6.6.0'
+'com.ibm.watson.developer_cloud:language-translator:6.7.0'
```
## Usage
diff --git a/natural-language-classifier/README.md b/natural-language-classifier/README.md
index ca972ee5933..c73cc17449b 100644
--- a/natural-language-classifier/README.md
+++ b/natural-language-classifier/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
natural-language-classifier
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:natural-language-classifier:6.6.0'
+'com.ibm.watson.developer_cloud:natural-language-classifier:6.7.0'
```
## Usage
diff --git a/natural-language-classifier/src/test/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifierIT.java b/natural-language-classifier/src/test/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifierIT.java
index e39a1f460db..9ea47f35761 100644
--- a/natural-language-classifier/src/test/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifierIT.java
+++ b/natural-language-classifier/src/test/java/com/ibm/watson/developer_cloud/natural_language_classifier/v1/NaturalLanguageClassifierIT.java
@@ -34,7 +34,6 @@
import org.junit.runners.MethodSorters;
import java.io.File;
-import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -167,28 +166,10 @@ public void dClassify() {
*/
@Test
public void eDelete() throws InterruptedException {
- List classifiers = service.listClassifiers().execute().getClassifiers();
-
- for (Classifier classifier : classifiers) {
- GetClassifierOptions getOptions = new GetClassifierOptions.Builder()
- .classifierId(classifier.getClassifierId())
- .build();
- Classifier currentClassifier = service.getClassifier(getOptions).execute();
- if (currentClassifier.getClassifierId().equals(classifierId)) {
- while (!currentClassifier.getStatus().equals(Status.AVAILABLE)) {
- Thread.sleep(5000);
- getOptions = new GetClassifierOptions.Builder()
- .classifierId(classifierId)
- .build();
- currentClassifier = service.getClassifier(getOptions).execute();
- }
-
- DeleteClassifierOptions deleteOptions = new DeleteClassifierOptions.Builder()
- .classifierId(classifier.getClassifierId())
- .build();
- service.deleteClassifier(deleteOptions).execute();
- }
- }
+ DeleteClassifierOptions deleteOptions = new DeleteClassifierOptions.Builder()
+ .classifierId(classifierId)
+ .build();
+ service.deleteClassifier(deleteOptions).execute();
}
/**
diff --git a/natural-language-understanding/README.md b/natural-language-understanding/README.md
index da253ac333a..e656cefe7d6 100644
--- a/natural-language-understanding/README.md
+++ b/natural-language-understanding/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
natural-language-understanding
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:natural-language-understanding:6.6.0'
+'com.ibm.watson.developer_cloud:natural-language-understanding:6.7.0'
```
## Usage
diff --git a/personality-insights/README.md b/personality-insights/README.md
index 7d77c2775f4..910039400e8 100755
--- a/personality-insights/README.md
+++ b/personality-insights/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
personality-insights
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:personality-insights:6.6.0'
+'com.ibm.watson.developer_cloud:personality-insights:6.7.0'
```
## Usage
diff --git a/speech-to-text/README.md b/speech-to-text/README.md
index 6973530ceb6..471e8c6d996 100755
--- a/speech-to-text/README.md
+++ b/speech-to-text/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
speech-to-text
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:speech-to-text:6.6.0'
+'com.ibm.watson.developer_cloud:speech-to-text:6.7.0'
```
## Usage
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 f39efa2b83b..e9126a30420 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
@@ -1405,6 +1405,14 @@ public ServiceCall upgradeAcousticModel(UpgradeAcousticModelOptions upgrad
* supported for use with speech recognition and with the `Content-Type` header, including the `rate`, `channels`, and
* `endianness` parameters that are used with some formats. The default contained audio format is `audio/wav`.
*
+ * ### Naming restrictions for embedded audio files
+ *
+ * The name of an audio file that is embedded within an archive-type resource must meet the following restrictions:
+ * * Include a maximum of 128 characters in the file name; this includes the file extension.
+ * * Do not include spaces, slashes, or backslashes in the file name.
+ * * Do not use the name of an audio file that has already been added to the custom model as part of an archive-type
+ * resource.
+ *
* @param addAudioOptions the {@link AddAudioOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddAudioOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddAudioOptions.java
index 82b2dd95c36..ad2a2563789 100644
--- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddAudioOptions.java
+++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddAudioOptions.java
@@ -265,8 +265,11 @@ public String customizationId() {
/**
* Gets the audioName.
*
- * The name of the audio resource for the custom acoustic model. When adding an audio resource, do not include spaces
- * in the name; use a localized name that matches the language of the custom model.
+ * The name of the new audio resource for the custom acoustic model. Use a localized name that matches the language of
+ * the custom model and reflects the contents of the resource.
+ * * Include a maximum of 128 characters in the name.
+ * * Do not include spaces, slashes, or backslashes in the name.
+ * * Do not use the name of an audio resource that has already been added to the custom model.
*
* @return the audioName
*/
diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddCorpusOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddCorpusOptions.java
index 5d782e03c07..e79c1cbabaf 100644
--- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddCorpusOptions.java
+++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/AddCorpusOptions.java
@@ -182,9 +182,13 @@ public String customizationId() {
/**
* Gets the corpusName.
*
- * The name of the corpus for the custom language model. When adding a corpus, do not include spaces in the name; use
- * a localized name that matches the language of the custom model; and do not use the name `user`, which is reserved
- * by the service to denote custom words added or modified by the user.
+ * The name of the new corpus for the custom language model. Use a localized name that matches the language of the
+ * custom model and reflects the contents of the corpus.
+ * * Include a maximum of 128 characters in the name.
+ * * Do not include spaces, slashes, or backslashes in the name.
+ * * Do not use the name of a corpus that has already been added to the custom model.
+ * * Do not use the name `user`, which is reserved by the service to denote custom words that are added or modified by
+ * the user.
*
* @return the corpusName
*/
diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteAudioOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteAudioOptions.java
index a01b216768a..73d296a3098 100644
--- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteAudioOptions.java
+++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteAudioOptions.java
@@ -115,8 +115,7 @@ public String customizationId() {
/**
* Gets the audioName.
*
- * The name of the audio resource for the custom acoustic model. When adding an audio resource, do not include spaces
- * in the name; use a localized name that matches the language of the custom model.
+ * The name of the audio resource for the custom acoustic model.
*
* @return the audioName
*/
diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteCorpusOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteCorpusOptions.java
index 9e73a2df178..3e5a60724b6 100644
--- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteCorpusOptions.java
+++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/DeleteCorpusOptions.java
@@ -115,9 +115,7 @@ public String customizationId() {
/**
* Gets the corpusName.
*
- * The name of the corpus for the custom language model. When adding a corpus, do not include spaces in the name; use
- * a localized name that matches the language of the custom model; and do not use the name `user`, which is reserved
- * by the service to denote custom words added or modified by the user.
+ * The name of the corpus for the custom language model.
*
* @return the corpusName
*/
diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetAudioOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetAudioOptions.java
index 10261bd90a6..8ee86344515 100644
--- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetAudioOptions.java
+++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetAudioOptions.java
@@ -115,8 +115,7 @@ public String customizationId() {
/**
* Gets the audioName.
*
- * The name of the audio resource for the custom acoustic model. When adding an audio resource, do not include spaces
- * in the name; use a localized name that matches the language of the custom model.
+ * The name of the audio resource for the custom acoustic model.
*
* @return the audioName
*/
diff --git a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetCorpusOptions.java b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetCorpusOptions.java
index fa891f2668e..6bd80b0d057 100644
--- a/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetCorpusOptions.java
+++ b/speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/GetCorpusOptions.java
@@ -115,9 +115,7 @@ public String customizationId() {
/**
* Gets the corpusName.
*
- * The name of the corpus for the custom language model. When adding a corpus, do not include spaces in the name; use
- * a localized name that matches the language of the custom model; and do not use the name `user`, which is reserved
- * by the service to denote custom words added or modified by the user.
+ * The name of the corpus for the custom language model.
*
* @return the corpusName
*/
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 3a4f57a8dc1..a732f8586b0 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
@@ -98,6 +98,7 @@ public class SpeechToTextIT extends WatsonServiceTest {
private SpeechRecognitionResults asyncResults;
private Boolean inactivityTimeoutOccurred;
private String customizationId;
+ private String acousticCustomizationId;
/** The expected exception. */
@Rule
@@ -113,6 +114,7 @@ public void setUp() throws Exception {
super.setUp();
this.customizationId = getProperty("speech_to_text.customization_id");
+ this.acousticCustomizationId = getProperty("speech_to_text.acoustic_customization_id");
String username = getProperty("speech_to_text.username");
String password = getProperty("speech_to_text.password");
@@ -788,29 +790,19 @@ public void testListAcousticModels() {
@Ignore
@Test
public void testGetAudio() throws InterruptedException, FileNotFoundException {
- String name = "java-sdk-temporary";
- String description = "Temporary custom model for testing the Java SDK";
- CreateAcousticModelOptions createOptions = new CreateAcousticModelOptions.Builder()
- .name(name)
- .baseModelName(EN_BROADBAND16K)
- .description(description)
- .build();
- AcousticModel myModel = service.createAcousticModel(createOptions).execute();
- String id = myModel.getCustomizationId();
-
String audioName = "sample";
AddAudioOptions addOptions = new AddAudioOptions.Builder()
.audioResource(new File(SAMPLE_WAV))
.contentType(AddAudioOptions.ContentType.AUDIO_WAV)
.audioName(audioName)
- .customizationId(id)
+ .customizationId(acousticCustomizationId)
.allowOverwrite(true)
.build();
service.addAudio(addOptions).execute();
try {
GetAudioOptions getOptions = new GetAudioOptions.Builder()
- .customizationId(id)
+ .customizationId(acousticCustomizationId)
.audioName(audioName)
.build();
AudioListing audio = service.getAudio(getOptions).execute();
@@ -819,23 +811,10 @@ public void testGetAudio() throws InterruptedException, FileNotFoundException {
assertEquals(audioName, audio.getName());
} finally {
DeleteAudioOptions deleteAudioOptions = new DeleteAudioOptions.Builder()
- .customizationId(id)
+ .customizationId(acousticCustomizationId)
.audioName(audioName)
.build();
service.deleteAudio(deleteAudioOptions).execute();
-
- GetAcousticModelOptions getOptions = new GetAcousticModelOptions.Builder()
- .customizationId(id)
- .build();
- for (int x = 0; x < 30 && !service.getAcousticModel(getOptions).execute().getStatus().equals(
- AcousticModel.Status.AVAILABLE); x++) {
- Thread.sleep(5000);
- }
-
- DeleteAcousticModelOptions deleteAcousticModelOptions = new DeleteAcousticModelOptions.Builder()
- .customizationId(id)
- .build();
- service.deleteAcousticModel(deleteAcousticModelOptions).execute();
}
}
@@ -844,29 +823,12 @@ public void testGetAudio() throws InterruptedException, FileNotFoundException {
*/
@Test
public void testListAudio() {
- String name = "java-sdk-temporary";
- String description = "Temporary custom model for testing the Java SDK";
- CreateAcousticModelOptions createOptions = new CreateAcousticModelOptions.Builder()
- .name(name)
- .baseModelName(EN_BROADBAND16K)
- .description(description)
+ ListAudioOptions listOptions = new ListAudioOptions.Builder()
+ .customizationId(acousticCustomizationId)
.build();
- AcousticModel myModel = service.createAcousticModel(createOptions).execute();
- String id = myModel.getCustomizationId();
+ AudioResources resources = service.listAudio(listOptions).execute();
- try {
- ListAudioOptions listOptions = new ListAudioOptions.Builder()
- .customizationId(id)
- .build();
- AudioResources resources = service.listAudio(listOptions).execute();
-
- assertNotNull(resources);
- } finally {
- DeleteAcousticModelOptions deleteAcousticModelOptions = new DeleteAcousticModelOptions.Builder()
- .customizationId(id)
- .build();
- service.deleteAcousticModel(deleteAcousticModelOptions).execute();
- }
+ assertNotNull(resources);
}
/**
@@ -876,55 +838,33 @@ public void testListAudio() {
*/
@Test
public void testAddAudioArchive() throws FileNotFoundException, InterruptedException {
- String name = "java-sdk-temporary";
- String description = "Temporary custom model for testing the Java SDK";
- CreateAcousticModelOptions createOptions = new CreateAcousticModelOptions.Builder()
- .name(name)
- .baseModelName(EN_BROADBAND16K)
- .description(description)
- .build();
- AcousticModel myModel = service.createAcousticModel(createOptions).execute();
- String id = myModel.getCustomizationId();
-
String audioName = "test-archive";
File audio = new File(WAV_ARCHIVE);
AddAudioOptions addOptions = new AddAudioOptions.Builder()
- .customizationId(id)
+ .customizationId(acousticCustomizationId)
.audioName(audioName)
.contentType(AddAudioOptions.ContentType.APPLICATION_ZIP)
.containedContentType(AddAudioOptions.ContainedContentType.AUDIO_WAV)
.audioResource(audio)
+ .allowOverwrite(true)
.build();
service.addAudio(addOptions).execute();
try {
GetAudioOptions getOptions = new GetAudioOptions.Builder()
- .customizationId(id)
+ .customizationId(acousticCustomizationId)
.audioName(audioName)
.build();
AudioListing listing = service.getAudio(getOptions).execute();
assertNotNull(listing);
- assertEquals(audioName, listing.getName());
+ assertEquals(audioName, listing.getContainer().getName());
} finally {
DeleteAudioOptions deleteAudioOptions = new DeleteAudioOptions.Builder()
- .customizationId(id)
+ .customizationId(acousticCustomizationId)
.audioName(audioName)
.build();
service.deleteAudio(deleteAudioOptions).execute();
-
- GetAcousticModelOptions getOptions = new GetAcousticModelOptions.Builder()
- .customizationId(id)
- .build();
- for (int x = 0; x < 30 && !service.getAcousticModel(getOptions).execute().getStatus().equals(
- AcousticModel.Status.AVAILABLE); x++) {
- Thread.sleep(5000);
- }
-
- DeleteAcousticModelOptions deleteAcousticModelOptions = new DeleteAcousticModelOptions.Builder()
- .customizationId(id)
- .build();
- service.deleteAcousticModel(deleteAcousticModelOptions).execute();
}
}
diff --git a/text-to-speech/README.md b/text-to-speech/README.md
index 4be3642f884..7294d800b56 100755
--- a/text-to-speech/README.md
+++ b/text-to-speech/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
text-to-speech
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:text-to-speech:6.6.0'
+'com.ibm.watson.developer_cloud:text-to-speech:6.7.0'
```
## Usage
diff --git a/tone-analyzer/README.md b/tone-analyzer/README.md
index 3ef731c73ef..0936f2d9188 100755
--- a/tone-analyzer/README.md
+++ b/tone-analyzer/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
tone-analyzer
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:tone-analyzer:6.6.0'
+'com.ibm.watson.developer_cloud:tone-analyzer:6.7.0'
```
## Usage
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 8e9f5c0f92a..ccf53a6a079 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
@@ -130,11 +130,7 @@ public ServiceCall tone(ToneOptions toneOptions) {
if (toneOptions.tones() != null) {
builder.query("tones", RequestUtils.join(toneOptions.tones(), ","));
}
- if (toneOptions.contentType().equalsIgnoreCase(ToneOptions.ContentType.APPLICATION_JSON)) {
- builder.bodyJson(GsonSingleton.getGson().toJsonTree(toneOptions.toneInput()).getAsJsonObject());
- } else {
- builder.bodyContent(toneOptions.body(), toneOptions.contentType());
- }
+ builder.bodyContent(toneOptions.contentType(), toneOptions.toneInput(), null, toneOptions.body());
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ToneAnalysis.class));
}
diff --git a/visual-recognition/README.md b/visual-recognition/README.md
index b7ded3b4d38..fc942c49d5c 100644
--- a/visual-recognition/README.md
+++ b/visual-recognition/README.md
@@ -7,13 +7,13 @@
com.ibm.watson.developer_cloud
visual-recognition
- 6.6.0
+ 6.7.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:visual-recognition:6.6.0'
+'com.ibm.watson.developer_cloud:visual-recognition:6.7.0'
```
## Usage