diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index a89f1b4fa5f..2321d61e6cf 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,13 +1,15 @@
[bumpversion]
-current_version = 6.14.0
+current_version = 7.0.0
commit = True
-message = [skip ci] docs: Update version numbers from {current_version} -> {new_version}
+message = Update version numbers from {current_version} -> {new_version}
+
+[bumpversion:file:gradle.properties]
[bumpversion:file:README.md]
[bumpversion:file:assistant/README.md]
-[bumpversion:file:conversation/README.md]
+[bumpversion:file:compare-comply/README.md]
[bumpversion:file:discovery/README.md]
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 9ef1a87cc89..cdc9d8c65ab 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -1,18 +1,24 @@
-# Questions
-
-If you are having difficulties using the APIs or have a question about the IBM Watson Services,
-please ask a question on [dW Answers][dw] or [Stack Overflow][stackoverflow].
-
# Issues
If you encounter an issue with the Java SDK, you are welcome to submit a [bug report](https://github.com/watson-developer-cloud/java-sdk/issues).
Before that, please search for similar issues. It's possible somebody has encountered this issue already.
+# Building and testing
+This project uses [Gradle] as the build tool (> v1.x). Here are some helpful commands:
+```sh
+cd java-sdk
+gradle jar # build jar file (build/libs/watson-developer-cloud-6.14.0.jar)
+gradle test # run tests
+gradle check # performs quality checks on source files and generates reports
+gradle testReport # run tests and generate the aggregated test report (build/reports/allTests)
+gradle codeCoverageReport # run tests and generate the code coverage report (build/reports/jacoco)
+```
+
# Pull Requests
If you want to contribute to the repository, here's a quick guide:
1. Fork the repository
- 1. Create a `.config.properties` similar to [`config.properties`](https://github.com/watson-developer-cloud/java-sdk/blob/master/core/src/test/resources/config.properties).
+ 1. Edit the [`config.properties`](../common/src/test/resources/config.properties) file to add your service credentials to the appropriate fields.
2. develop and test your code changes, gradle: `gradle test`.
* Run `checkstyle`: `gradle checkstyle`. 🏁
* Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
@@ -48,24 +54,6 @@ By making a contribution to this project, I certify that:
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
-## Emoji Cheatsheet
-
-When creating creating commits or updating the `CHANGELOG`, please **start** the commit message or update with one of the following applicable Emoji. Emoji should not be used at the start of issue or pull request titles.
-
-* :new: `:new:` when adding new functionality
-* :bug: `:bug:` when fixing a bug
-* :memo: `:memo:` when writing documentation
-* :art: `:art:` when improving the format/structure of the code
-* :fire: `:fire:` when removing code or files
-* :racehorse: `:racehorse:` when improving performance
-* :white_check_mark: `:white_check_mark:` when adding tests
-* :green_heart: `:green_heart:` when fixing the CI build
-* :lock: `:lock:` when dealing with security
-* :crystal_ball: `:crystal_ball:` when experimenting
-* :unamused: `:unamused:` when doing chore work (updating dependencies, etc…)
-* :boom: `:boom:` when changing in a non-backwards-compatible way current functionality
-* :shipit: `:shipit:` when creating a new release
-
## Additional Resources
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000000..180248778fc
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,44 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+Remember, an issue is not the place to ask questions. You can use [Stack Overflow](http://stackoverflow.com/questions/tagged/ibm-watson) for that, or you may want to start a discussion on the [dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson).
+
+Before you open an issue, please check if a similar issue already exists or has been closed before.
+
+**Check service status**
+
+1. For service issues or 5xx errors, first, go to the [IBM Cloud status page](https://cloud.ibm.com/status?component=compare-comply%2Cdiscovery%2Cconversation%2Cwatson-vision-combined%2Cnatural-language-understanding%2Cnatural-language-classifier%2Clanguage-translator%2Cpersonality-insights%2Cspeech-to-text%2Ctext-to-speech%2Ctone-analyzer&selected=status) and check the status of the service.
+1. If the service status is OK, continue with a bug report.
+
+---
+
+**Overview**
+_What is the issue? Be concise and clear._
+
+**Expected behavior**
+_What did you expect to happen?_
+
+**Actual behavior**
+_What actually happened?_
+
+**How to reproduce**
+_Help us to reproduce what you experienced. Include your code snippets (without credentials)_
+
+**Screenshots**
+_If applicable, add screenshots to help explain your problem._
+
+**SDK Version**
+_Please provide the SDK version here._
+
+**Additional information:**
+- OS: _for example, iOS_
+- Which version of `Java` are you using?
+
+**Additional context**
+_Add any other details about the problem._
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000000..c86f075d14e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,18 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+Remember, an issue is not the place to ask questions. You can use [Stack Overflow](http://stackoverflow.com/questions/tagged/ibm-watson) for that, or you may want to start a discussion on the [dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson).
+
+Before you open an issue, please check if a similar issue already exists or has been closed before.
+
+### When you open an issue for a feature request, please add as much detail as possible:
+
+- [ ] A descriptive title starting with the service name
+- [ ] A description of the problem you're trying to solve
+- [ ] A suggested solution if possible
diff --git a/.gitignore b/.gitignore
index 012cfe40485..a262e0e1d1f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,16 +12,23 @@ bin/
*.iml
*.ipr
*.iws
+config.properties
.config.properties
.checkstyle
.gradletasknamecache
docs
.swagger-codegen-ignore
.vscode/
-conversation/src/test/java/com/ibm/watson/developer_cloud/conversation/v1/ConversationTest.java
.swagger-codegen/VERSION
*.orig
*.rej
compare-comply/src/test/resources/compare_comply/cloud-object-storage-credentials-input.json
compare-comply/src/test/resources/compare_comply/cloud-object-storage-credentials-output.json
-secrets.tar
\ No newline at end of file
+secrets.tar
+package-lock.json
+*.mlmodel
+.openapi-generator-ignore
+.openapi-generator/
+package-lock.json
+.pre-commit-config.yaml
+.secrets.baseline
\ No newline at end of file
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
deleted file mode 100644
index 9a742884733..00000000000
--- a/.pre-commit-config.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-- repo: git@github.ibm.com:Whitewater/whitewater-detect-secrets
- rev: master
- hooks:
- - id: detect-secrets # pragma: whitelist secret
- args: [--baseline, .secrets.baseline, --no-keyword-scan ]
\ No newline at end of file
diff --git a/.releaserc b/.releaserc
new file mode 100644
index 00000000000..dbd27392306
--- /dev/null
+++ b/.releaserc
@@ -0,0 +1,13 @@
+{
+ "branch": "master",
+ "tagFormat": "java-sdk-${version}",
+ "plugins": [
+ "@semantic-release/commit-analyzer",
+ "@semantic-release/release-notes-generator",
+ "@semantic-release/git",
+ "@semantic-release/github",
+ ["@semantic-release/exec", {
+ "prepareCmd": "bumpversion --current-version ${lastRelease.version} --new-version ${nextRelease.version} --verbose --allow-dirty patch"
+ }]
+ ]
+}
\ No newline at end of file
diff --git a/.secrets.baseline b/.secrets.baseline
deleted file mode 100644
index b107d9ca62d..00000000000
--- a/.secrets.baseline
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "exclude_regex": null,
- "generated_at": "2019-01-16T16:41:59Z",
- "plugins_used": [
- {
- "base64_limit": 4.5,
- "name": "Base64HighEntropyString"
- },
- {
- "name": "BasicAuthDetector"
- },
- {
- "hex_limit": 3,
- "name": "HexHighEntropyString"
- },
- {
- "name": "PrivateKeyDetector"
- },
- {
- "name": "SlackDetector"
- }
- ],
- "results": {},
- "version": "0.10.3"
-}
diff --git a/.travis.yml b/.travis.yml
index 766a43459e7..1cea2cade9b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,25 +15,27 @@ cache:
- "$HOME/.m2"
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
-env:
- global:
- - secure: S2KIWOJX35j1FczyV7JRFrFpTftb8Hmkf6C50bJh8E03IbPu7tnX2znPKBbRWcIQndO6qd5dL7+BqtXabByOzd5Slj5/NBdXPcGffsO7B0cpFQS8ngpIMAGReCXQ12PbOiO8CIk2f/20lU3L0kqcP1TaPyZYIlSwkUg98ls8p90=
- - secure: eLv41LVZoRCqQehOM29RLodZ6NZhrIdLWklAkMdLGlFDEiVY5f0shaPLffpUiuv/3pg+CuQk9ffBc72m8lwTsimex9unC/WVsqQJhqQEWJEaPGL0UamV/HqHMeBQEpKiCcKHaBRHFGk7QQJVtiXvVvlbwk7Jks5giUR7+s/Q6iI=
- - secure: l0dde5NSGedD6fny5aMr1ll90FYVd7IKDsZ0Kd1GWnB+iDd3rjDBwz5q6NUwN2LTqw3jWFqmqdEnGUGO3Er0rdfdtPh3K194sTK3XuCZz8GEjFvYAEDRQ59oyK8fhw60c86cWppBQ4gluLKLstm12DLkARTUvJiIsTQTnuc2YGg=
before_install:
-- sed -i.bak -e 's|https://nexus.codehaus.org/snapshots/|https://oss.sonatype.org/content/repositories/codehaus-snapshots/|g'
- ~/.m2/settings.xml
- |
if [ "$TRAVIS_JDK_VERSION" == "openjdk7" ]; then
sudo wget "https://bouncycastle.org/download/bcprov-ext-jdk15on-158.jar" -O "${JAVA_HOME}/jre/lib/ext/bcprov-ext-jdk15on-158.jar"
sudo perl -pi.bak -e 's/^(security\.provider\.)([0-9]+)/$1.($2+1)/ge' /etc/java-7-openjdk/security/java.security
echo "security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider" | sudo tee -a /etc/java-7-openjdk/security/java.security
fi
+- npm install -g npm@6.x
+- nvm install 'lts/*'
+- sudo apt-get update
+- sudo apt-get install python
install:
- if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then cd appscan; make asoc-tool; cd
../; fi
+- npm install -g semantic-release@15.13.4
+- npm install @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/git @semantic-release/github @semantic-release/exec -D
+- pip install --user bumpversion
before_script:
- if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then chmod a+x ./appscan/ASOC.sh; fi
+- env
+- echo "TRAVIS_TAG = '${TRAVIS_TAG}'"
script:
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ]
&& openssl aes-256-cbc -K $encrypted_42d9c68e608d_key -iv $encrypted_42d9c68e608d_iv -in secrets.tar.enc -out secrets.tar -d
@@ -48,6 +50,18 @@ script:
after_success:
- bash <(curl -s https://codecov.io/bash)
deploy:
+- provider: script
+ skip_cleanup: true
+ script: "travis_wait 30 ./gradlew bintrayUpload"
+ on:
+ tags: true
+ jdk: openjdk7
+- provider: script
+ skip_cleanup: true
+ script: "semantic-release"
+ on:
+ branch: master
+ jdk: openjdk7
- provider: script
script: ".utility/push-javadoc-to-gh-pages.sh"
skip_cleanup: true
diff --git a/.utility/bintray-properties.gradle b/.utility/bintray-properties.gradle
new file mode 100644
index 00000000000..cafd26342be
--- /dev/null
+++ b/.utility/bintray-properties.gradle
@@ -0,0 +1,8 @@
+ext {
+ packageName = PACKAGE_NAME
+ libraryName = NAME
+ artifact = ARTIFACT_ID
+ libraryDescription = DESCRIPTION
+}
+
+apply from: rootProject.file('.utility/bintray-release.gradle')
\ No newline at end of file
diff --git a/.utility/bintray-release.gradle b/.utility/bintray-release.gradle
new file mode 100644
index 00000000000..2071c6c2d89
--- /dev/null
+++ b/.utility/bintray-release.gradle
@@ -0,0 +1,97 @@
+apply plugin: 'com.jfrog.bintray'
+apply plugin: 'com.github.johnrengelman.shadow'
+apply plugin: 'java'
+apply plugin: 'java-library'
+apply plugin: 'maven'
+apply plugin: 'maven-publish'
+
+bintrayUpload.dependsOn assemble
+bintrayUpload.dependsOn sourcesJar
+bintrayUpload.dependsOn javadocJar
+
+bintray {
+ user = System.getenv('BINTRAY_USER')
+ key = System.getenv('BINTRAY_APIKEY')
+ publications = ['maven']
+ publish = true
+ pkg {
+ repo = 'ibm-cloud-sdk-repo'
+ name = packageName
+ userOrg = 'ibm-cloud-sdks'
+ licenses = ['Apache-2.0']
+ vcsUrl = 'https://github.com/watson-developer-cloud/java-sdk.git'
+ version {
+ name = project.property('version')
+ vcsTag = project.property('version')
+ released = new Date()
+ gpg {
+ sign = true
+ }
+ mavenCentralSync {
+ sync = true
+ user = System.getenv('SONATYPE_USER')
+ password = System.getenv('SONATYPE_PASSWORD')
+ }
+ }
+ }
+}
+
+def pomConfig = {
+ scm {
+ connection 'scm:git:git@github.com:watson-developer-cloud/java-sdk.git'
+ developerConnection 'scm:git:git@github.com:watson-developer-cloud/java-sdk.git'
+ url 'https://github.com/watson-developer-cloud/java-sdk'
+ }
+
+ issueManagement {
+ system 'GitHub'
+ url 'https://github.com/watson-developer-cloud/java-sdk/issues'
+
+ }
+
+ ciManagement {
+ system 'Travis CI'
+ url 'https://travis-ci.org/watson-developer-cloud/java-sdk'
+ }
+
+ licenses {
+ license {
+ name 'The Apache License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+
+ developers {
+ developer {
+ id 'german'
+ name 'German Attanasio'
+ email 'germanatt@us.ibm.com'
+ }
+ developer {
+ id 'logan'
+ name 'Logan Patino'
+ email 'loganpatino10@ibm.com'
+ }
+ }
+}
+
+publishing {
+ publications {
+ maven(MavenPublication) {
+ from components.java
+ artifact sourcesJar
+ artifact javadocJar
+ artifact shadowJar
+ groupId 'com.ibm.watson'
+ artifactId artifact
+ version project.property('version')
+ pom.withXml {
+ def root = asNode()
+ root.appendNode('description', libraryDescription)
+ root.appendNode('name', libraryName)
+ root.appendNode('url', 'https://cloud.ibm.com/developer/watson/dashboard')
+ root.children().last() + pomConfig
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/.utility/generate_apidiff_index_html.sh b/.utility/generate_apidiff_index_html.sh
index 3d063655604..d06b709f66d 100755
--- a/.utility/generate_apidiff_index_html.sh
+++ b/.utility/generate_apidiff_index_html.sh
@@ -17,7 +17,7 @@ echo '
IBM Watson Developer Cloud Java SDK API Diff
Info
- | Documentation
+ | Documentation
| API Diff
| GitHub
| Maven
diff --git a/.utility/generate_index_html.sh b/.utility/generate_index_html.sh
index 4c8e471ede4..deb818e6d58 100755
--- a/.utility/generate_index_html.sh
+++ b/.utility/generate_index_html.sh
@@ -18,7 +18,7 @@ echo '
Info
- | Documentation
+ | Documentation
| API Diff
| GitHub
| Maven
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100755
index 0141a356f47..00000000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1 +0,0 @@
-Moved to [https://github.com/watson-developer-cloud/java-sdk/wiki/Changelog](https://github.com/watson-developer-cloud/java-sdk/wiki/Changelog)
\ No newline at end of file
diff --git a/MIGRATION.md b/MIGRATION.md
index 3249733f932..51ad21545ae 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -1,3 +1,22 @@
+# v7.0.0
+Hello! If you're reading this, you're probably upgrading to **v7.0.0** of the Watson Java SDK. If that's the case, this guide will help you transition smoothly to get on board with the latest Watson API features in your Java code. Let's get started!
+
+## **Big** things
+### New library name
+For this release, we've changed package managers and decided to change the name along with it. Be sure to change this when upgrading by looking at the installation instructions in the README: https://github.com/watson-developer-cloud/java-sdk#installation
+
+### Response formats
+For a while now, we've had three main methods to execute an API call: `execute()`, `enqueue()`, and `rx()`. In our `v5.3.0` release, we added some variations of those methods to return not only the basic response model, but some added HTTP information like response headers.
+
+In this release, we've dropped those variants and instead have modified the base methods to always return the extra information. In addition, we've replaced `rx()` with `reactiveRequest()`, which lets you leverage [RxJava](https://github.com/ReactiveX/RxJava) to do some reactive programming if that's your thing.
+
+In short, the general structure of responses is different and you can read more about that [here](https://github.com/watson-developer-cloud/java-sdk#parsing-responses). If you're looking for making asynchronous API calls, you can read the details about that and the new `reactiveRequest()` method [here](https://github.com/watson-developer-cloud/java-sdk#making-asynchronous-api-calls).
+
+## Everything else
+Along with the major changes above, there have been more detailed breaking changes across services with API changes and updates to the SDK design. You can find these nitty-gritty details in the [release notes](https://github.com/watson-developer-cloud/java-sdk/releases/tag/java-sdk-7.0.0), along with the changes that are non-breaking.
+
+---
+
# 4.0
## Conversation
diff --git a/README.md b/README.md
index c9aa79c2f7a..73d21697b3a 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
[](https://travis-ci.org/watson-developer-cloud/java-sdk)
[](https://wdc-slack-inviter.mybluemix.net)
-[](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson.developer_cloud/java-sdk)
+[](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson/java-sdk)
[](https://cla-assistant.io/watson-developer-cloud/java-sdk)
Java client library to use the [Watson APIs][wdc].
@@ -20,6 +20,13 @@ Java client library to use the [Watson APIs][wdc].
* [IAM](#iam)
* [Username and password](#username-and-password)
* [API key](#api-key)
+ * [Using the SDK](#using-the-sdk)
+ * [Parsing responses](#parsing-responses)
+ * [Configuring the HTTP client](#configuring-the-http-client)
+ * [Making asynchronous API calls](#making-asynchronous-api-calls)
+ * [Default headers](#default-headers)
+ * [Sending request headers](#sending-request-headers)
+ * [FAQ](#faq)
* IBM Watson Services
* [Assistant](assistant)
* [Compare and Comply](compare-comply)
@@ -34,34 +41,87 @@ Java client library to use the [Watson APIs][wdc].
* [Tradeoff Analytics](tradeoff-analytics)
* [Visual Recognition](visual-recognition)
* [Android](#android)
- * [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)
- * [Specifying a service URL](#specifying-a-service-url)
- * [401 unauthorized error](#401-unauthorized-error)
- * [Changes for v4.0](#changes-for-v40)
* [Debug](#debug)
* [Eclipse and Intellij](#working-with-eclipse-and-intellij-idea)
* [License](#license)
* [Contributing](#contributing)
+ * [Featured projects](#featured-projects)
+:speaking_head: :speaking_head: :speaking_head:
+## Heads up!
+`v7.0.0` is out! Be sure to check out the [migration guide](https://github.com/watson-developer-cloud/java-sdk/blob/java-sdk-7.0.0/MIGRATION.md) for major breaking changes and the [release notes](https://github.com/watson-developer-cloud/java-sdk/releases/tag/java-sdk-7.0.0) for extra info.
+:speaking_head: :speaking_head: :speaking_head:
+
## Before you begin
* You need an [IBM Cloud][ibm-cloud-onboarding] account.
## Installation
##### Maven
+First, you'll need to edit your `settings.xml` file to target the right repository. Here's an example file configured to use the library:
+```xml
+
+
+
+
+
+
+
+ false
+
+
+
+ bintray-ibm-cloud-sdks-ibm-cloud-sdk-repo
+
+
+ bintray
+
+
+ https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo
+
+
+
+
+
+
+
+ false
+
+
+
+ bintray-ibm-cloud-sdks-ibm-cloud-sdk-repo
+
+
+ bintray-plugins
+
+
+ https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo
+
+
+
+
+ bintray
+
+
+
+
+
+ bintray
+
+
+
+```
+Then, you can add the dependencies in your project POM.
All the services:
```xml
- com.ibm.watson.developer_cloud
- java-sdk
- 6.14.0
+ com.ibm.watson
+ ibm-watson
+ 7.0.0
```
@@ -69,47 +129,34 @@ Only Discovery:
```xml
- com.ibm.watson.developer_cloud
+ com.ibm.watson
discovery
- 6.14.0
+ 7.0.0
```
##### Gradle
-
-All the services:
-
-```gradle
-'com.ibm.watson.developer_cloud:java-sdk:6.14.0'
-```
-
-Only Assistant:
-
+First, edit your repositories in your `build.gradle` file to target the right repository:
```gradle
-'com.ibm.watson.developer_cloud:assistant:6.14.0'
+repositories {
+ maven {
+ url "https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo"
+ }
+}
```
-##### Development snapshots
+Then, you can add the actual dependencies.
-Snapshots of the development version are available in [Sonatype's snapshots repository][sonatype_snapshots].
-
-###### Gradle
-
-Add repository to your project Gradle file
+All the services:
```gradle
-allprojects {
- repositories {
- maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
- }
-}
+'com.ibm.watson:ibm-watson:7.0.0'
```
-And then reference the snapshot version on your app module gradle
-Only Speech to Text:
+Only Assistant:
```gradle
-'com.ibm.watson.developer_cloud:speech-to-text:6.14.1-SNAPSHOT'
+'com.ibm.watson:assistant:7.0.0'
```
##### JAR
@@ -138,8 +185,6 @@ Watson services are migrating to token-based Identity and Access Management (IAM
- With some service instances, you authenticate to the API by using **[IAM](#iam)**.
- In other instances, you authenticate by providing the **[username and password](#username-and-password)** for the service instance.
-**Note:** Previously, it was possible to authenticate using a token in a header called `X-Watson-Authorization-Token`. This method is deprecated. The token continues to work with Cloud Foundry services, but is not supported for services that use Identity and Access Management (IAM) authentication. See [here](#iam) for details.
-
### Getting credentials
To find out which authentication to use, view the service credentials. You find the service credentials for authentication the same way for all Watson services:
@@ -203,7 +248,7 @@ Supplying the IAM API key:
// in the constructor, letting the SDK manage the IAM token
IamOptions options = new IamOptions.Builder()
.apiKey("")
- .url("") // optional - the default value is https://iam.bluemix.net/identity/token
+ .url("") // optional - the default value is https://iam.cloud.ibm.com/identity/token
.build();
Discovery service = new Discovery("2017-11-07", options);
```
@@ -249,11 +294,28 @@ Discovery service = new Discovery("2017-11-07");
service.setUsernameAndPassword("", "");
```
-## Android
+## Using the SDK
+
+### Parsing responses
+
+No matter which method you use to make an API request (`execute()`, `enqueue()`, or `reactiveRequest()`), you'll get back an object of form `Response`, where `T` is the model representing the specific response model.
+
+Here's an example of how to parse that response and get additional information beyond the response model:
+
+```java
+// listing our workspaces with an instance of the Assistant v1 service
+Response response = service.listWorkspaces().execute();
+
+// pulling out the specific API method response, which we can manipulate as usual
+WorkspaceCollection collection = response.getResult();
+System.out.println("My workspaces: " + collection.getWorkspaces());
-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][].
+// grabbing headers that came back with our API response
+Headers responseHeaders = response.getHeaders();
+System.out.println("Response header names: " + responseHeaders.names());
+```
-## Configuring the HTTP client
+### Configuring the HTTP client
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!) ⚠️
@@ -273,48 +335,55 @@ HttpConfigOptions options = new HttpConfigOptions.Builder()
service.configureClient(options);
```
-## Sending request headers
-
-Custom headers can be passed with any request. To do so, add the header to the `ServiceCall` object before executing the request. For example, this is what it looks like to send the header `Custom-Header` along with a call to the Watson Assistant service:
+### Making asynchronous API calls
+The basic, synchronous way to make API calls with this SDK is through the use of the `execute()` method. Using this method looks something like this:
```java
-WorkspaceCollection workspaces = service.listWorkspaces()
- .addHeader("Custom-Header", "custom_value")
- .execute();
-```
+// make API call
+Response response = service.listEnvironments().execute();
-## Parsing HTTP response info
+// continue execution
+```
-The basic `execute()`, `enqueue()`, and `rx()` methods make HTTP requests to your Watson service and return models based on the requested endpoint. If you would like access to some HTTP response information along with the response model, you can use the more detailed versions of those three methods: `executeWithDetails()`, `enqueueWithDetails()`, and `rxWithDetails()`. To capture the responses, use the new `Response` class, with `T` being the expected response model.
+However, if you need to perform these calls in the background, there are two other methods to do this asynchronously: `enqueue()` and `reactiveRequest()`.
-Here is an example of calling the Watson Assistant `listWorkspaces()` method and parsing its response model as well as the response headers:
+#### `enqueue()`
+This method allows you to set a callback for the service response through the use of the `ServiceCallback` object. Here's an example:
```java
-Response response = service.listWorkspaces().executeWithDetails();
+// make API call in the background
+service.listEnvironments().enqueue(new ServiceCallback() {
+ @Override
+ public void onResponse(Response response) {
+ System.out.println("We did it! " + response);
+ }
-// getting result equivalent to execute()
-WorkspaceCollection workspaces = response.getResult();
+ @Override
+ public void onFailure(Exception e) {
+ System.out.println("Whoops...");
+ }
+});
-// getting returned HTTP headers
-Headers responseHeaders = response.getHeaders();
+// continue working in the meantime!
```
-Note that when using `enqueueWithDetails()`, you must also implement the new `ServiceCallbackWithDetails` interface. For example:
+#### `reactiveRequest()`
+If you're a fan of the [RxJava](https://github.com/ReactiveX/RxJava) library, this method lets you leverage that to allow for "reactive" programming. The method will return a `Single` which you can manipulate how you please. Example:
```java
-service.listWorkspaces().enqueueWithDetails(new ServiceCallbackWithDetails() {
- @Override
- public void onResponse(Response response) {
- WorkspaceCollection workspaces = response.getResult();
- Headers responseHeaders = response.getHeaders();
- }
+// get stream with request
+Single> observableRequest
+ = service.listEnvironments().reactiveRequest();
- @Override
- public void onFailure(Exception e) { }
-});
+// make API call in the background
+observableRequest
+ .subscribeOn(Schedulers.single())
+ .subscribe(response -> System.out.println("We did it with s~t~r~e~a~m~s! " + response));
+
+// continue working in the meantime!
```
-## Default headers
+### Default headers
Default headers can be specified at any time by using the `setDefaultHeaders(Map headers)` method.
@@ -324,32 +393,30 @@ The example below sends the `X-Watson-Learning-Opt-Out` header in every request
PersonalityInsights service = new PersonalityInsights("2016-10-19");
Map headers = new HashMap();
-headers.put(HttpHeaders.X_WATSON_LEARNING_OPT_OUT, "true");
+headers.put(WatsonHttpHeaders.X_WATSON_LEARNING_OPT_OUT, "true");
service.setDefaultHeaders(headers);
// All the api calls from now on will send the default headers
```
-## Specifying a service URL
-
-You can set the correct API endpoint for your service calling `setEndPoint()`.
+### Sending request headers
-For example, if you have the Discovery service in Germany, the endpoint may be `https://gateway-fra.watsonplatform.net/discovery/api`.
-
-You will need to call
+Custom headers can be passed with any request. To do so, add the header to the `ServiceCall` object before executing the request. For example, this is what it looks like to send the header `Custom-Header` along with a call to the Watson Assistant service:
```java
-Discovery service = new Discovery("2017-11-07");
-service.sentEndPoint("https://gateway-fra.watsonplatform.net/discovery/api")
+Response workspaces = service.listWorkspaces()
+ .addHeader("Custom-Header", "custom_value")
+ .execute();
```
-## 401 unauthorized error
+## FAQ
+
+### Does this SDK play well with Android?
-Make sure you are using the service credentials and not your IBM Cloud account/password.
-Check the API endpoint, you may need to update the default using `setEndPoint()`.
+It does! You should be able to plug this dependency into your Android app without any issue. In addition, we have an Android SDK meant to be used with this library that adds some Android-specific functionality, which you can find [here](https://github.com/watson-developer-cloud/android-sdk).
-## Debug
+### How does debugging work?
HTTP requests can be logged by adding a `logging.properties` file to your classpath.
@@ -380,65 +447,25 @@ INFO: <-- 200 OK https://gateway.watsonplatform.net/tradeoff-analytics/api/v1/di
**Warning:** The logs generated by this logger when using the level `FINE` or `ALL` has the potential to leak sensitive information such as "Authorization" or "Cookie" headers and the contents of request and response bodies. This data should only be logged in a controlled way or in a non-production environment.
-## Build + test
-
-To build and test the project you can use [Gradle][] (version 1.x).
-
-Gradle:
-
-```sh
-cd java-sdk
-gradle jar # build jar file (build/libs/watson-developer-cloud-6.14.0.jar)
-gradle test # run tests
-gradle check # performs quality checks on source files and generates reports
-gradle testReport # run tests and generate the aggregated test report (build/reports/allTests)
-gradle codeCoverageReport # run tests and generate the code coverage report (build/reports/jacoco)
-```
-
-## Working with Eclipse and Intellij IDEA
-
-If you want to work on the code in an IDE instead of a text editor you can
-easily create project files with gradle:
-
-```sh
-gradle idea # Intellij IDEA
-gradle eclipse # Eclipse
-```
-
-## Open source @ IBM
-
-Find more open source projects on the [IBM Github Page](http://ibm.github.io/)
-
-## License
-
-This library is licensed under Apache 2.0. Full license text is
-available in [LICENSE](LICENSE).
-
-## Contributing
-
-See [CONTRIBUTING.md](.github/CONTRIBUTING.md).
+### How can I contribute?
-## Code of conduct
+Great question (and please do)! You can find contributing information [here](.github/CONTRIBUTING.md).
-See [CODE_OF_CONDUCT.md](.github/CODE_OF_CONDUCT.md).
+### Where can I get more help with using Watson APIs?
-### Other
+If you have a question about/problem with using the Watson APIs in general, feel free to ask a question on [dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson) or trusty [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
-If you are having difficulties using the APIs or you have a question about the IBM
-Watson Services, please ask a question on
-[dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson)
-or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
+### Does IBM have any other open source work?
+We do :sunglasses: http://ibm.github.io/
[wdc]: https://www.ibm.com/watson/developer/
[ibm_cloud]: https://cloud.ibm.com
-[Gradle]: http://www.gradle.org/
-[OkHttp]: http://square.github.io/okhttp/
-[gson]: https://github.com/google/gson
[apache_maven]: http://maven.apache.org/
-[sonatype_snapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/ibm/watson/developer_cloud/
[vcap_services]: https://cloud.ibm.com/docs/services/watson/getting-started-variables.html
[ibm-cloud-onboarding]: http://cloud.ibm.com/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Java
+## Featured projects
+We'd love to highlight cool open-source projects that use this SDK! If you'd like to get your project added to the list, feel free to make an issue linking us to it.
-[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-6.14.0/java-sdk-6.14.0-jar-with-dependencies.jar
+[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-7.0.0/ibm-watson-7.0.0-jar-with-dependencies.jar
diff --git a/assistant/README.md b/assistant/README.md
index 11d12c7c72c..a5ffe693fd3 100644
--- a/assistant/README.md
+++ b/assistant/README.md
@@ -5,15 +5,15 @@
##### Maven
```xml
- com.ibm.watson.developer_cloud
+ com.ibm.watson
assistant
- 6.14.0
+ 7.0.0
```
##### Gradle
```gradle
-'com.ibm.watson.developer_cloud:assistant:6.14.0'
+'com.ibm.watson:assistant:7.0.0'
```
## Usage
@@ -22,44 +22,51 @@ Use the [Assistant][assistant] service to identify intents, entities, and conduc
### Using Assistant v1
```java
// make sure to use the Assistant v1 import!
-import com.ibm.watson.developer_cloud.assistant.v1.Assistant;
+import com.ibm.watson.assistant.v1.Assistant;
Assistant service = new Assistant("2018-02-16");
-service.setUsernameAndPassword("", "");
+IamOptions options = new IamOptions.Builder()
+ .apiKey("")
+ .build();
+service.setIamCredentials(options);
-InputData input = new InputData.Builder("Hi").build();
+MessageInput input = new MessageInput();
+input.setText("Hi");
MessageOptions options = new MessageOptions.Builder(workspaceId)
.input(input)
.build();
-MessageResponse response = service.message(options).execute();
+MessageResponse response = service.message(options).execute().getResult();
System.out.println(response);
```
Maintaining context across messages:
```java
// make sure to use the Assistant v1 import!
-import com.ibm.watson.developer_cloud.assistant.v1.Assistant;
+import com.ibm.watson.assistant.v1.Assistant;
Context context = null;
+MessageInput input = new MessageInput();
// first message
+input.setText("First message");
MessageOptions newMessageOptions = new MessageOptions.Builder()
.workspaceId("")
- .input(new InputData.Builder("First message").build())
+ .input(input)
.context(context)
.build();
-MessageResponse response = service.message(newMessageOptions).execute();
+MessageResponse response = service.message(newMessageOptions).execute().getResult();
context = response.getContext();
// second message
+input.setText("Second message");
newMessageOptions = new MessageOptions.Builder()
.workspaceId("")
- .input(new InputData.Builder("Second message").build())
+ .input(input)
.context(context) // using context from the first message
.build();
-response = service.message(newMessageOptions).execute();
+response = service.message(newMessageOptions).execute().getResult();
System.out.println(response);
```
@@ -69,10 +76,13 @@ 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;
+import com.ibm.watson.assistant.v2.Assistant;
Assistant service = new Assistant("2018-09-20");
-service.setUsernameAndPassword("", "");
+IamOptions options = new IamOptions.Builder()
+ .apiKey("")
+ .build();
+service.setIamCredentials(options);
MessageInput input = new MessageInput.Builder()
.text("Hi")
@@ -82,7 +92,7 @@ MessageOptions messageOptions = new MessageOptions.Builder()
.sessionId("")
.input(input)
.build();
-MessageResponse messageResponse = service.message(messageOptions).execute();
+MessageResponse messageResponse = service.message(messageOptions).execute().getResult();
System.out.println(messageResponse);
```
@@ -90,7 +100,7 @@ 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;
+import com.ibm.watson.assistant.v2.Assistant;
MessageContext context = new MessageContext();
@@ -105,7 +115,7 @@ MessageOptions messageOptions = new MessageOptions.Builder()
.context(context)
.build();
-MessageResponse messageResponse = service.message(messageOptions).execute();
+MessageResponse messageResponse = service.message(messageOptions).execute().getResult();
context = messageResponse.getContext();
// second message
@@ -119,8 +129,8 @@ messageOptions = new MessageOptions.Builder()
.context(context) // using context from first message
.build();
-messageResponse = service.message(messageOptions).execute();
+messageResponse = service.message(messageOptions).execute().getResult();
System.out.println(messageResponse);
```
-[assistant]: https://console.bluemix.net/docs/services/assistant/index.html
+[assistant]: https://cloud.ibm.com/docs/services/assistant?topic=assistant-index
diff --git a/assistant/build.gradle b/assistant/build.gradle
index 08be8b1b90d..1e65d17f5be 100644
--- a/assistant/build.gradle
+++ b/assistant/build.gradle
@@ -14,6 +14,8 @@ apply plugin: 'signing'
apply plugin: 'checkstyle'
apply plugin: 'eclipse'
+project.tasks.assemble.dependsOn project.tasks.shadowJar
+
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
@@ -55,9 +57,9 @@ checkstyle {
}
dependencies {
- compile project(':core')
-
- testCompile project(path: ':core', configuration: 'tests')
+ compile project(':common')
+ testCompile project(':common').sourceSets.test.output
+ compile 'com.ibm.cloud:sdk-core:3.0.2'
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
}
@@ -68,45 +70,4 @@ processResources {
]
}
-uploadArchives {
- repositories {
- mavenDeployer {
- beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-
- repository(url: "http://oss.sonatype.org/service/local/staging/deploy/maven2/") {
- authentication(userName: System.env.CI_DEPLOY_USERNAME, password: System.env.CI_DEPLOY_PASSWORD)
- }
- snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/"){
- authentication(userName: System.env.CI_DEPLOY_USERNAME, password: System.env.CI_DEPLOY_PASSWORD)
- }
- pom.project {
- name 'conversation'
- packaging 'jar'
- // optionally artifactId can be defined here
- description 'Client library to use the IBM Watson Assistant Service'
- url 'https://console.bluemix.net/docs/services/assistant/index.html'
-
- scm {
- connection 'scm:git:git@github.com:watson-developer-cloud/java-sdk.git'
- developerConnection 'scm:git:git@github.com:watson-developer-cloud/java-sdk.git'
- url 'https://github.com/watson-developer-cloud/java-sdk'
- }
-
- licenses {
- license {
- name 'The Apache License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- }
- }
-
- developers {
- developer {
- id 'german'
- name 'German Attanasio'
- email 'germanatt@us.ibm.com'
- }
- }
- }
- }
- }
-}
+apply from: rootProject.file('.utility/bintray-properties.gradle')
diff --git a/assistant/gradle.properties b/assistant/gradle.properties
new file mode 100644
index 00000000000..72e0aa5bdd0
--- /dev/null
+++ b/assistant/gradle.properties
@@ -0,0 +1,4 @@
+PACKAGE_NAME=com.ibm.watson:assistant
+ARTIFACT_ID=assistant
+NAME=IBM Watson Java SDK - Assistant
+DESCRIPTION=Java client library to use the IBM Assistant API
\ No newline at end of file
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java
similarity index 78%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/Assistant.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java
index d71256e70bc..52dbdf3d5dd 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/Assistant.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java
@@ -10,84 +10,83 @@
* 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.v1;
+package com.ibm.watson.assistant.v1;
import com.google.gson.JsonObject;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Counterexample;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CounterexampleCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateCounterexampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateDialogNodeOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateEntityOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateExampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateIntentOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateSynonymOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateValueOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.CreateWorkspaceOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteCounterexampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteDialogNodeOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteEntityOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteExampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteIntentOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteSynonymOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteUserDataOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteValueOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DeleteWorkspaceOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DialogNode;
-import com.ibm.watson.developer_cloud.assistant.v1.model.DialogNodeCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Entity;
-import com.ibm.watson.developer_cloud.assistant.v1.model.EntityCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.EntityExport;
-import com.ibm.watson.developer_cloud.assistant.v1.model.EntityMentionCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Example;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ExampleCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetCounterexampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetDialogNodeOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetEntityOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetExampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetIntentOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetSynonymOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetValueOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.GetWorkspaceOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Intent;
-import com.ibm.watson.developer_cloud.assistant.v1.model.IntentCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.IntentExport;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListAllLogsOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListCounterexamplesOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListDialogNodesOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListEntitiesOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListExamplesOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListIntentsOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListLogsOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListMentionsOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListSynonymsOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ListValuesOptions;
-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.MessageOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.MessageResponse;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Synonym;
-import com.ibm.watson.developer_cloud.assistant.v1.model.SynonymCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateCounterexampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateDialogNodeOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateEntityOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateExampleOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateIntentOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateSynonymOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateValueOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.UpdateWorkspaceOptions;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Value;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ValueCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.ValueExport;
-import com.ibm.watson.developer_cloud.assistant.v1.model.Workspace;
-import com.ibm.watson.developer_cloud.assistant.v1.model.WorkspaceCollection;
-import com.ibm.watson.developer_cloud.assistant.v1.model.WorkspaceExport;
-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;
+import com.ibm.cloud.sdk.core.http.RequestBuilder;
+import com.ibm.cloud.sdk.core.http.ServiceCall;
+import com.ibm.cloud.sdk.core.service.BaseService;
+import com.ibm.cloud.sdk.core.service.security.IamOptions;
+import com.ibm.cloud.sdk.core.util.GsonSingleton;
+import com.ibm.cloud.sdk.core.util.ResponseConverterUtils;
+import com.ibm.cloud.sdk.core.util.Validator;
+import com.ibm.watson.assistant.v1.model.Counterexample;
+import com.ibm.watson.assistant.v1.model.CounterexampleCollection;
+import com.ibm.watson.assistant.v1.model.CreateCounterexampleOptions;
+import com.ibm.watson.assistant.v1.model.CreateDialogNodeOptions;
+import com.ibm.watson.assistant.v1.model.CreateEntityOptions;
+import com.ibm.watson.assistant.v1.model.CreateExampleOptions;
+import com.ibm.watson.assistant.v1.model.CreateIntentOptions;
+import com.ibm.watson.assistant.v1.model.CreateSynonymOptions;
+import com.ibm.watson.assistant.v1.model.CreateValueOptions;
+import com.ibm.watson.assistant.v1.model.CreateWorkspaceOptions;
+import com.ibm.watson.assistant.v1.model.DeleteCounterexampleOptions;
+import com.ibm.watson.assistant.v1.model.DeleteDialogNodeOptions;
+import com.ibm.watson.assistant.v1.model.DeleteEntityOptions;
+import com.ibm.watson.assistant.v1.model.DeleteExampleOptions;
+import com.ibm.watson.assistant.v1.model.DeleteIntentOptions;
+import com.ibm.watson.assistant.v1.model.DeleteSynonymOptions;
+import com.ibm.watson.assistant.v1.model.DeleteUserDataOptions;
+import com.ibm.watson.assistant.v1.model.DeleteValueOptions;
+import com.ibm.watson.assistant.v1.model.DeleteWorkspaceOptions;
+import com.ibm.watson.assistant.v1.model.DialogNode;
+import com.ibm.watson.assistant.v1.model.DialogNodeCollection;
+import com.ibm.watson.assistant.v1.model.Entity;
+import com.ibm.watson.assistant.v1.model.EntityCollection;
+import com.ibm.watson.assistant.v1.model.EntityMentionCollection;
+import com.ibm.watson.assistant.v1.model.Example;
+import com.ibm.watson.assistant.v1.model.ExampleCollection;
+import com.ibm.watson.assistant.v1.model.GetCounterexampleOptions;
+import com.ibm.watson.assistant.v1.model.GetDialogNodeOptions;
+import com.ibm.watson.assistant.v1.model.GetEntityOptions;
+import com.ibm.watson.assistant.v1.model.GetExampleOptions;
+import com.ibm.watson.assistant.v1.model.GetIntentOptions;
+import com.ibm.watson.assistant.v1.model.GetSynonymOptions;
+import com.ibm.watson.assistant.v1.model.GetValueOptions;
+import com.ibm.watson.assistant.v1.model.GetWorkspaceOptions;
+import com.ibm.watson.assistant.v1.model.Intent;
+import com.ibm.watson.assistant.v1.model.IntentCollection;
+import com.ibm.watson.assistant.v1.model.ListAllLogsOptions;
+import com.ibm.watson.assistant.v1.model.ListCounterexamplesOptions;
+import com.ibm.watson.assistant.v1.model.ListDialogNodesOptions;
+import com.ibm.watson.assistant.v1.model.ListEntitiesOptions;
+import com.ibm.watson.assistant.v1.model.ListExamplesOptions;
+import com.ibm.watson.assistant.v1.model.ListIntentsOptions;
+import com.ibm.watson.assistant.v1.model.ListLogsOptions;
+import com.ibm.watson.assistant.v1.model.ListMentionsOptions;
+import com.ibm.watson.assistant.v1.model.ListSynonymsOptions;
+import com.ibm.watson.assistant.v1.model.ListValuesOptions;
+import com.ibm.watson.assistant.v1.model.ListWorkspacesOptions;
+import com.ibm.watson.assistant.v1.model.LogCollection;
+import com.ibm.watson.assistant.v1.model.MessageOptions;
+import com.ibm.watson.assistant.v1.model.MessageResponse;
+import com.ibm.watson.assistant.v1.model.Synonym;
+import com.ibm.watson.assistant.v1.model.SynonymCollection;
+import com.ibm.watson.assistant.v1.model.UpdateCounterexampleOptions;
+import com.ibm.watson.assistant.v1.model.UpdateDialogNodeOptions;
+import com.ibm.watson.assistant.v1.model.UpdateEntityOptions;
+import com.ibm.watson.assistant.v1.model.UpdateExampleOptions;
+import com.ibm.watson.assistant.v1.model.UpdateIntentOptions;
+import com.ibm.watson.assistant.v1.model.UpdateSynonymOptions;
+import com.ibm.watson.assistant.v1.model.UpdateValueOptions;
+import com.ibm.watson.assistant.v1.model.UpdateWorkspaceOptions;
+import com.ibm.watson.assistant.v1.model.Value;
+import com.ibm.watson.assistant.v1.model.ValueCollection;
+import com.ibm.watson.assistant.v1.model.Workspace;
+import com.ibm.watson.assistant.v1.model.WorkspaceCollection;
+import com.ibm.watson.common.SdkCommon;
+import java.util.Map;
+import java.util.Map.Entry;
/**
* The IBM Watson™ Assistant service combines machine learning, natural language understanding, and integrated
@@ -96,7 +95,7 @@
* @version v1
* @see Assistant
*/
-public class Assistant extends WatsonService {
+public class Assistant extends BaseService {
private static final String SERVICE_NAME = "assistant";
private static final String URL = "https://gateway.watsonplatform.net/assistant/api";
@@ -165,8 +164,12 @@ public ServiceCall message(MessageOptions messageOptions) {
String[] pathParameters = { messageOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=message");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "message");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (messageOptions.nodesVisitedDetails() != null) {
builder.query("nodes_visited_details", String.valueOf(messageOptions.nodesVisitedDetails()));
}
@@ -174,18 +177,18 @@ public ServiceCall message(MessageOptions messageOptions) {
if (messageOptions.input() != null) {
contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input()));
}
+ if (messageOptions.intents() != null) {
+ contentJson.add("intents", GsonSingleton.getGson().toJsonTree(messageOptions.intents()));
+ }
+ if (messageOptions.entities() != null) {
+ contentJson.add("entities", GsonSingleton.getGson().toJsonTree(messageOptions.entities()));
+ }
if (messageOptions.alternateIntents() != null) {
contentJson.addProperty("alternate_intents", messageOptions.alternateIntents());
}
if (messageOptions.context() != null) {
contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context()));
}
- if (messageOptions.entities() != null) {
- contentJson.add("entities", GsonSingleton.getGson().toJsonTree(messageOptions.entities()));
- }
- if (messageOptions.intents() != null) {
- contentJson.add("intents", GsonSingleton.getGson().toJsonTree(messageOptions.intents()));
- }
if (messageOptions.output() != null) {
contentJson.add("output", GsonSingleton.getGson().toJsonTree(messageOptions.output()));
}
@@ -207,9 +210,12 @@ public ServiceCall message(MessageOptions messageOptions) {
public ServiceCall createWorkspace(CreateWorkspaceOptions createWorkspaceOptions) {
String[] pathSegments = { "v1/workspaces" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=createWorkspace");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createWorkspace");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (createWorkspaceOptions != null) {
final JsonObject contentJson = new JsonObject();
if (createWorkspaceOptions.name() != null) {
@@ -221,6 +227,15 @@ public ServiceCall createWorkspace(CreateWorkspaceOptions createWorks
if (createWorkspaceOptions.language() != null) {
contentJson.addProperty("language", createWorkspaceOptions.language());
}
+ if (createWorkspaceOptions.metadata() != null) {
+ contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.metadata()));
+ }
+ if (createWorkspaceOptions.learningOptOut() != null) {
+ contentJson.addProperty("learning_opt_out", createWorkspaceOptions.learningOptOut());
+ }
+ if (createWorkspaceOptions.systemSettings() != null) {
+ contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.systemSettings()));
+ }
if (createWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.intents()));
}
@@ -234,15 +249,6 @@ public ServiceCall createWorkspace(CreateWorkspaceOptions createWorks
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions
.counterexamples()));
}
- if (createWorkspaceOptions.metadata() != null) {
- contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.metadata()));
- }
- if (createWorkspaceOptions.learningOptOut() != null) {
- contentJson.addProperty("learning_opt_out", createWorkspaceOptions.learningOptOut());
- }
- if (createWorkspaceOptions.systemSettings() != null) {
- contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.systemSettings()));
- }
builder.bodyJson(contentJson);
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
@@ -278,9 +284,12 @@ public ServiceCall deleteWorkspace(DeleteWorkspaceOptions deleteWorkspaceO
String[] pathParameters = { deleteWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteWorkspace");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteWorkspace");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -293,17 +302,20 @@ public ServiceCall deleteWorkspace(DeleteWorkspaceOptions deleteWorkspaceO
* limit is 20 requests per 30 minutes. For more information, see **Rate limiting**.
*
* @param getWorkspaceOptions the {@link GetWorkspaceOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link WorkspaceExport}
+ * @return a {@link ServiceCall} with a response type of {@link Workspace}
*/
- public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspaceOptions) {
+ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspaceOptions) {
Validator.notNull(getWorkspaceOptions, "getWorkspaceOptions cannot be null");
String[] pathSegments = { "v1/workspaces" };
String[] pathParameters = { getWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=getWorkspace");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getWorkspace");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getWorkspaceOptions.export() != null) {
builder.query("export", String.valueOf(getWorkspaceOptions.export()));
}
@@ -313,7 +325,7 @@ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspac
if (getWorkspaceOptions.sort() != null) {
builder.query("sort", getWorkspaceOptions.sort());
}
- return createServiceCall(builder.build(), ResponseConverterUtils.getObject(WorkspaceExport.class));
+ return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
}
/**
@@ -329,9 +341,12 @@ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspac
public ServiceCall listWorkspaces(ListWorkspacesOptions listWorkspacesOptions) {
String[] pathSegments = { "v1/workspaces" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=listWorkspaces");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listWorkspaces");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listWorkspacesOptions != null) {
if (listWorkspacesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listWorkspacesOptions.pageLimit()));
@@ -382,9 +397,12 @@ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorks
String[] pathParameters = { updateWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=updateWorkspace");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateWorkspace");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (updateWorkspaceOptions.append() != null) {
builder.query("append", String.valueOf(updateWorkspaceOptions.append()));
}
@@ -398,6 +416,15 @@ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorks
if (updateWorkspaceOptions.language() != null) {
contentJson.addProperty("language", updateWorkspaceOptions.language());
}
+ if (updateWorkspaceOptions.metadata() != null) {
+ contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.metadata()));
+ }
+ if (updateWorkspaceOptions.learningOptOut() != null) {
+ contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut());
+ }
+ if (updateWorkspaceOptions.systemSettings() != null) {
+ contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings()));
+ }
if (updateWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.intents()));
}
@@ -410,15 +437,6 @@ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorks
if (updateWorkspaceOptions.counterexamples() != null) {
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.counterexamples()));
}
- if (updateWorkspaceOptions.metadata() != null) {
- contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.metadata()));
- }
- if (updateWorkspaceOptions.learningOptOut() != null) {
- contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut());
- }
- if (updateWorkspaceOptions.systemSettings() != null) {
- contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings()));
- }
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
}
@@ -439,9 +457,12 @@ public ServiceCall createIntent(CreateIntentOptions createIntentOptions)
String[] pathParameters = { createIntentOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=createIntent");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createIntent");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("intent", createIntentOptions.intent());
if (createIntentOptions.description() != null) {
@@ -470,9 +491,12 @@ public ServiceCall deleteIntent(DeleteIntentOptions deleteIntentOptions) {
String[] pathParameters = { deleteIntentOptions.workspaceId(), deleteIntentOptions.intent() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteIntent");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteIntent");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -485,23 +509,27 @@ public ServiceCall deleteIntent(DeleteIntentOptions deleteIntentOptions) {
* limit is 400 requests per 30 minutes. For more information, see **Rate limiting**.
*
* @param getIntentOptions the {@link GetIntentOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link IntentExport}
+ * @return a {@link ServiceCall} with a response type of {@link Intent}
*/
- public ServiceCall getIntent(GetIntentOptions getIntentOptions) {
+ public ServiceCall getIntent(GetIntentOptions getIntentOptions) {
Validator.notNull(getIntentOptions, "getIntentOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { getIntentOptions.workspaceId(), getIntentOptions.intent() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=getIntent");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getIntent");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getIntentOptions.export() != null) {
builder.query("export", String.valueOf(getIntentOptions.export()));
}
if (getIntentOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getIntentOptions.includeAudit()));
}
- return createServiceCall(builder.build(), ResponseConverterUtils.getObject(IntentExport.class));
+ return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
}
/**
@@ -521,8 +549,12 @@ public ServiceCall listIntents(ListIntentsOptions listIntentsO
String[] pathParameters = { listIntentsOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=listIntents");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listIntents");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listIntentsOptions.export() != null) {
builder.query("export", String.valueOf(listIntentsOptions.export()));
}
@@ -561,19 +593,22 @@ public ServiceCall updateIntent(UpdateIntentOptions updateIntentOptions)
String[] pathParameters = { updateIntentOptions.workspaceId(), updateIntentOptions.intent() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=updateIntent");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateIntent");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateIntentOptions.newIntent() != null) {
contentJson.addProperty("intent", updateIntentOptions.newIntent());
}
- if (updateIntentOptions.newExamples() != null) {
- contentJson.add("examples", GsonSingleton.getGson().toJsonTree(updateIntentOptions.newExamples()));
- }
if (updateIntentOptions.newDescription() != null) {
contentJson.addProperty("description", updateIntentOptions.newDescription());
}
+ if (updateIntentOptions.newExamples() != null) {
+ contentJson.add("examples", GsonSingleton.getGson().toJsonTree(updateIntentOptions.newExamples()));
+ }
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
}
@@ -594,9 +629,12 @@ public ServiceCall createExample(CreateExampleOptions createExampleOpti
String[] pathParameters = { createExampleOptions.workspaceId(), createExampleOptions.intent() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=createExample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createExample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", createExampleOptions.text());
if (createExampleOptions.mentions() != null) {
@@ -623,9 +661,12 @@ public ServiceCall deleteExample(DeleteExampleOptions deleteExampleOptions
.text() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteExample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteExample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -645,8 +686,12 @@ public ServiceCall getExample(GetExampleOptions getExampleOptions) {
String[] pathParameters = { getExampleOptions.workspaceId(), getExampleOptions.intent(), getExampleOptions.text() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=getExample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getExample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getExampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getExampleOptions.includeAudit()));
}
@@ -669,9 +714,12 @@ public ServiceCall listExamples(ListExamplesOptions listExamp
String[] pathParameters = { listExamplesOptions.workspaceId(), listExamplesOptions.intent() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=listExamples");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listExamples");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listExamplesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listExamplesOptions.pageLimit()));
}
@@ -707,9 +755,12 @@ public ServiceCall updateExample(UpdateExampleOptions updateExampleOpti
.text() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=updateExample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateExample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateExampleOptions.newText() != null) {
contentJson.addProperty("text", updateExampleOptions.newText());
@@ -737,9 +788,12 @@ public ServiceCall createCounterexample(CreateCounterexampleOpti
String[] pathParameters = { createCounterexampleOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=createCounterexample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createCounterexample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", createCounterexampleOptions.text());
builder.bodyJson(contentJson);
@@ -762,9 +816,12 @@ public ServiceCall deleteCounterexample(DeleteCounterexampleOptions delete
String[] pathParameters = { deleteCounterexampleOptions.workspaceId(), deleteCounterexampleOptions.text() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteCounterexample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteCounterexample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -784,9 +841,12 @@ public ServiceCall getCounterexample(GetCounterexampleOptions ge
String[] pathParameters = { getCounterexampleOptions.workspaceId(), getCounterexampleOptions.text() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=getCounterexample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getCounterexample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getCounterexampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getCounterexampleOptions.includeAudit()));
}
@@ -810,9 +870,12 @@ public ServiceCall listCounterexamples(
String[] pathParameters = { listCounterexamplesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=listCounterexamples");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listCounterexamples");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listCounterexamplesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listCounterexamplesOptions.pageLimit()));
}
@@ -847,9 +910,12 @@ public ServiceCall updateCounterexample(UpdateCounterexampleOpti
String[] pathParameters = { updateCounterexampleOptions.workspaceId(), updateCounterexampleOptions.text() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=updateCounterexample");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateCounterexample");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateCounterexampleOptions.newText() != null) {
contentJson.addProperty("text", updateCounterexampleOptions.newText());
@@ -874,9 +940,12 @@ public ServiceCall createEntity(CreateEntityOptions createEntityOptions)
String[] pathParameters = { createEntityOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=createEntity");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createEntity");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("entity", createEntityOptions.entity());
if (createEntityOptions.description() != null) {
@@ -885,12 +954,12 @@ public ServiceCall createEntity(CreateEntityOptions createEntityOptions)
if (createEntityOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createEntityOptions.metadata()));
}
- if (createEntityOptions.values() != null) {
- contentJson.add("values", GsonSingleton.getGson().toJsonTree(createEntityOptions.values()));
- }
if (createEntityOptions.fuzzyMatch() != null) {
contentJson.addProperty("fuzzy_match", createEntityOptions.fuzzyMatch());
}
+ if (createEntityOptions.values() != null) {
+ contentJson.add("values", GsonSingleton.getGson().toJsonTree(createEntityOptions.values()));
+ }
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
}
@@ -911,9 +980,12 @@ public ServiceCall deleteEntity(DeleteEntityOptions deleteEntityOptions) {
String[] pathParameters = { deleteEntityOptions.workspaceId(), deleteEntityOptions.entity() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteEntity");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteEntity");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -926,23 +998,27 @@ public ServiceCall deleteEntity(DeleteEntityOptions deleteEntityOptions) {
* limit is 200 requests per 30 minutes. For more information, see **Rate limiting**.
*
* @param getEntityOptions the {@link GetEntityOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link EntityExport}
+ * @return a {@link ServiceCall} with a response type of {@link Entity}
*/
- public ServiceCall getEntity(GetEntityOptions getEntityOptions) {
+ public ServiceCall getEntity(GetEntityOptions getEntityOptions) {
Validator.notNull(getEntityOptions, "getEntityOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { getEntityOptions.workspaceId(), getEntityOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=getEntity");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getEntity");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getEntityOptions.export() != null) {
builder.query("export", String.valueOf(getEntityOptions.export()));
}
if (getEntityOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getEntityOptions.includeAudit()));
}
- return createServiceCall(builder.build(), ResponseConverterUtils.getObject(EntityExport.class));
+ return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
}
/**
@@ -962,9 +1038,12 @@ public ServiceCall listEntities(ListEntitiesOptions listEntiti
String[] pathParameters = { listEntitiesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=listEntities");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listEntities");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listEntitiesOptions.export() != null) {
builder.query("export", String.valueOf(listEntitiesOptions.export()));
}
@@ -1003,25 +1082,28 @@ public ServiceCall updateEntity(UpdateEntityOptions updateEntityOptions)
String[] pathParameters = { updateEntityOptions.workspaceId(), updateEntityOptions.entity() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=updateEntity");
- final JsonObject contentJson = new JsonObject();
- if (updateEntityOptions.newFuzzyMatch() != null) {
- contentJson.addProperty("fuzzy_match", updateEntityOptions.newFuzzyMatch());
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateEntity");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
}
+ builder.header("Accept", "application/json");
+ final JsonObject contentJson = new JsonObject();
if (updateEntityOptions.newEntity() != null) {
contentJson.addProperty("entity", updateEntityOptions.newEntity());
}
+ if (updateEntityOptions.newDescription() != null) {
+ contentJson.addProperty("description", updateEntityOptions.newDescription());
+ }
if (updateEntityOptions.newMetadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newMetadata()));
}
+ if (updateEntityOptions.newFuzzyMatch() != null) {
+ contentJson.addProperty("fuzzy_match", updateEntityOptions.newFuzzyMatch());
+ }
if (updateEntityOptions.newValues() != null) {
contentJson.add("values", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newValues()));
}
- if (updateEntityOptions.newDescription() != null) {
- contentJson.addProperty("description", updateEntityOptions.newDescription());
- }
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
}
@@ -1043,9 +1125,12 @@ public ServiceCall listMentions(ListMentionsOptions lis
String[] pathParameters = { listMentionsOptions.workspaceId(), listMentionsOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=listMentions");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listMentions");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listMentionsOptions.export() != null) {
builder.query("export", String.valueOf(listMentionsOptions.export()));
}
@@ -1056,7 +1141,7 @@ public ServiceCall listMentions(ListMentionsOptions lis
}
/**
- * Add entity value.
+ * Create entity value.
*
* Create a new value for an entity.
*
@@ -1071,22 +1156,26 @@ public ServiceCall createValue(CreateValueOptions createValueOptions) {
String[] pathParameters = { createValueOptions.workspaceId(), createValueOptions.entity() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=createValue");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createValue");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("value", createValueOptions.value());
if (createValueOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createValueOptions.metadata()));
}
+ if (createValueOptions.valueType() != null) {
+ contentJson.addProperty("type", createValueOptions.valueType());
+ }
if (createValueOptions.synonyms() != null) {
contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(createValueOptions.synonyms()));
}
if (createValueOptions.patterns() != null) {
contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(createValueOptions.patterns()));
}
- if (createValueOptions.valueType() != null) {
- contentJson.addProperty("type", createValueOptions.valueType());
- }
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
}
@@ -1108,8 +1197,12 @@ public ServiceCall deleteValue(DeleteValueOptions deleteValueOptions) {
.value() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=deleteValue");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteValue");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -1121,23 +1214,27 @@ public ServiceCall deleteValue(DeleteValueOptions deleteValueOptions) {
* This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**.
*
* @param getValueOptions the {@link GetValueOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link ValueExport}
+ * @return a {@link ServiceCall} with a response type of {@link Value}
*/
- public ServiceCall getValue(GetValueOptions getValueOptions) {
+ public ServiceCall getValue(GetValueOptions getValueOptions) {
Validator.notNull(getValueOptions, "getValueOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { getValueOptions.workspaceId(), getValueOptions.entity(), getValueOptions.value() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=getValue");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getValue");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getValueOptions.export() != null) {
builder.query("export", String.valueOf(getValueOptions.export()));
}
if (getValueOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getValueOptions.includeAudit()));
}
- return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ValueExport.class));
+ return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
}
/**
@@ -1156,8 +1253,12 @@ public ServiceCall listValues(ListValuesOptions listValuesOptio
String[] pathParameters = { listValuesOptions.workspaceId(), listValuesOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=listValues");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listValues");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listValuesOptions.export() != null) {
builder.query("export", String.valueOf(listValuesOptions.export()));
}
@@ -1197,30 +1298,34 @@ public ServiceCall updateValue(UpdateValueOptions updateValueOptions) {
.value() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=updateValue");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateValue");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
- if (updateValueOptions.newSynonyms() != null) {
- contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(updateValueOptions.newSynonyms()));
+ if (updateValueOptions.newValue() != null) {
+ contentJson.addProperty("value", updateValueOptions.newValue());
+ }
+ if (updateValueOptions.newMetadata() != null) {
+ contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateValueOptions.newMetadata()));
}
if (updateValueOptions.valueType() != null) {
contentJson.addProperty("type", updateValueOptions.valueType());
}
- if (updateValueOptions.newMetadata() != null) {
- contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateValueOptions.newMetadata()));
+ if (updateValueOptions.newSynonyms() != null) {
+ contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(updateValueOptions.newSynonyms()));
}
if (updateValueOptions.newPatterns() != null) {
contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(updateValueOptions.newPatterns()));
}
- if (updateValueOptions.newValue() != null) {
- contentJson.addProperty("value", updateValueOptions.newValue());
- }
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
}
/**
- * Add entity value synonym.
+ * Create entity value synonym.
*
* Add a new synonym to an entity value.
*
@@ -1236,9 +1341,12 @@ public ServiceCall createSynonym(CreateSynonymOptions createSynonymOpti
.value() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=createSynonym");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createSynonym");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("synonym", createSynonymOptions.synonym());
builder.bodyJson(contentJson);
@@ -1262,9 +1370,12 @@ public ServiceCall deleteSynonym(DeleteSynonymOptions deleteSynonymOptions
.value(), deleteSynonymOptions.synonym() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteSynonym");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteSynonym");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -1285,8 +1396,12 @@ public ServiceCall getSynonym(GetSynonymOptions getSynonymOptions) {
getSynonymOptions.synonym() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=getSynonym");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getSynonym");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getSynonymOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getSynonymOptions.includeAudit()));
}
@@ -1310,9 +1425,12 @@ public ServiceCall listSynonyms(ListSynonymsOptions listSynon
.value() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=listSynonyms");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listSynonyms");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listSynonymsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listSynonymsOptions.pageLimit()));
}
@@ -1348,9 +1466,12 @@ public ServiceCall updateSynonym(UpdateSynonymOptions updateSynonymOpti
.value(), updateSynonymOptions.synonym() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=updateSynonym");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateSynonym");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateSynonymOptions.newSynonym() != null) {
contentJson.addProperty("synonym", updateSynonymOptions.newSynonym());
@@ -1375,9 +1496,12 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi
String[] pathParameters = { createDialogNodeOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=createDialogNode");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createDialogNode");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("dialog_node", createDialogNodeOptions.dialogNode());
if (createDialogNodeOptions.description() != null) {
@@ -1404,9 +1528,6 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi
if (createDialogNodeOptions.nextStep() != null) {
contentJson.add("next_step", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.nextStep()));
}
- if (createDialogNodeOptions.actions() != null) {
- contentJson.add("actions", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.actions()));
- }
if (createDialogNodeOptions.title() != null) {
contentJson.addProperty("title", createDialogNodeOptions.title());
}
@@ -1419,6 +1540,9 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi
if (createDialogNodeOptions.variable() != null) {
contentJson.addProperty("variable", createDialogNodeOptions.variable());
}
+ if (createDialogNodeOptions.actions() != null) {
+ contentJson.add("actions", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.actions()));
+ }
if (createDialogNodeOptions.digressIn() != null) {
contentJson.addProperty("digress_in", createDialogNodeOptions.digressIn());
}
@@ -1451,9 +1575,12 @@ public ServiceCall deleteDialogNode(DeleteDialogNodeOptions deleteDialogNo
String[] pathParameters = { deleteDialogNodeOptions.workspaceId(), deleteDialogNodeOptions.dialogNode() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteDialogNode");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteDialogNode");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
@@ -1473,9 +1600,12 @@ public ServiceCall getDialogNode(GetDialogNodeOptions getDialogNodeO
String[] pathParameters = { getDialogNodeOptions.workspaceId(), getDialogNodeOptions.dialogNode() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=getDialogNode");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getDialogNode");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (getDialogNodeOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getDialogNodeOptions.includeAudit()));
}
@@ -1498,9 +1628,12 @@ public ServiceCall listDialogNodes(ListDialogNodesOptions
String[] pathParameters = { listDialogNodesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=listDialogNodes");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listDialogNodes");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listDialogNodesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listDialogNodesOptions.pageLimit()));
}
@@ -1535,63 +1668,66 @@ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDi
String[] pathParameters = { updateDialogNodeOptions.workspaceId(), updateDialogNodeOptions.dialogNode() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=updateDialogNode");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateDialogNode");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
- if (updateDialogNodeOptions.nodeType() != null) {
- contentJson.addProperty("type", updateDialogNodeOptions.nodeType());
+ if (updateDialogNodeOptions.newDialogNode() != null) {
+ contentJson.addProperty("dialog_node", updateDialogNodeOptions.newDialogNode());
}
- if (updateDialogNodeOptions.newActions() != null) {
- contentJson.add("actions", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newActions()));
+ if (updateDialogNodeOptions.newDescription() != null) {
+ contentJson.addProperty("description", updateDialogNodeOptions.newDescription());
}
if (updateDialogNodeOptions.newConditions() != null) {
contentJson.addProperty("conditions", updateDialogNodeOptions.newConditions());
}
- if (updateDialogNodeOptions.newContext() != null) {
- contentJson.add("context", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newContext()));
+ if (updateDialogNodeOptions.newParent() != null) {
+ contentJson.addProperty("parent", updateDialogNodeOptions.newParent());
}
if (updateDialogNodeOptions.newPreviousSibling() != null) {
contentJson.addProperty("previous_sibling", updateDialogNodeOptions.newPreviousSibling());
}
- if (updateDialogNodeOptions.newVariable() != null) {
- contentJson.addProperty("variable", updateDialogNodeOptions.newVariable());
+ if (updateDialogNodeOptions.newOutput() != null) {
+ contentJson.add("output", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newOutput()));
}
- if (updateDialogNodeOptions.newUserLabel() != null) {
- contentJson.addProperty("user_label", updateDialogNodeOptions.newUserLabel());
+ if (updateDialogNodeOptions.newContext() != null) {
+ contentJson.add("context", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newContext()));
}
if (updateDialogNodeOptions.newMetadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newMetadata()));
}
+ if (updateDialogNodeOptions.newNextStep() != null) {
+ contentJson.add("next_step", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newNextStep()));
+ }
if (updateDialogNodeOptions.newTitle() != null) {
contentJson.addProperty("title", updateDialogNodeOptions.newTitle());
}
- if (updateDialogNodeOptions.newDescription() != null) {
- contentJson.addProperty("description", updateDialogNodeOptions.newDescription());
- }
- if (updateDialogNodeOptions.newDigressOut() != null) {
- contentJson.addProperty("digress_out", updateDialogNodeOptions.newDigressOut());
+ if (updateDialogNodeOptions.nodeType() != null) {
+ contentJson.addProperty("type", updateDialogNodeOptions.nodeType());
}
if (updateDialogNodeOptions.newEventName() != null) {
contentJson.addProperty("event_name", updateDialogNodeOptions.newEventName());
}
- if (updateDialogNodeOptions.newDigressOutSlots() != null) {
- contentJson.addProperty("digress_out_slots", updateDialogNodeOptions.newDigressOutSlots());
+ if (updateDialogNodeOptions.newVariable() != null) {
+ contentJson.addProperty("variable", updateDialogNodeOptions.newVariable());
}
- if (updateDialogNodeOptions.newNextStep() != null) {
- contentJson.add("next_step", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newNextStep()));
+ if (updateDialogNodeOptions.newActions() != null) {
+ contentJson.add("actions", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newActions()));
}
if (updateDialogNodeOptions.newDigressIn() != null) {
contentJson.addProperty("digress_in", updateDialogNodeOptions.newDigressIn());
}
- if (updateDialogNodeOptions.newOutput() != null) {
- contentJson.add("output", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newOutput()));
+ if (updateDialogNodeOptions.newDigressOut() != null) {
+ contentJson.addProperty("digress_out", updateDialogNodeOptions.newDigressOut());
}
- if (updateDialogNodeOptions.newParent() != null) {
- contentJson.addProperty("parent", updateDialogNodeOptions.newParent());
+ if (updateDialogNodeOptions.newDigressOutSlots() != null) {
+ contentJson.addProperty("digress_out_slots", updateDialogNodeOptions.newDigressOutSlots());
}
- if (updateDialogNodeOptions.newDialogNode() != null) {
- contentJson.addProperty("dialog_node", updateDialogNodeOptions.newDialogNode());
+ if (updateDialogNodeOptions.newUserLabel() != null) {
+ contentJson.addProperty("user_label", updateDialogNodeOptions.newUserLabel());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DialogNode.class));
@@ -1612,8 +1748,12 @@ public ServiceCall listAllLogs(ListAllLogsOptions listAllLogsOpti
Validator.notNull(listAllLogsOptions, "listAllLogsOptions cannot be null");
String[] pathSegments = { "v1/logs" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=listAllLogs");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listAllLogs");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
builder.query("filter", listAllLogsOptions.filter());
if (listAllLogsOptions.sort() != null) {
builder.query("sort", listAllLogsOptions.sort());
@@ -1644,8 +1784,12 @@ public ServiceCall listLogs(ListLogsOptions listLogsOptions) {
String[] pathParameters = { listLogsOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v1;operation_id=listLogs");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listLogs");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
if (listLogsOptions.sort() != null) {
builder.query("sort", listLogsOptions.sort());
}
@@ -1678,9 +1822,12 @@ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOpti
Validator.notNull(deleteUserDataOptions, "deleteUserDataOptions cannot be null");
String[] pathSegments = { "v1/user_data" };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
- builder.query(VERSION, versionDate);
- builder.header("X-IBMCloud-SDK-Analytics",
- "service_name=conversation;service_version=v1;operation_id=deleteUserData");
+ builder.query("version", versionDate);
+ Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteUserData");
+ for (Entry header : sdkHeaders.entrySet()) {
+ builder.header(header.getKey(), header.getValue());
+ }
+ builder.header("Accept", "application/json");
builder.query("customer_id", deleteUserDataOptions.customerId());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CaptureGroup.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CaptureGroup.java
similarity index 90%
rename from conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CaptureGroup.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CaptureGroup.java
index 0caf64746fa..c083e36ad2b 100644
--- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CaptureGroup.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CaptureGroup.java
@@ -10,14 +10,14 @@
* 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.conversation.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.List;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
/**
- * CaptureGroup.
+ * A recognized capture group for a pattern-based entity.
*/
public class CaptureGroup extends GenericModel {
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/Context.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Context.java
similarity index 83%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/Context.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/Context.java
index acbd98552f1..c4c686eb749 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/Context.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Context.java
@@ -10,23 +10,21 @@
* 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.v1.model;
-
-import java.lang.reflect.Type;
+package com.ibm.watson.assistant.v1.model;
import com.google.gson.reflect.TypeToken;
-import com.ibm.watson.developer_cloud.service.model.DynamicModel;
-import com.ibm.watson.developer_cloud.util.GsonSerializationHelper;
+import com.ibm.cloud.sdk.core.service.model.DynamicModel;
+import com.ibm.cloud.sdk.core.util.GsonSerializationHelper;
/**
* State information for the conversation. To maintain state, include the context from the previous response.
*/
public class Context extends DynamicModel {
- private Type conversationIdType = new TypeToken() {
+ private java.lang.reflect.Type conversationIdType = new TypeToken() {
}.getType();
- private Type systemType = new TypeToken() {
+ private java.lang.reflect.Type systemType = new TypeToken() {
}.getType();
- private Type metadataType = new TypeToken() {
+ private java.lang.reflect.Type metadataType = new TypeToken() {
}.getType();
/**
diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Counterexample.java
similarity index 53%
rename from conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexampleOptions.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/Counterexample.java
index 1300b6f4885..accd8966384 100644
--- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateCounterexampleOptions.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Counterexample.java
@@ -10,29 +10,34 @@
* 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.conversation.v1.model;
+package com.ibm.watson.assistant.v1.model;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import java.util.Date;
+
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
- * The createCounterexample options.
+ * Counterexample.
*/
-public class CreateCounterexampleOptions extends GenericModel {
+public class Counterexample extends GenericModel {
- private String workspaceId;
private String text;
+ private Date created;
+ private Date updated;
/**
* Builder.
*/
public static class Builder {
- private String workspaceId;
private String text;
+ private Date created;
+ private Date updated;
- private Builder(CreateCounterexampleOptions createCounterexampleOptions) {
- workspaceId = createCounterexampleOptions.workspaceId;
- text = createCounterexampleOptions.text;
+ private Builder(Counterexample counterexample) {
+ this.text = counterexample.text;
+ this.created = counterexample.created;
+ this.updated = counterexample.updated;
}
/**
@@ -44,73 +49,71 @@ public Builder() {
/**
* Instantiates a new builder with required properties.
*
- * @param workspaceId the workspaceId
* @param text the text
*/
- public Builder(String workspaceId, String text) {
- this.workspaceId = workspaceId;
+ public Builder(String text) {
this.text = text;
}
/**
- * Builds a CreateCounterexampleOptions.
+ * Builds a Counterexample.
*
- * @return the createCounterexampleOptions
+ * @return the counterexample
*/
- public CreateCounterexampleOptions build() {
- return new CreateCounterexampleOptions(this);
+ public Counterexample build() {
+ return new Counterexample(this);
}
/**
- * Set the workspaceId.
+ * Set the text.
*
- * @param workspaceId the workspaceId
- * @return the CreateCounterexampleOptions builder
+ * @param text the text
+ * @return the Counterexample builder
*/
- public Builder workspaceId(String workspaceId) {
- this.workspaceId = workspaceId;
+ public Builder text(String text) {
+ this.text = text;
return this;
}
/**
- * Set the text.
+ * Set the created.
*
- * @param text the text
- * @return the CreateCounterexampleOptions builder
+ * @param created the created
+ * @return the Counterexample builder
*/
- public Builder text(String text) {
- this.text = text;
+ public Builder created(Date created) {
+ this.created = created;
+ return this;
+ }
+
+ /**
+ * Set the updated.
+ *
+ * @param updated the updated
+ * @return the Counterexample builder
+ */
+ public Builder updated(Date updated) {
+ this.updated = updated;
return this;
}
}
- private CreateCounterexampleOptions(Builder builder) {
- Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty");
+ private Counterexample(Builder builder) {
Validator.notNull(builder.text, "text cannot be null");
- workspaceId = builder.workspaceId;
text = builder.text;
+ created = builder.created;
+ updated = builder.updated;
}
/**
* New builder.
*
- * @return a CreateCounterexampleOptions builder
+ * @return a Counterexample builder
*/
public Builder newBuilder() {
return new Builder(this);
}
- /**
- * Gets the workspaceId.
- *
- * Unique identifier of the workspace.
- *
- * @return the workspaceId
- */
- public String workspaceId() {
- return workspaceId;
- }
-
/**
* Gets the text.
*
@@ -124,4 +127,26 @@ public String workspaceId() {
public String text() {
return text;
}
+
+ /**
+ * Gets the created.
+ *
+ * The timestamp for creation of the object.
+ *
+ * @return the created
+ */
+ public Date created() {
+ return created;
+ }
+
+ /**
+ * Gets the updated.
+ *
+ * The timestamp for the most recent update to the object.
+ *
+ * @return the updated
+ */
+ public Date updated() {
+ return updated;
+ }
}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CounterexampleCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CounterexampleCollection.java
similarity index 90%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CounterexampleCollection.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CounterexampleCollection.java
index fb25506b886..e235ae4f92d 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CounterexampleCollection.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CounterexampleCollection.java
@@ -10,11 +10,11 @@
* 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.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.List;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
/**
* CounterexampleCollection.
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateCounterexampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateCounterexampleOptions.java
similarity index 84%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateCounterexampleOptions.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateCounterexampleOptions.java
index bf68f8bce76..f1ba25c4517 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateCounterexampleOptions.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateCounterexampleOptions.java
@@ -10,10 +10,10 @@
* 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.v1.model;
+package com.ibm.watson.assistant.v1.model;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
* The createCounterexample options.
@@ -31,8 +31,8 @@ public static class Builder {
private String text;
private Builder(CreateCounterexampleOptions createCounterexampleOptions) {
- workspaceId = createCounterexampleOptions.workspaceId;
- text = createCounterexampleOptions.text;
+ this.workspaceId = createCounterexampleOptions.workspaceId;
+ this.text = createCounterexampleOptions.text;
}
/**
@@ -82,6 +82,17 @@ public Builder text(String text) {
this.text = text;
return this;
}
+
+ /**
+ * Set the counterexample.
+ *
+ * @param counterexample the counterexample
+ * @return the CreateCounterexampleOptions builder
+ */
+ public Builder counterexample(Counterexample counterexample) {
+ this.text = counterexample.text();
+ return this;
+ }
}
private CreateCounterexampleOptions(Builder builder) {
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateDialogNodeOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java
similarity index 83%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateDialogNodeOptions.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java
index d215a849869..4beadc5ea0a 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateDialogNodeOptions.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java
@@ -10,14 +10,14 @@
* 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.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
* The createDialogNode options.
@@ -109,14 +109,14 @@ public interface DigressOutSlots {
private String parent;
private String previousSibling;
private DialogNodeOutput output;
- private Map context;
- private Map metadata;
+ private Map context;
+ private Map metadata;
private DialogNodeNextStep nextStep;
- private List actions;
private String title;
private String nodeType;
private String eventName;
private String variable;
+ private List actions;
private String digressIn;
private String digressOut;
private String digressOutSlots;
@@ -133,39 +133,39 @@ public static class Builder {
private String parent;
private String previousSibling;
private DialogNodeOutput output;
- private Map context;
- private Map metadata;
+ private Map context;
+ private Map metadata;
private DialogNodeNextStep nextStep;
- private List actions;
private String title;
private String nodeType;
private String eventName;
private String variable;
+ private List actions;
private String digressIn;
private String digressOut;
private String digressOutSlots;
private String userLabel;
private Builder(CreateDialogNodeOptions createDialogNodeOptions) {
- workspaceId = createDialogNodeOptions.workspaceId;
- dialogNode = createDialogNodeOptions.dialogNode;
- description = createDialogNodeOptions.description;
- conditions = createDialogNodeOptions.conditions;
- parent = createDialogNodeOptions.parent;
- previousSibling = createDialogNodeOptions.previousSibling;
- output = createDialogNodeOptions.output;
- context = createDialogNodeOptions.context;
- metadata = createDialogNodeOptions.metadata;
- nextStep = createDialogNodeOptions.nextStep;
- actions = createDialogNodeOptions.actions;
- title = createDialogNodeOptions.title;
- nodeType = createDialogNodeOptions.nodeType;
- eventName = createDialogNodeOptions.eventName;
- variable = createDialogNodeOptions.variable;
- digressIn = createDialogNodeOptions.digressIn;
- digressOut = createDialogNodeOptions.digressOut;
- digressOutSlots = createDialogNodeOptions.digressOutSlots;
- userLabel = createDialogNodeOptions.userLabel;
+ this.workspaceId = createDialogNodeOptions.workspaceId;
+ this.dialogNode = createDialogNodeOptions.dialogNode;
+ this.description = createDialogNodeOptions.description;
+ this.conditions = createDialogNodeOptions.conditions;
+ this.parent = createDialogNodeOptions.parent;
+ this.previousSibling = createDialogNodeOptions.previousSibling;
+ this.output = createDialogNodeOptions.output;
+ this.context = createDialogNodeOptions.context;
+ this.metadata = createDialogNodeOptions.metadata;
+ this.nextStep = createDialogNodeOptions.nextStep;
+ this.title = createDialogNodeOptions.title;
+ this.nodeType = createDialogNodeOptions.nodeType;
+ this.eventName = createDialogNodeOptions.eventName;
+ this.variable = createDialogNodeOptions.variable;
+ this.actions = createDialogNodeOptions.actions;
+ this.digressIn = createDialogNodeOptions.digressIn;
+ this.digressOut = createDialogNodeOptions.digressOut;
+ this.digressOutSlots = createDialogNodeOptions.digressOutSlots;
+ this.userLabel = createDialogNodeOptions.userLabel;
}
/**
@@ -292,7 +292,7 @@ public Builder output(DialogNodeOutput output) {
* @param context the context
* @return the CreateDialogNodeOptions builder
*/
- public Builder context(Map context) {
+ public Builder context(Map context) {
this.context = context;
return this;
}
@@ -303,7 +303,7 @@ public Builder context(Map context) {
* @param metadata the metadata
* @return the CreateDialogNodeOptions builder
*/
- public Builder metadata(Map metadata) {
+ public Builder metadata(Map metadata) {
this.metadata = metadata;
return this;
}
@@ -319,18 +319,6 @@ public Builder nextStep(DialogNodeNextStep nextStep) {
return this;
}
- /**
- * Set the actions.
- * Existing actions will be replaced.
- *
- * @param actions the actions
- * @return the CreateDialogNodeOptions builder
- */
- public Builder actions(List actions) {
- this.actions = actions;
- return this;
- }
-
/**
* Set the title.
*
@@ -375,6 +363,18 @@ public Builder variable(String variable) {
return this;
}
+ /**
+ * Set the actions.
+ * Existing actions will be replaced.
+ *
+ * @param actions the actions
+ * @return the CreateDialogNodeOptions builder
+ */
+ public Builder actions(List actions) {
+ this.actions = actions;
+ return this;
+ }
+
/**
* Set the digressIn.
*
@@ -418,6 +418,34 @@ public Builder userLabel(String userLabel) {
this.userLabel = userLabel;
return this;
}
+
+ /**
+ * Set the dialogNode.
+ *
+ * @param dialogNode the dialogNode
+ * @return the CreateDialogNodeOptions builder
+ */
+ public Builder dialogNode(DialogNode dialogNode) {
+ this.dialogNode = dialogNode.dialogNode();
+ this.description = dialogNode.description();
+ this.conditions = dialogNode.conditions();
+ this.parent = dialogNode.parent();
+ this.previousSibling = dialogNode.previousSibling();
+ this.output = dialogNode.output();
+ this.context = dialogNode.context();
+ this.metadata = dialogNode.metadata();
+ this.nextStep = dialogNode.nextStep();
+ this.title = dialogNode.title();
+ this.nodeType = dialogNode.nodeType();
+ this.eventName = dialogNode.eventName();
+ this.variable = dialogNode.variable();
+ this.actions = dialogNode.actions();
+ this.digressIn = dialogNode.digressIn();
+ this.digressOut = dialogNode.digressOut();
+ this.digressOutSlots = dialogNode.digressOutSlots();
+ this.userLabel = dialogNode.userLabel();
+ return this;
+ }
}
private CreateDialogNodeOptions(Builder builder) {
@@ -433,11 +461,11 @@ private CreateDialogNodeOptions(Builder builder) {
context = builder.context;
metadata = builder.metadata;
nextStep = builder.nextStep;
- actions = builder.actions;
title = builder.title;
nodeType = builder.nodeType;
eventName = builder.eventName;
variable = builder.variable;
+ actions = builder.actions;
digressIn = builder.digressIn;
digressOut = builder.digressOut;
digressOutSlots = builder.digressOutSlots;
@@ -504,7 +532,7 @@ public String conditions() {
/**
* Gets the parent.
*
- * The ID of the parent dialog node.
+ * The ID of the parent dialog node. This property is omitted if the dialog node has no parent.
*
* @return the parent
*/
@@ -515,7 +543,7 @@ public String parent() {
/**
* Gets the previousSibling.
*
- * The ID of the previous dialog node.
+ * The ID of the previous sibling dialog node. This property is omitted if the dialog node has no previous sibling.
*
* @return the previousSibling
*/
@@ -527,7 +555,7 @@ public String previousSibling() {
* Gets the output.
*
* The output of the dialog node. For more information about how to specify dialog node output, see the
- * [documentation](https://cloud.ibm.com/docs/services/assistant/dialog-overview.html#complex).
+ * [documentation](https://cloud.ibm.com/docs/services/assistant/dialog-overview.html#dialog-overview-responses).
*
* @return the output
*/
@@ -542,7 +570,7 @@ public DialogNodeOutput output() {
*
* @return the context
*/
- public Map context() {
+ public Map context() {
return context;
}
@@ -553,7 +581,7 @@ public Map context() {
*
* @return the metadata
*/
- public Map metadata() {
+ public Map metadata() {
return metadata;
}
@@ -568,17 +596,6 @@ public DialogNodeNextStep nextStep() {
return nextStep;
}
- /**
- * Gets the actions.
- *
- * An array of objects describing any actions to be invoked by the dialog node.
- *
- * @return the actions
- */
- public List actions() {
- return actions;
- }
-
/**
* Gets the title.
*
@@ -625,6 +642,17 @@ public String variable() {
return variable;
}
+ /**
+ * Gets the actions.
+ *
+ * An array of objects describing any actions to be invoked by the dialog node.
+ *
+ * @return the actions
+ */
+ public List actions() {
+ return actions;
+ }
+
/**
* Gets the digressIn.
*
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateEntity.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntity.java
similarity index 71%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateEntity.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntity.java
index 5cb4be4d399..fcb4c99b12d 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateEntity.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntity.java
@@ -10,15 +10,16 @@
* 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.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.SerializedName;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
* CreateEntity.
@@ -27,10 +28,12 @@ public class CreateEntity extends GenericModel {
private String entity;
private String description;
- private Map metadata;
- private List values;
+ private Map metadata;
@SerializedName("fuzzy_match")
private Boolean fuzzyMatch;
+ private Date created;
+ private Date updated;
+ private List values;
/**
* Builder.
@@ -38,16 +41,20 @@ public class CreateEntity extends GenericModel {
public static class Builder {
private String entity;
private String description;
- private Map metadata;
- private List values;
+ private Map metadata;
private Boolean fuzzyMatch;
+ private Date created;
+ private Date updated;
+ private List values;
private Builder(CreateEntity createEntity) {
- entity = createEntity.entity;
- description = createEntity.description;
- metadata = createEntity.metadata;
- values = createEntity.values;
- fuzzyMatch = createEntity.fuzzyMatch;
+ this.entity = createEntity.entity;
+ this.description = createEntity.description;
+ this.metadata = createEntity.metadata;
+ this.fuzzyMatch = createEntity.fuzzyMatch;
+ this.created = createEntity.created;
+ this.updated = createEntity.updated;
+ this.values = createEntity.values;
}
/**
@@ -75,17 +82,17 @@ public CreateEntity build() {
}
/**
- * Adds an value to values.
+ * Adds an values to values.
*
- * @param value the new value
+ * @param values the new values
* @return the CreateEntity builder
*/
- public Builder addValue(CreateValue value) {
- Validator.notNull(value, "value cannot be null");
+ public Builder addValues(CreateValue values) {
+ Validator.notNull(values, "values cannot be null");
if (this.values == null) {
this.values = new ArrayList();
}
- this.values.add(value);
+ this.values.add(values);
return this;
}
@@ -117,31 +124,53 @@ public Builder description(String description) {
* @param metadata the metadata
* @return the CreateEntity builder
*/
- public Builder metadata(Map metadata) {
+ public Builder metadata(Map metadata) {
this.metadata = metadata;
return this;
}
/**
- * Set the values.
- * Existing values will be replaced.
+ * Set the fuzzyMatch.
*
- * @param values the values
+ * @param fuzzyMatch the fuzzyMatch
* @return the CreateEntity builder
*/
- public Builder values(List values) {
- this.values = values;
+ public Builder fuzzyMatch(Boolean fuzzyMatch) {
+ this.fuzzyMatch = fuzzyMatch;
return this;
}
/**
- * Set the fuzzyMatch.
+ * Set the created.
*
- * @param fuzzyMatch the fuzzyMatch
+ * @param created the created
* @return the CreateEntity builder
*/
- public Builder fuzzyMatch(Boolean fuzzyMatch) {
- this.fuzzyMatch = fuzzyMatch;
+ public Builder created(Date created) {
+ this.created = created;
+ return this;
+ }
+
+ /**
+ * Set the updated.
+ *
+ * @param updated the updated
+ * @return the CreateEntity builder
+ */
+ public Builder updated(Date updated) {
+ this.updated = updated;
+ return this;
+ }
+
+ /**
+ * Set the values.
+ * Existing values will be replaced.
+ *
+ * @param values the values
+ * @return the CreateEntity builder
+ */
+ public Builder values(List values) {
+ this.values = values;
return this;
}
}
@@ -151,8 +180,10 @@ private CreateEntity(Builder builder) {
entity = builder.entity;
description = builder.description;
metadata = builder.metadata;
- values = builder.values;
fuzzyMatch = builder.fuzzyMatch;
+ created = builder.created;
+ updated = builder.updated;
+ values = builder.values;
}
/**
@@ -195,33 +226,55 @@ public String description() {
/**
* Gets the metadata.
*
- * Any metadata related to the value.
+ * Any metadata related to the entity.
*
* @return the metadata
*/
- public Map metadata() {
+ public Map metadata() {
return metadata;
}
/**
- * Gets the values.
+ * Gets the fuzzyMatch.
*
- * An array of objects describing the entity values.
+ * Whether to use fuzzy matching for the entity.
*
- * @return the values
+ * @return the fuzzyMatch
*/
- public List values() {
- return values;
+ public Boolean fuzzyMatch() {
+ return fuzzyMatch;
}
/**
- * Gets the fuzzyMatch.
+ * Gets the created.
*
- * Whether to use fuzzy matching for the entity.
+ * The timestamp for creation of the object.
*
- * @return the fuzzyMatch
+ * @return the created
*/
- public Boolean fuzzyMatch() {
- return fuzzyMatch;
+ public Date created() {
+ return created;
+ }
+
+ /**
+ * Gets the updated.
+ *
+ * The timestamp for the most recent update to the object.
+ *
+ * @return the updated
+ */
+ public Date updated() {
+ return updated;
+ }
+
+ /**
+ * Gets the values.
+ *
+ * An array of objects describing the entity values.
+ *
+ * @return the values
+ */
+ public List values() {
+ return values;
}
}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateEntityOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntityOptions.java
similarity index 85%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateEntityOptions.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntityOptions.java
index b185e78564c..00b2359ffd6 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateEntityOptions.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntityOptions.java
@@ -10,14 +10,14 @@
* 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.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
* The createEntity options.
@@ -27,9 +27,9 @@ public class CreateEntityOptions extends GenericModel {
private String workspaceId;
private String entity;
private String description;
- private Map metadata;
- private List values;
+ private Map metadata;
private Boolean fuzzyMatch;
+ private List values;
/**
* Builder.
@@ -38,17 +38,17 @@ public static class Builder {
private String workspaceId;
private String entity;
private String description;
- private Map metadata;
- private List values;
+ private Map metadata;
private Boolean fuzzyMatch;
+ private List values;
private Builder(CreateEntityOptions createEntityOptions) {
- workspaceId = createEntityOptions.workspaceId;
- entity = createEntityOptions.entity;
- description = createEntityOptions.description;
- metadata = createEntityOptions.metadata;
- values = createEntityOptions.values;
- fuzzyMatch = createEntityOptions.fuzzyMatch;
+ this.workspaceId = createEntityOptions.workspaceId;
+ this.entity = createEntityOptions.entity;
+ this.description = createEntityOptions.description;
+ this.metadata = createEntityOptions.metadata;
+ this.fuzzyMatch = createEntityOptions.fuzzyMatch;
+ this.values = createEntityOptions.values;
}
/**
@@ -78,17 +78,17 @@ public CreateEntityOptions build() {
}
/**
- * Adds an value to values.
+ * Adds an values to values.
*
- * @param value the new value
+ * @param values the new values
* @return the CreateEntityOptions builder
*/
- public Builder addValue(CreateValue value) {
- Validator.notNull(value, "value cannot be null");
+ public Builder addValues(CreateValue values) {
+ Validator.notNull(values, "values cannot be null");
if (this.values == null) {
this.values = new ArrayList();
}
- this.values.add(value);
+ this.values.add(values);
return this;
}
@@ -131,31 +131,31 @@ public Builder description(String description) {
* @param metadata the metadata
* @return the CreateEntityOptions builder
*/
- public Builder metadata(Map metadata) {
+ public Builder metadata(Map metadata) {
this.metadata = metadata;
return this;
}
/**
- * Set the values.
- * Existing values will be replaced.
+ * Set the fuzzyMatch.
*
- * @param values the values
+ * @param fuzzyMatch the fuzzyMatch
* @return the CreateEntityOptions builder
*/
- public Builder values(List values) {
- this.values = values;
+ public Builder fuzzyMatch(Boolean fuzzyMatch) {
+ this.fuzzyMatch = fuzzyMatch;
return this;
}
/**
- * Set the fuzzyMatch.
+ * Set the values.
+ * Existing values will be replaced.
*
- * @param fuzzyMatch the fuzzyMatch
+ * @param values the values
* @return the CreateEntityOptions builder
*/
- public Builder fuzzyMatch(Boolean fuzzyMatch) {
- this.fuzzyMatch = fuzzyMatch;
+ public Builder values(List values) {
+ this.values = values;
return this;
}
}
@@ -167,8 +167,8 @@ private CreateEntityOptions(Builder builder) {
entity = builder.entity;
description = builder.description;
metadata = builder.metadata;
- values = builder.values;
fuzzyMatch = builder.fuzzyMatch;
+ values = builder.values;
}
/**
@@ -222,33 +222,33 @@ public String description() {
/**
* Gets the metadata.
*
- * Any metadata related to the value.
+ * Any metadata related to the entity.
*
* @return the metadata
*/
- public Map metadata() {
+ public Map metadata() {
return metadata;
}
/**
- * Gets the values.
+ * Gets the fuzzyMatch.
*
- * An array of objects describing the entity values.
+ * Whether to use fuzzy matching for the entity.
*
- * @return the values
+ * @return the fuzzyMatch
*/
- public List values() {
- return values;
+ public Boolean fuzzyMatch() {
+ return fuzzyMatch;
}
/**
- * Gets the fuzzyMatch.
+ * Gets the values.
*
- * Whether to use fuzzy matching for the entity.
+ * An array of objects describing the entity values.
*
- * @return the fuzzyMatch
+ * @return the values
*/
- public Boolean fuzzyMatch() {
- return fuzzyMatch;
+ public List values() {
+ return values;
}
}
diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateExampleOptions.java
similarity index 82%
rename from conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExampleOptions.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateExampleOptions.java
index 0774405e0e5..a3b04b502fb 100644
--- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateExampleOptions.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateExampleOptions.java
@@ -10,13 +10,13 @@
* 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.conversation.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.ArrayList;
import java.util.List;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
* The createExample options.
@@ -26,7 +26,7 @@ public class CreateExampleOptions extends GenericModel {
private String workspaceId;
private String intent;
private String text;
- private List mentions;
+ private List mentions;
/**
* Builder.
@@ -35,13 +35,13 @@ public static class Builder {
private String workspaceId;
private String intent;
private String text;
- private List mentions;
+ private List mentions;
private Builder(CreateExampleOptions createExampleOptions) {
- workspaceId = createExampleOptions.workspaceId;
- intent = createExampleOptions.intent;
- text = createExampleOptions.text;
- mentions = createExampleOptions.mentions;
+ this.workspaceId = createExampleOptions.workspaceId;
+ this.intent = createExampleOptions.intent;
+ this.text = createExampleOptions.text;
+ this.mentions = createExampleOptions.mentions;
}
/**
@@ -78,10 +78,10 @@ public CreateExampleOptions build() {
* @param mentions the new mentions
* @return the CreateExampleOptions builder
*/
- public Builder addMentions(Mentions mentions) {
+ public Builder addMentions(Mention mentions) {
Validator.notNull(mentions, "mentions cannot be null");
if (this.mentions == null) {
- this.mentions = new ArrayList();
+ this.mentions = new ArrayList();
}
this.mentions.add(mentions);
return this;
@@ -127,10 +127,22 @@ public Builder text(String text) {
* @param mentions the mentions
* @return the CreateExampleOptions builder
*/
- public Builder mentions(List mentions) {
+ public Builder mentions(List mentions) {
this.mentions = mentions;
return this;
}
+
+ /**
+ * Set the example.
+ *
+ * @param example the example
+ * @return the CreateExampleOptions builder
+ */
+ public Builder example(Example example) {
+ this.text = example.text();
+ this.mentions = example.mentions();
+ return this;
+ }
}
private CreateExampleOptions(Builder builder) {
@@ -195,7 +207,7 @@ public String text() {
*
* @return the mentions
*/
- public List mentions() {
+ public List mentions() {
return mentions;
}
}
diff --git a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntent.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntent.java
similarity index 69%
rename from conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntent.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntent.java
index 58a5b603314..8777e86fae7 100644
--- a/conversation/src/main/java/com/ibm/watson/developer_cloud/conversation/v1/model/CreateIntent.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntent.java
@@ -10,13 +10,14 @@
* 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.conversation.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
* CreateIntent.
@@ -25,7 +26,9 @@ public class CreateIntent extends GenericModel {
private String intent;
private String description;
- private List examples;
+ private Date created;
+ private Date updated;
+ private List examples;
/**
* Builder.
@@ -33,12 +36,16 @@ public class CreateIntent extends GenericModel {
public static class Builder {
private String intent;
private String description;
- private List examples;
+ private Date created;
+ private Date updated;
+ private List examples;
private Builder(CreateIntent createIntent) {
- intent = createIntent.intent;
- description = createIntent.description;
- examples = createIntent.examples;
+ this.intent = createIntent.intent;
+ this.description = createIntent.description;
+ this.created = createIntent.created;
+ this.updated = createIntent.updated;
+ this.examples = createIntent.examples;
}
/**
@@ -71,10 +78,10 @@ public CreateIntent build() {
* @param example the new example
* @return the CreateIntent builder
*/
- public Builder addExample(CreateExample example) {
+ public Builder addExample(Example example) {
Validator.notNull(example, "example cannot be null");
if (this.examples == null) {
- this.examples = new ArrayList();
+ this.examples = new ArrayList();
}
this.examples.add(example);
return this;
@@ -102,6 +109,28 @@ public Builder description(String description) {
return this;
}
+ /**
+ * Set the created.
+ *
+ * @param created the created
+ * @return the CreateIntent builder
+ */
+ public Builder created(Date created) {
+ this.created = created;
+ return this;
+ }
+
+ /**
+ * Set the updated.
+ *
+ * @param updated the updated
+ * @return the CreateIntent builder
+ */
+ public Builder updated(Date updated) {
+ this.updated = updated;
+ return this;
+ }
+
/**
* Set the examples.
* Existing examples will be replaced.
@@ -109,7 +138,7 @@ public Builder description(String description) {
* @param examples the examples
* @return the CreateIntent builder
*/
- public Builder examples(List examples) {
+ public Builder examples(List examples) {
this.examples = examples;
return this;
}
@@ -119,6 +148,8 @@ private CreateIntent(Builder builder) {
Validator.notNull(builder.intent, "intent cannot be null");
intent = builder.intent;
description = builder.description;
+ created = builder.created;
+ updated = builder.updated;
examples = builder.examples;
}
@@ -157,6 +188,28 @@ public String description() {
return description;
}
+ /**
+ * Gets the created.
+ *
+ * The timestamp for creation of the object.
+ *
+ * @return the created
+ */
+ public Date created() {
+ return created;
+ }
+
+ /**
+ * Gets the updated.
+ *
+ * The timestamp for the most recent update to the object.
+ *
+ * @return the updated
+ */
+ public Date updated() {
+ return updated;
+ }
+
/**
* Gets the examples.
*
@@ -164,7 +217,7 @@ public String description() {
*
* @return the examples
*/
- public List examples() {
+ public List examples() {
return examples;
}
}
diff --git a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateIntentOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntentOptions.java
similarity index 86%
rename from assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateIntentOptions.java
rename to assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntentOptions.java
index 4c4470f169b..f02cfba615c 100644
--- a/assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/CreateIntentOptions.java
+++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntentOptions.java
@@ -10,13 +10,13 @@
* 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.v1.model;
+package com.ibm.watson.assistant.v1.model;
import java.util.ArrayList;
import java.util.List;
-import com.ibm.watson.developer_cloud.service.model.GenericModel;
-import com.ibm.watson.developer_cloud.util.Validator;
+import com.ibm.cloud.sdk.core.service.model.GenericModel;
+import com.ibm.cloud.sdk.core.util.Validator;
/**
* The createIntent options.
@@ -26,7 +26,7 @@ public class CreateIntentOptions extends GenericModel {
private String workspaceId;
private String intent;
private String description;
- private List