diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 00000000000..10756a01aa0 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,49 @@ +{ + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "contributors": [ + { + "login": "lpatino10", + "name": "Logan Patino", + "avatar_url": "https://avatars2.githubusercontent.com/u/8710772?v=4", + "profile": "https://www.linkedin.com/in/logan-patino/", + "contributions": [ + "code", + "design", + "bug" + ] + }, + { + "login": "mediumTaj", + "name": "Ajiemar Santiago", + "avatar_url": "https://avatars1.githubusercontent.com/u/4381558?v=4", + "profile": "https://github.com/mediumTaj", + "contributions": [ + "code", + "design", + "bug" + ] + }, + { + "login": "germanattanasio", + "name": "German Attanasio", + "avatar_url": "https://avatars3.githubusercontent.com/u/313157?v=4", + "profile": "https://germanattanasio.com", + "contributions": [ + "code", + "design", + "doc", + "test" + ] + } + ], + "contributorsPerLine": 7, + "projectName": "java-sdk", + "projectOwner": "watson-developer-cloud", + "repoType": "github", + "repoHost": "https://github.com", + "skipCi": true +} diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a43e3d38759..24d4fd8c2f4 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,34 +1,22 @@ [bumpversion] -current_version = 4.2.1 +current_version = 16.1.0 +commit = True +message = Update version numbers from {current_version} -> {new_version} +search = {current_version} +replace = {new_version} [bumpversion:file:README.md] -[bumpversion:file:alchemy/README.md] - -[bumpversion:file:conversation/README.md] +[bumpversion:file:assistant/README.md] [bumpversion:file:discovery/README.md] -[bumpversion:file:document-conversion/README.md] - -[bumpversion:file:language-translator/README.md] - -[bumpversion:file:natural-language-classifier/README.md] - [bumpversion:file:natural-language-understanding/README.md] -[bumpversion:file:personality-insights/README.md] - -[bumpversion:file:retrieve-and-rank/README.md] - [bumpversion:file:speech-to-text/README.md] [bumpversion:file:text-to-speech/README.md] -[bumpversion:file:tone-analyzer/README.md] - -[bumpversion:file:tradeoff-analytics/README.md] +[bumpversion:file:docker/pom.xml] -[bumpversion:file:visual-recognition/README.md] -search = {current_version} -replace = {new_version} +[bumpversion:file:.github/workflows/deploy.yml] diff --git a/.github/.github/stale.yml b/.github/.github/stale.yml new file mode 100644 index 00000000000..6582de497e6 --- /dev/null +++ b/.github/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - bug + - feature +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 923748e6a3a..ba2daa61be4 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at germanattanasio@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at loganpatino10@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f33a1283229..4736f1db669 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,27 +1,32 @@ -# 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 [Maven] as the build tool (> v1.x). Here are some helpful commands: +```sh +cd java-sdk +mvn clean # Delete target directory. +mvn test # Run tests +mvn package # Take the compiled code and package it in its distributable format, e.g. JAR. +mvn verify # Run any checks to verify the MVN package is valid and meets quality criteria. +mvn verify -fae -DskipITs=false # Run Integration tests to verify the MVN package is valid and meets quality criteria. +mvn install # Install the package into the local maven repository cache. +``` + # 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). - 2. develop and test your code changes, gradle: `gradle test`. - * Run `checkstyle`: `gradle checkstyle`. 🏁 + 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: `mvn verify -fae -DskipITs=false`. + * Run `checkstyle`: `mvn checkstyle:check`. 🏁 * 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. * Check for unnecessary whitespace with git diff --check before committing. 3. Make the test pass 4. Commit your changes: - * Use the present tense (`"Add feature"` not `"Added Feature"`) - * Use the imperative mood (`"Move cursor to…"` not `"Moves cursor to…"`) - * Include relevant Emoji from our [Emoji cheatsheet](#emoji-cheatsheet) + * Commits should follow the [Angular commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). This is because our release tool uses this format for determining release versions and generating changelogs. To make this easier, we recommend using the [Commitizen CLI](https://github.com/commitizen/cz-cli) with the `cz-conventional-changelog` adapter. 5. Push to your fork and submit a pull request to the **master** branch # Developer's Certificate of Origin 1.1 @@ -50,24 +55,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..3e991949e71 --- /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. If you have issues with the APIs or have a question about the Watson services, see [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-watson+java). + +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..0f47a4dc643 --- /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. If you have issues with the APIs or have a question about the Watson services, see [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-watson+java). + +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/.github/bintray-new-version.png b/.github/bintray-new-version.png new file mode 100644 index 00000000000..76850dd9d14 Binary files /dev/null and b/.github/bintray-new-version.png differ diff --git a/.github/bintray-sync.png b/.github/bintray-sync.png new file mode 100644 index 00000000000..13e4dadb327 Binary files /dev/null and b/.github/bintray-sync.png differ diff --git a/.github/bintray-upload-files.png b/.github/bintray-upload-files.png new file mode 100644 index 00000000000..6024c834dae Binary files /dev/null and b/.github/bintray-upload-files.png differ diff --git a/.github/issue_template.md b/.github/issue_template.md index c9c2e173746..c62e3dfece2 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -1,4 +1,4 @@ -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). +Remember, an issue is not the place to ask questions. If you have issues with the APIs or have a question about the Watson services, see [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-watson+java). Before you open an issue, please check if a similar issue already exists or has been closed before. diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000000..e3e4aac1495 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has had no + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 00000000000..5c51075c04f --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,48 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support documentation. +# This workflow will do a clean install of java dependencies, build the source code and run tests across different versions of java +# For more information see: https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven + +name: Build and Test + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build_test: + name: Build and Test on Java ${{ matrix.java-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + java-version: ['8'] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java-version }} + distribution: 'adopt' + + - name: Install Java dependencies + run: curl -s https://codecov.io/bash > $HOME/codecov-bash.sh && chmod +x $HOME/codecov-bash.sh + + - name: Execute Java unit tests + env: + MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + run: mvn verify -fae -DskipITs $MVN_ARGS + + - name: Publish Java code coverage + if: github.ref == 'refs/heads/master' + env: + CC_TOK: ${{ secrets.CODECOV_TOKEN }} + run: $HOME/codecov-bash.sh -s modules/coverage-reports/target/site/jacoco-aggregate -t $CC_TOK diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000000..44b8d64f76e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,122 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support documentation. +# This workflow will download a prebuilt Java version, install dependencies, build and deploy/publish a new release +# For more information see: https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven + +name: Deploy and Publish + +on: + workflow_run: + workflows: ["Build and Test"] + branches: [ master ] + types: + - completed + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deploy: + if: "!contains(github.event.head_commit.message, 'skip ci')" + name: Deploy and Publish + env: + MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_TOKEN }} + persist-credentials: true + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Build Java package + run: mvn verify -fae -DskipITs -Dskip.unit.tests $MVN_ARGS + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: Install Semantic Release dependencies + run: | + pip3 install --user bump2version + npm install -g semantic-release + npm install -g @semantic-release/changelog + npm install -g @semantic-release/exec + npm install -g @semantic-release/git + npm install -g @semantic-release/github + npm install -g @semantic-release/commit-analyzer + npm install -g @semantic-release/release-notes-generator + + - name: Check if semantic release generated a release + id: is_new_release + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "IS_NEW_RELEASE=$(npx semantic-release --dry-run | grep -c -i "Published release")" >> $GITHUB_OUTPUT + echo "The full TAG - ${{ github.ref }}" + + - name: Get the nextRelease.version from semantic release + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }} + id: next_release + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: echo "NEXT_RELEASE=$(npx semantic-release --dry-run | grep -oP "Published release \K[0-9]+\.[0-9]+\.[0-9]+")" >> $GITHUB_OUTPUT + + - name: Publish to Git Releases and Tags + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release # --dry-run --branches 9662_addcheck + + - name: Publish to Maven Central + env: + GHA_TAG: "refs/tags/v16.1.0" # for setMavenVersion_gha + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} # for .travis.settings.xml + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} + GPG_KEYNAME: ${{ secrets.SIGNING_KEY }} + GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} # for setupSigning_gha + run: | + echo "The NEXT_RELEASE - ${{ steps.next_release.outputs.NEXT_RELEASE }}" + echo -e "\n\033[0;35mCommand: setupSigning" + build/setupSigning_gha.sh + echo -e "\n\033[0;35mCommand: setMavenVersion" + build/setMavenVersion_gha.sh + echo -e "\n\033[0;35mCommand: mvn deploy" + mvn deploy --settings build/.travis.settings.xml -DskipITs -Dskip.unit.tests -P central $MVN_ARGS + + - name: Publish Java docs + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + GHA_REPO_SLUG: ${{ github.repository }} + GHA_BRANCH: ${{ github.ref }} # non PR only need to get last part + GHA_PULL_REQUEST: ${{ github.event.number }} + GHA_BUILD_NUMBER: ${{ github.run_number }} + GHA_JOB_NUMBER: ${{ github.job_number }} + GHA_COMMIT: ${{ github.sha }} + GHA_TAG: "refs/tags/v16.1.0" # for setMavenVersion_gha + run: | + build/setMavenVersion_gha.sh + mvn clean javadoc:aggregate $MVN_ARGS + build/publish_gha.sh + + - name: SKIP - Publish/Deploy to Git and Maven Central + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '0' }} + run: | + echo -e "\n\033[0;35mCommand: Skipping the deployment because semantic release has determined there are no relevant changes that warrent a new release.\n" diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml new file mode 100644 index 00000000000..426617a7ac9 --- /dev/null +++ b/.github/workflows/integration-test.yml @@ -0,0 +1,79 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support documentation. +# This workflow will download a prebuilt Java version, install dependencies and run integration tests + +name: Run Integration Tests + +on: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + integration_test: + name: Build and Run Integration Tests on Java ${{ matrix.java-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + java-version: ['8'] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java-version }} + distribution: 'adopt' + + - name: Execute Java integration tests + # continue-on-error: true + env: + MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + NATURAL_LANGUAGE_UNDERSTANDING_APIKEY: ${{ secrets.NLU_APIKEY }} + NATURAL_LANGUAGE_UNDERSTANDING_URL: "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com" + SPEECH_TO_TEXT_APIKEY: ${{ secrets.STT_APIKEY }} + SPEECH_TO_TEXT_URL: "https://api.us-south.speech-to-text.watson.cloud.ibm.com" + SPEECH_TO_TEXT_CUSTOM_ID: ${{ secrets.STT_APIKEY_CUSTOM_ID }} + SPEECH_TO_TEXT_ACOUSTIC_CUSTOM_ID: ${{ secrets.STT_APIKEY_ACOUSTIC_CUSTOM_ID }} + TEXT_TO_SPEECH_APIKEY: ${{ secrets.TTS_APIKEY }} + TEXT_TO_SPEECH_URL: "https://api.us-south.text-to-speech.watson.cloud.ibm.com" + ASSISTANT_APIKEY: ${{ secrets.WA_APIKEY }} + ASSISTANT_WORKSPACE_ID: ${{ secrets.WA_WORKSPACE_ID }} + ASSISTANT_ASSISTANT_ID: ${{ secrets.WA_ASSISTANT_ID }} + ASSISTANT_URL: "https://api.us-south.assistant.watson.cloud.ibm.com" + DISCOVERY_V2_APIKEY: ${{ secrets.D2_APIKEY }} + DISCOVERY_V2_PROJECT_ID: ${{ secrets.D2_PROJECT_ID }} + DISCOVERY_V2_COLLECTION_ID: ${{ secrets.D2_COLLECTION_ID }} + DISCOVERY_V2_URL: "https://api.us-south.discovery.watson.cloud.ibm.com" + run: | + mvn test -Dtest=v1/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS + mvn test -Dtest=v2/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS + mvn test -Dtest=v2/DiscoveryIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS + mvn test -Dtest=NaturalLanguageUnderstandingIT -DfailIfNoTests=false -pl natural-language-understanding,common $MVN_ARGS + mvn test -Dtest=SpeechToTextIT -DfailIfNoTests=false -pl speech-to-text,common $MVN_ARGS + mvn test -Dtest=TextToSpeechIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS + mvn test -Dtest=CustomizationsIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS + + # Do not notify on success. We will leave the code here just in case we decide to switch gears + - name: Notify slack on success + if: false # success() + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: watson-e2e-tests + status: SUCCESS + color: good + + - name: Notify slack on failure + if: false # failure() + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: watson-e2e-tests + status: FAILED + color: danger diff --git a/.gitignore b/.gitignore index e061566b939..220350e7b47 100644 --- a/.gitignore +++ b/.gitignore @@ -5,17 +5,62 @@ .idea .project .settings -build out target 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 +package-lock.json +model_result.mlmodel +.openapi-generator-ignore +.openapi-generator/ +package-lock.json +.pre-commit-config.yaml +.secrets.baseline +*.test-metadata.txt +*.py +fix-copyrights.sh +/.utility/secring.gpg +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +/**/target/ +/**/test-output/ +.settings/ +.factorypath +*-apiref.json + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +*.key + +/node_modules \ No newline at end of file diff --git a/.releaserc b/.releaserc new file mode 100644 index 00000000000..5fe2ab68c63 --- /dev/null +++ b/.releaserc @@ -0,0 +1,23 @@ +{ + "debug": true, + "branches": [ "master" ], + "tagFormat": "v${version}", + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/exec", + { + "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" + } + ], + [ + "@semantic-release/git", + { + "message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}" + } + ], + "@semantic-release/github" + ] +} \ No newline at end of file diff --git a/.secrets.baseline b/.secrets.baseline new file mode 100644 index 00000000000..63e7fc50b13 --- /dev/null +++ b/.secrets.baseline @@ -0,0 +1,122 @@ +{ + "exclude": { + "files": "package-lock.json|credentials.json|^.secrets.baseline$", + "lines": null + }, + "generated_at": "2024-02-26T19:16:17Z", + "plugins_used": [ + { + "name": "AWSKeyDetector" + }, + { + "name": "ArtifactoryDetector" + }, + { + "base64_limit": 4.5, + "name": "Base64HighEntropyString" + }, + { + "name": "BasicAuthDetector" + }, + { + "name": "BoxDetector" + }, + { + "name": "CloudantDetector" + }, + { + "ghe_instance": "github.ibm.com", + "name": "GheDetector" + }, + { + "hex_limit": 3, + "name": "HexHighEntropyString" + }, + { + "name": "IbmCloudIamDetector" + }, + { + "name": "IbmCosHmacDetector" + }, + { + "name": "JwtTokenDetector" + }, + { + "keyword_exclude": null, + "name": "KeywordDetector" + }, + { + "name": "MailchimpDetector" + }, + { + "name": "PrivateKeyDetector" + }, + { + "name": "SlackDetector" + }, + { + "name": "SoftlayerDetector" + }, + { + "name": "StripeDetector" + }, + { + "name": "TwilioKeyDetector" + } + ], + "results": { + "CHANGELOG.md": [ + { + "hashed_secret": "939999726d2023fca902233e45790c08081dc91b", + "is_secret": false, + "is_verified": false, + "line_number": 182, + "type": "Hex High Entropy String", + "verified_result": null + } + ], + "assistant/src/test/resources/assistant/assistant.json": [ + { + "hashed_secret": "49568690e3778497671beb117ceecc48e01cdd4c", + "is_secret": false, + "is_verified": false, + "line_number": 117, + "type": "Secret Keyword", + "verified_result": null + } + ], + "assistant/src/test/resources/assistant/message_response.json": [ + { + "hashed_secret": "d506bd5213c46bd49e16c634754ad70113408252", + "is_secret": false, + "is_verified": false, + "line_number": 165, + "type": "Secret Keyword", + "verified_result": null + } + ], + "discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java": [ + { + "hashed_secret": "e8fc807ce6fbcda13f91c5b64850173873de0cdc", + "is_secret": false, + "is_verified": false, + "line_number": 42, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "fdee05598fdd57ff8e9ae29e92c25a04f2c52fa6", + "is_secret": false, + "is_verified": false, + "line_number": 44, + "type": "Secret Keyword", + "verified_result": null + } + ] + }, + "version": "0.13.1+ibm.56.dss", + "word_list": { + "file": null, + "hash": null + } +} diff --git a/.travis.yml b/.travis.yml index 59c4789a68b..02a7a19eae2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,68 +1,78 @@ +--- language: java -sudo: required -dist: precise +dist: xenial +os: linux + jdk: - - oraclejdk7 - - oraclejdk8 + - openjdk8 + +notifications: + email: true branches: except: - - gh-pages - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + - gh-pages cache: directories: - - $HOME/.m2 - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ + - "$HOME/.m2" + env: global: - - secure: S2KIWOJX35j1FczyV7JRFrFpTftb8Hmkf6C50bJh8E03IbPu7tnX2znPKBbRWcIQndO6qd5dL7+BqtXabByOzd5Slj5/NBdXPcGffsO7B0cpFQS8ngpIMAGReCXQ12PbOiO8CIk2f/20lU3L0kqcP1TaPyZYIlSwkUg98ls8p90= - - secure: eLv41LVZoRCqQehOM29RLodZ6NZhrIdLWklAkMdLGlFDEiVY5f0shaPLffpUiuv/3pg+CuQk9ffBc72m8lwTsimex9unC/WVsqQJhqQEWJEaPGL0UamV/HqHMeBQEpKiCcKHaBRHFGk7QQJVtiXvVvlbwk7Jks5giUR7+s/Q6iI= - - secure: l0dde5NSGedD6fny5aMr1ll90FYVd7IKDsZ0Kd1GWnB+iDd3rjDBwz5q6NUwN2LTqw3jWFqmqdEnGUGO3Er0rdfdtPh3K194sTK3XuCZz8GEjFvYAEDRQ59oyK8fhw60c86cWppBQ4gluLKLstm12DLkARTUvJiIsTQTnuc2YGg= - -install: true - -before_install: - - sed -i.bak -e 's|https://nexus.codehaus.org/snapshots/|https://oss.sonatype.org/content/repositories/codehaus-snapshots/|g' ~/.m2/settings.xml + - MVN_ARGS="--settings build/.travis.settings.xml" -script: - - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_b248e84a4806_key -iv $encrypted_b248e84a4806_iv -in config.properties.enc -out core/src/test/resources/config.properties -d || true' - - ./gradlew install -x check - - ./gradlew checkstyleMain - - ./gradlew checkstyleTest - - ./gradlew codeCoverageReport --continue - - ./gradlew docs > /dev/null # build the javadoc +stages: + - name: Build and test + - name: Semantic-Release + if: branch = master AND type = push AND fork = false + - name: Publish-Release + if: tag IS present -after_success: - - bash <(curl -s https://codecov.io/bash) +jobs: + include: + - stage: Build and test + jdk: openjdk8 + language: java + install: + - curl -s https://codecov.io/bash > $HOME/codecov-bash.sh && chmod +x $HOME/codecov-bash.sh + script: + - build/setMavenVersion.sh + - mvn verify -fae -DskipITs $MVN_ARGS + after_success: + - build/publishCodeCoverage.sh -deploy: - - provider: script - script: .utility/push-javadoc-to-gh-pages.sh - skip_cleanup: true - on: - repo: watson-developer-cloud/java-sdk - jdk: oraclejdk7 - tags: true + - stage: Semantic-Release + install: + - sudo apt-get install python + - nvm install 12 + - npm install -g npm@6.x + - pip install --user bump2version + - npm install @semantic-release/changelog + - npm install @semantic-release/exec + - npm install @semantic-release/git + - npm install @semantic-release/github + script: + - npx semantic-release + after_success: + - echo "Semantic release has successfully created a new tagged-release" - - provider: script - script: .utility/deploy.sh - skip_cleanup: true - on: - repo: watson-developer-cloud/java-sdk - jdk: oraclejdk7 + - stage: Publish-Release + jdk: openjdk8 + name: Publish-Javadoc + install: true + script: + - build/setMavenVersion.sh + - mvn clean javadoc:aggregate $MVN_ARGS + - build/publishJavadoc.sh + after_success: + - echo "Javadocs successfully published to gh-pages!" - - provider: releases - api_key: ${GITHUB_TOKEN_RELEASES} - file: java-sdk/build/libs/${TRAVIS_BRANCH}-jar-with-dependencies.jar - skip_cleanup: true - on: - repo: watson-developer-cloud/java-sdk - jdk: oraclejdk7 - tags: true -notifications: - email: true + - jdk: openjdk8 + name: Publish-To-Maven-Central + install: true + script: + - build/setupSigning.sh + - build/setMavenVersion.sh + - mvn deploy $MVN_ARGS -DskipTests -P central + after_success: + - echo "Maven artifacts successfully published to Maven Central!" \ No newline at end of file diff --git a/.utility/cd/secring.gpg.enc b/.utility/cd/secring.gpg.enc deleted file mode 100644 index ab53a4058a5..00000000000 Binary files a/.utility/cd/secring.gpg.enc and /dev/null differ diff --git a/.utility/deploy.sh b/.utility/deploy.sh deleted file mode 100755 index 336a80f9b42..00000000000 --- a/.utility/deploy.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then - openssl aes-256-cbc -K $encrypted_2a8b0f951653_key -iv $encrypted_2a8b0f951653_iv -in .utility/cd/secring.gpg.enc -out .utility/cd/secring.gpg -d - ./gradlew uploadArchives -Psigning.keyId=$SIGNING_KEY -Psigning.password=$SIGNING_PASSWORD -Psigning.secretKeyRingFile=$KEYRING_PATH -PossrhUsername=$OSSRH_JIRA_USERNAME -PossrhPassword=$OSSRH_JIRA_PASSWORD -fi diff --git a/.utility/generate_index_html.sh b/.utility/generate_index_html.sh deleted file mode 100755 index c94ba806eae..00000000000 --- a/.utility/generate_index_html.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# based on https://odoepner.wordpress.com/2012/02/17/shell-script-to-generate-simple-index-html/ - -echo ' - - - - - - IBM Watson Developer Cloud - - - -
- - -

Info - | Documentation - | GitHub - | Maven -

- -

Javadoc by branch/tag:

- -
- - -' diff --git a/.utility/push-javadoc-to-gh-pages.sh b/.utility/push-javadoc-to-gh-pages.sh deleted file mode 100755 index e9e3cf887fd..00000000000 --- a/.utility/push-javadoc-to-gh-pages.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" ]; then - - git config --global user.email "wps@us.ibm.com" - git config --global user.name "Watson Github Bot" - git clone --quiet --branch=gh-pages https://${GITHUB_TOKEN_DOCS}@github.com/watson-developer-cloud/java-sdk.git gh-pages > /dev/null - - pushd gh-pages - # on tagged builds, $TRAVIS_BRANCH is the tag (e.g. v1.2.3), otherwise it's the branch name (e.g. master) - rm -rf docs/$TRAVIS_BRANCH - mkdir -p docs/$TRAVIS_BRANCH - - cp -rf ../build/docs/all/* docs/$TRAVIS_BRANCH - ../.utility/generate_index_html.sh > index.html - - # update the latest/ symlink - # on tagged builds, $TRAVIS_TAG is set to the tag, but it's blank on regular builds, unlike $TRAVIS_BRANCH - if [ $TRAVIS_TAG ]; then - rm latest - ln -s ./$TRAVIS_TAG latest - fi - - git add -f . - git commit -m "Latest javadoc for $TRAVIS_BRANCH ($TRAVIS_COMMIT)" - git push -fq origin gh-pages > /dev/null - - popd - - echo -e "Published Javadoc for build $TRAVIS_BUILD_NUMBER ($TRAVIS_JOB_NUMBER) on branch $TRAVIS_BRANCH.\n" - -else - - echo -e "Not publishing docs for build $TRAVIS_BUILD_NUMBER ($TRAVIS_JOB_NUMBER) on branch $TRAVIS_BRANCH of repo $TRAVIS_REPO_SLUG" - -fi diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100755 new mode 100644 index 0141a356f47..b1d7a7bb880 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,526 @@ -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 +# [16.1.0](https://github.com/watson-developer-cloud/java-sdk/compare/v16.0.0...v16.1.0) (2025-11-11) + + +### Features + +* **stt:** add new sad_module param to recognize functions ([1321a46](https://github.com/watson-developer-cloud/java-sdk/commit/1321a46a0d894888330ce6677bef2f5da755c0ff)) +* **tts:** add new voice models ([ef52d55](https://github.com/watson-developer-cloud/java-sdk/commit/ef52d55d3abf731410e9fd3aaf41ea7f58738b97)) + +# [16.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v15.0.0...v16.0.0) (2025-10-09) + + +### Bug Fixes + +* **wa-v2:** fix missing path parameter in HTTP request creation for message functions ([c379682](https://github.com/watson-developer-cloud/java-sdk/commit/c3796825e2bad8f9b2177be3572929397387ad48)) + + +### Features + +* **wa-v2:** add environmentId param to sessions functions and update sdk headers ([7d33340](https://github.com/watson-developer-cloud/java-sdk/commit/7d33340f84796145516e615f0c59c94c52325468)) + + +### BREAKING CHANGES + +* **wa-v2:** `assistantId` and `environmentId` are now required parameters for the `createSession` and `deleteSession` functions + +# [15.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v14.0.2...v15.0.0) (2025-06-18) + + +### Features + +* **stt,tts:** new models and voices ([e2aaf08](https://github.com/watson-developer-cloud/java-sdk/commit/e2aaf0850dd30ce1dfe8c9534171b84a1a146765)) +* **wa-v2:** add new turn event type ([3ec3da0](https://github.com/watson-developer-cloud/java-sdk/commit/3ec3da0fff08ac3b4d1314b9b8c6767d4645ed6c)) + + +### BREAKING CHANGES + +* **wa-v2:** conversationalSearch is now a required parameter when constructing SearchSettings + +Add new llmMetadata property +Add new turn event TurnEventGenerativeAICalledCallout + +## [14.0.2](https://github.com/watson-developer-cloud/java-sdk/compare/v14.0.1...v14.0.2) (2025-05-27) + + +### Bug Fixes + +* **wa-v2:** add missing turn events ([99970d2](https://github.com/watson-developer-cloud/java-sdk/commit/99970d25be792724509df4aad804a8d4cbd164b7)) + +## [14.0.1](https://github.com/watson-developer-cloud/java-sdk/compare/v14.0.0...v14.0.1) (2025-05-07) + + +### Bug Fixes + +* **wa-v2:** add conversational_search_end turn event ([ca524b1](https://github.com/watson-developer-cloud/java-sdk/commit/ca524b1753150ff7f5b0b8a2fac17428a3c41c8d)) + +# [14.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v13.0.0...v14.0.0) (2024-12-05) + + +### Bug Fixes + +* **nlu:** remove summarization param ([3fa8b85](https://github.com/watson-developer-cloud/java-sdk/commit/3fa8b850dac020d11fa3534236723afaeb1af089)) + + +### Features + +* **discov1:** remove discoV1 ([2d64d0d](https://github.com/watson-developer-cloud/java-sdk/commit/2d64d0d76b2838617c639b9eb651df4460628398)) +* **discov2:** add methods for new batches api ([750a115](https://github.com/watson-developer-cloud/java-sdk/commit/750a1155f081ff1bddcb9b963f3c56e3402595b9)) +* **lt:** remove lt and other deprecated resources ([254428b](https://github.com/watson-developer-cloud/java-sdk/commit/254428b0bd0167c0df3acfefe1128a9655cd5d7e)) +* **stt:** add new speech models ([5ca34b2](https://github.com/watson-developer-cloud/java-sdk/commit/5ca34b2542ca3aff3f2c1d039dbf9ae99eb62504)) +* **stt:** readd interimResults and lowLatency wss params ([6696356](https://github.com/watson-developer-cloud/java-sdk/commit/669635661a4eb81847e448d40bb8181509beada1)) +* **WxA:** add new functions and update required params ([a429786](https://github.com/watson-developer-cloud/java-sdk/commit/a429786aed4c0e9c8411599fcd262343eb831905)) + + +### BREAKING CHANGES + +* **WxA:** `environmentId` now required for `message` and `messageStateless` functions + +Add support for message streaming and new APIs +New functions: createProviders, listProviders, updateProviders, createReleaseExport, downloadReleaseExport, createReleaseImport, getReleaseImportStatus, messageStream, messageStreamStateless +* **lt:** LanguageTranslator functionality has been removed +* **discov1:** DiscoveryV1 functionality has been removed + +# [13.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v12.0.1...v13.0.0) (2024-05-20) + + +### Features + +* **discov2:** add ocrEnabled parameter ([45ec51d](https://github.com/watson-developer-cloud/java-sdk/commit/45ec51d59adce5923f30e59790d08d22002c6417)) +* **stt:** add speechBeginEvent param to recognize func ([5cb5238](https://github.com/watson-developer-cloud/java-sdk/commit/5cb5238bb7822c6397c0fe2fdf7c0c71dae600ac)) +* **stt:** remove interimResults and lowLatency wss params ([4c571c2](https://github.com/watson-developer-cloud/java-sdk/commit/4c571c22e725858908b57628ec251b178e763392)) + + +### BREAKING CHANGES + +* **stt:** RecognizeWithWebsocketsOptions interimResults and +lowLatency properties removed + +## [12.0.1](https://github.com/watson-developer-cloud/java-sdk/compare/v12.0.0...v12.0.1) (2024-03-13) + + +### Bug Fixes + +* **stt:** change smartFormattingVersion to a Long ([258c406](https://github.com/watson-developer-cloud/java-sdk/commit/258c406c6d38f676d1961691453742cd6402cc45)) +* **wss:** add smartFormattingVersion to websockets ([9806d3c](https://github.com/watson-developer-cloud/java-sdk/commit/9806d3cce178322c2011451fc7e41e67539d90ca)) + +# [12.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v11.0.1...v12.0.0) (2024-02-26) + + +### Bug Fixes + +* **wa-v2:** fix tests and delete unused models ([3e7e9c7](https://github.com/watson-developer-cloud/java-sdk/commit/3e7e9c79dd524833f8a1ccaa50f60e9a6ef969cb)) + + +### Features + +* **disco-v2:** class changes ([ba46325](https://github.com/watson-developer-cloud/java-sdk/commit/ba463252ae00560c0cec40c960b7649efd06fd83)) +* **discov2:** new EnrichmentOptions parameters ([78d93b7](https://github.com/watson-developer-cloud/java-sdk/commit/78d93b70dd570ce8acd8260b676b0d124f31de9d)) +* **mcsp:** update sdk-core for MCSP authenticator support ([8e9f831](https://github.com/watson-developer-cloud/java-sdk/commit/8e9f8319f92f51d74d4fc1b1a433e0415a38b206)) +* **nlu:** add support for userMetadata param ([a00b9d7](https://github.com/watson-developer-cloud/java-sdk/commit/a00b9d76dddb1bfba98db8938f4f07ddbaa56de7)) +* **stt:** new params ([56755c6](https://github.com/watson-developer-cloud/java-sdk/commit/56755c6f50bf0638de3c85093ea819db7e7071fe)) +* **wa-v2:** new method params ([439ed47](https://github.com/watson-developer-cloud/java-sdk/commit/439ed4784e9a0a1d510bacfa0b0cd656afa87dff)) +* **wa-v2:** support for private variables ([89f2209](https://github.com/watson-developer-cloud/java-sdk/commit/89f2209f937a22b6b00fa26cfddcb4ab991c541f)) + + +### BREAKING CHANGES + +* **disco-v2:** TableBodyCells properties changed to string lists. +Location property changed from Map to TableElementLocation. +* **wa-v2:** Multiple class name changes and Log class property type +changes + +## [11.0.1](https://github.com/watson-developer-cloud/java-sdk/compare/v11.0.0...v11.0.1) (2023-08-08) + + +### Bug Fixes + +* **pom:** upgrade sdk-core ([#1220](https://github.com/watson-developer-cloud/java-sdk/issues/1220)) ([5ce39c7](https://github.com/watson-developer-cloud/java-sdk/commit/5ce39c7c800bd8ae7b4dfa17ffdaf7a865f1fc4c)) + +# [11.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v10.1.0...v11.0.0) (2023-03-16) + + +### Features + +* **assistantv1:** update based on api definitions ([d2aebb9](https://github.com/watson-developer-cloud/java-sdk/commit/d2aebb9b0f9428b9ba7673f6e768049df32acac7)) +* **assistantv2:** add new assistant, environment, and skills lifecycle methods ([aaf9b77](https://github.com/watson-developer-cloud/java-sdk/commit/aaf9b773317042358240fb62fd369dad69678092)) +* **discoveryv1:** update based on latest api definitions ([a810f01](https://github.com/watson-developer-cloud/java-sdk/commit/a810f01ef76b8513f26c0fc1a0e07a06d5bad50c)) +* **discoveryv2:** update based on api definitions ([1e2682f](https://github.com/watson-developer-cloud/java-sdk/commit/1e2682f82318500d817c4a9e78493277773780f1)) +* **language translator:** update based on api definitions ([d45607b](https://github.com/watson-developer-cloud/java-sdk/commit/d45607b472b5c1899cba393e628c1d632ffcf6f0)) +* **natural language understanding:** update based on api definitions ([a743cb7](https://github.com/watson-developer-cloud/java-sdk/commit/a743cb7f774b66790da4e9fbe059602e93cbbf6f)) +* **speech to text:** update based on new api definitions ([0a7058b](https://github.com/watson-developer-cloud/java-sdk/commit/0a7058bc169c8d39a7e541b677108e75d2067bbe)) +* **text to speech:** update based on api definitions ([54fd47d](https://github.com/watson-developer-cloud/java-sdk/commit/54fd47dd50ea517834c4109a1ecca87785662507)) + + +### BREAKING CHANGES + +* **natural language understanding:** removes the 'sentimentModel' functions and models +* **discoveryv2:** enrichmentId is now a required param for 'DocumentClassifierEnrichment' model. +'confidence' property has been removed from 'QueryResponsePassage' and 'QueryResultPassage' models. +Breaking interface changes to handling aggregation discriminators. +* **assistantv2:** 'createSession' param replaced with 'requestAnalytics' param. 'language' property +removed from 'Environment' model. method name changes in environment and release models. +* **assistantv1:** public interface 'Model' in 'WorkspaceSystemSettingsNlp' has been removed + +# [10.1.0](https://github.com/watson-developer-cloud/java-sdk/compare/v10.0.1...v10.1.0) (2022-08-10) + + +### Bug Fixes + +* **assistantv2:** add discrim bug hand edit for TurnEvent models ([4f4894f](https://github.com/watson-developer-cloud/java-sdk/commit/4f4894f17197d9bebf138e539758b5c072dcc36a)) +* **discov2:** make enrichement_id required and linting changes ([995e687](https://github.com/watson-developer-cloud/java-sdk/commit/995e687a07a1af9806b2f66dbcdeeaac03978d8b)) + + +### Features + +* **assistantv1:** update models and add new methods ([64a2622](https://github.com/watson-developer-cloud/java-sdk/commit/64a2622378df1874e3e259c09bceb9978a3a9aba)) +* **assistantv2:** update models and add new methods ([2f164cd](https://github.com/watson-developer-cloud/java-sdk/commit/2f164cd0a1f48749044c8b70f5e95ce72a3a69fc)) +* **discov2:** update models and add new methods ([a29cb73](https://github.com/watson-developer-cloud/java-sdk/commit/a29cb7311798d7023112773b930bde993be2d804)) +* **nlu:** add new parameter to create/updateClassificationsModel ([680d2c0](https://github.com/watson-developer-cloud/java-sdk/commit/680d2c0a94198ca4ec605755a89f47b4f8cca296)) +* **stt:** add and remove method parameters ([cdcc228](https://github.com/watson-developer-cloud/java-sdk/commit/cdcc2280e528ac5e2900b032a82dbb3020237b8f)) +* **tts:** add method parameters ([2a0c2f3](https://github.com/watson-developer-cloud/java-sdk/commit/2a0c2f3f64c07bed920639daa391e976f75d790f)) +* **wss:** add and remove websocket params ([bfd4b0d](https://github.com/watson-developer-cloud/java-sdk/commit/bfd4b0df203f3f0dac51c5b29bcb8895b7847b14)) + +## [10.0.1](https://github.com/watson-developer-cloud/java-sdk/compare/v10.0.0...v10.0.1) (2022-04-25) + + +### Bug Fixes + +* **language-translator-v3:** add content-type to createModelOptions model properties ([afd1086](https://github.com/watson-developer-cloud/java-sdk/commit/afd1086ccbb30fa1d84b83e19c9d9a7bf472b4bc)) + +# [10.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v9.3.1...v10.0.0) (2022-03-21) + + +### Bug Fixes + +* **bumpversion:** update bumpversion file ([ca7b4e8](https://github.com/watson-developer-cloud/java-sdk/commit/ca7b4e87279d63fea920e279de88c80516d3bca3)) + + +### Features + +* **assistant-v1:** add new DialogNodeOutputGeneric subclasses & additional properties in workspace ([dfeacca](https://github.com/watson-developer-cloud/java-sdk/commit/dfeacca3201245a1a5902669be9e051dcb320506)) +* **assistant-v1:** generated using api-def: master & generator: 3.46.0 ([dc7f6a4](https://github.com/watson-developer-cloud/java-sdk/commit/dc7f6a4acad722a507724732f7e17ffeb992d4ba)) +* **assistant-v2:** generated using api-def: master & generator: 3.46.0 ([4fdfb2f](https://github.com/watson-developer-cloud/java-sdk/commit/4fdfb2faca5a047d841de45cba0ca26633618ef3)) +* **deprecation:** remove CC, NLC, PI, Tone Analyzer, and Visual Recognition ([1b64285](https://github.com/watson-developer-cloud/java-sdk/commit/1b64285fd5b3d0765e2435627ae65ffcce097136)) +* **discovery-v1:** document status & query aggregation update ([776048c](https://github.com/watson-developer-cloud/java-sdk/commit/776048cbc7a2d2938d63bfb6eabcc4fded56a44b)) +* **speech-to-text-v1:** add de-de_multimedia & update comments ([0d32576](https://github.com/watson-developer-cloud/java-sdk/commit/0d32576bc7405e6a4c39f01688b41f1e5bab180b)) +* **speech-to-text-v1:** add missing import ([029fdfa](https://github.com/watson-developer-cloud/java-sdk/commit/029fdfa9afc51acc3f673daf07aa43dec6dd4691)) +* **speech-to-text-v1:** supportedFeatures: customAcousticModel property added & update comments ([62e4f8e](https://github.com/watson-developer-cloud/java-sdk/commit/62e4f8ec354d2746acdcd07bce28dec348214fba)) +* **text-to-speech-v1:** add voices and update comments ([40cd035](https://github.com/watson-developer-cloud/java-sdk/commit/40cd0358c131d2e3767b16d9bedf2ddd256e7fd2)) + + +### Reverts + +* **pom.xml:** revert change for root pom.xml ([5fecba8](https://github.com/watson-developer-cloud/java-sdk/commit/5fecba83ac663ceb6766061c81878369a46963f7)) + + +### BREAKING CHANGES + +* **discovery-v1:** QueryAggregation: BREAKING QueryAggregation subclasses changed. +* **assistant-v2:** MessageOutputDebug: BREAKING nodesVisited type DialogNodesVisited changed to +DialogNodeVisited, RuntimeEntity: BREAKING optional metadata property removed +* **assistant-v1:** OutputData: BREAKING required text property removed, RuntimeEntity: BREAKING +optional metadata property removed + +## [9.3.1](https://github.com/watson-developer-cloud/java-sdk/compare/v9.3.0...v9.3.1) (2021-12-02) + + +### Bug Fixes + +* **deploy.yml:** up the version for node to fix semantic-release ([bcda21d](https://github.com/watson-developer-cloud/java-sdk/commit/bcda21d843a55ff81894735c720dc47775890ae4)) +* **pom.xml:** update sdk-core version to fix Gson 2.8.9 java.lang.NoSuchFieldError ([40b287e](https://github.com/watson-developer-cloud/java-sdk/commit/40b287ecd79dfb898de3051d673cd406af7364a7)) + +# [9.3.0](https://github.com/watson-developer-cloud/java-sdk/compare/v9.2.2...v9.3.0) (2021-09-14) + + +### Bug Fixes + +* **assistant-v1:** location is no longer a required parameter for RuntimeEntity ([4014b36](https://github.com/watson-developer-cloud/java-sdk/commit/4014b365cd862ceca885855796fc8595c7662f36)) +* **assistant-v2:** add answers to searchResult ([8d53d6c](https://github.com/watson-developer-cloud/java-sdk/commit/8d53d6c71b6ef6fb31119ed5bcd082e1bf6dcbb6)) +* **assistant-v2:** location is no longer a required parameter for RuntimeEntity ([2971a3b](https://github.com/watson-developer-cloud/java-sdk/commit/2971a3b22fab6092e5f4c05c6e96f2871c5d4905)) +* **discovery-v1:** change authentication to authenticated property in StatusDetails ([e7b3cae](https://github.com/watson-developer-cloud/java-sdk/commit/e7b3caeebc07e53a11421369237c013df6dd1d88)) +* **discovery-v1:** status is now deserialized as an object ([c72b497](https://github.com/watson-developer-cloud/java-sdk/commit/c72b497317ca33a9b6017458f8f2fce9ee528748)) +* **natural-language-understanding-v1:** listClassificationsModels return type change ([5776b7b](https://github.com/watson-developer-cloud/java-sdk/commit/5776b7b97cedef31420fe88fa59d7e3fce048638)) +* **natural-language-understanding-v1:** remove unused models ([8e894dc](https://github.com/watson-developer-cloud/java-sdk/commit/8e894dc16b8aeabf76f9e9c33977188a9f840d16)) + + +### Features + +* **assistant-v1:** add altText property to DialogNodeOutputGeneric & RuntimeResponseGeneric ([66acc78](https://github.com/watson-developer-cloud/java-sdk/commit/66acc78bcb3ce1d4fe495c93ca646d4d8741c98a)) +* **assistant-v1:** add extra sensitivity values for RuntimeResponseGenericRuntimeResponseTypeImage ([86b331d](https://github.com/watson-developer-cloud/java-sdk/commit/86b331d935b8b1719cb7b1cafff24baaaa423506)) +* **assistant-v2:** add altText property to RuntimeResponseGeneric ([798f780](https://github.com/watson-developer-cloud/java-sdk/commit/798f780b71a67ec3e3b13ef19f44dec151d3c22c)) +* **assistant-v2:** add SEARCH as a type of the message to MessageInput & MessageInputStateless ([b9a3427](https://github.com/watson-developer-cloud/java-sdk/commit/b9a342794f2594033c5a48b8323610f30eedd527)) +* **assistant-v2:** add sessionStartTime & state properties to MessageContextGlobalSystem ([6cd0b2e](https://github.com/watson-developer-cloud/java-sdk/commit/6cd0b2e50079f7435ee935588d2a38cdc7c5bab7)) +* **discovery-v2:** add CONVERSATIONAL_SEARCH & CONTENT_INTELLIGENCE as a type of a project ([ec6e753](https://github.com/watson-developer-cloud/java-sdk/commit/ec6e7531d8c39a0c3aa3c4a392071e982a1fba65)) +* **speech-to-text-v1:** add more languages supported for next generation models ([2fbd050](https://github.com/watson-developer-cloud/java-sdk/commit/2fbd050306f2912fc7648e4ed70cd48abea54dad)) +* **speech-to-text-v1:** add more languages supported for next generation models ([c03ea09](https://github.com/watson-developer-cloud/java-sdk/commit/c03ea099880c06f1717486c226debfede9eeb30b)) +* **text-to-speech-v1:** add new voice models ([54d2338](https://github.com/watson-developer-cloud/java-sdk/commit/54d2338a4d216e629db767415d6e066e6e22a45e)) + +## [9.2.2](https://github.com/watson-developer-cloud/java-sdk/compare/v9.2.1...v9.2.2) (2021-09-01) + + +### Bug Fixes + +* **nlc:** add a deprecation message ([#1185](https://github.com/watson-developer-cloud/java-sdk/issues/1185)) ([b460cdd](https://github.com/watson-developer-cloud/java-sdk/commit/b460cddc4e1b27765441a8cfc1e0139bd92b5ff7)) + +## [9.2.1](https://github.com/watson-developer-cloud/java-sdk/compare/v9.2.0...v9.2.1) (2021-08-17) + + +### Bug Fixes + +* **deploy:** use bump2version ([d4bbc44](https://github.com/watson-developer-cloud/java-sdk/commit/d4bbc44cd49b4227cd2338f99a0aad58c0019753)) +* **deploy:** use python ([03168b4](https://github.com/watson-developer-cloud/java-sdk/commit/03168b48e64780f3d17eb714f2adf6ff8c479d26)) +* **deploy.xml:** fix typo on deploy.xml gha ([9136c47](https://github.com/watson-developer-cloud/java-sdk/commit/9136c47c549be29b7b600e844946da928ca42890)) +* **pom.xml:** update java-sdk-core version ([c6814a5](https://github.com/watson-developer-cloud/java-sdk/commit/c6814a58a4a271689fa1df8d3dc4772c838bce05)) + +# [9.2.0](https://github.com/watson-developer-cloud/java-sdk/compare/v9.1.1...v9.2.0) (2021-06-02) + + +### Bug Fixes + +* **text-to-speech-v1:** generated using api def sdk-2021-05-11-rerelease and gen 3.31.0 ([e825419](https://github.com/watson-developer-cloud/java-sdk/commit/e8254194cd199c3039a61a58c65039eadecfb562)) + + +### Features + +* **generation:** generated using api def sdk-2021-05-11 & gen 3.31.0 ([82ef647](https://github.com/watson-developer-cloud/java-sdk/commit/82ef647c855b7d226104ab4a3bf56de8dce748c5)) +* **generation:** generated using api def: sdk-2021-05-11 and generator: 3.31.0 ([c039886](https://github.com/watson-developer-cloud/java-sdk/commit/c039886481d21e70c2d66bbf3aacb56543ada9a3)) +* **natural-language-understanding-v1:** generated using api def 5b4cdff & gen 3.31.0 ([ac51578](https://github.com/watson-developer-cloud/java-sdk/commit/ac515782a0e1e1541b3852d490d0ad8f8d8fce9e)) + +## [9.1.1](https://github.com/watson-developer-cloud/java-sdk/compare/v9.1.0...v9.1.1) (2021-05-17) + + +### Bug Fixes + +* **bumpversion:** update bumpversion configuration ([e6b97d6](https://github.com/watson-developer-cloud/java-sdk/commit/e6b97d6d13a627290dea54dea14d67d6aab3bdfa)) + +# [9.1.0](https://github.com/watson-developer-cloud/java-sdk/compare/v9.0.2...v9.1.0) (2021-04-30) + + +### Bug Fixes + +* **assistant-v1:** override toString method to allow null values ([dc0a023](https://github.com/watson-developer-cloud/java-sdk/commit/dc0a023d6b1f6748134d584f71dc804494ade737)) + + +### Features + +* **assistant-v1:** add updateDialogNodeNullable as a new function ([90e3ea5](https://github.com/watson-developer-cloud/java-sdk/commit/90e3ea5c7f9036c096721724320e7f4000b91325)) + +## [9.0.2](https://github.com/watson-developer-cloud/java-sdk/compare/v9.0.1...v9.0.2) (2020-12-21) + + +### Bug Fixes + +* **generation:** api def '8be1cdc78c7998b055bc8ea895dddd7c8496b2a4' gen tag 3.19.0 ([1ddf534](https://github.com/watson-developer-cloud/java-sdk/commit/1ddf534ff0d10481e7246abb37df1b88d9421d9e)) + +## [9.0.1](https://github.com/watson-developer-cloud/java-sdk/compare/v9.0.0...v9.0.1) (2020-12-11) + + +### Bug Fixes + +* **readme:** add extra line to readme to trigger patch release ([f5d1a06](https://github.com/watson-developer-cloud/java-sdk/commit/f5d1a0696835e079a3349b5a4575a1d1a1658047)) + +# [9.0.0](https://github.com/watson-developer-cloud/java-sdk/compare/v8.6.3...v9.0.0) (2020-12-10) + + +### Bug Fixes + +* **sdk-version:** fix sdk-version ([3019159](https://github.com/watson-developer-cloud/java-sdk/commit/3019159999a36e5065bdfe33f2976e625aec10f4)) +* **visual-recognition-v4:** remove trainingStatus as a parameter for create & update Collection ([02e3dfd](https://github.com/watson-developer-cloud/java-sdk/commit/02e3dfd0fb972f3081c91921f6acf61fdcc2f1e6)) +* **visual-recognition-v4:** remove trainingStatus as a parameter for create & update Collection ([5568bf9](https://github.com/watson-developer-cloud/java-sdk/commit/5568bf99e47ad92420253c936db7bc8fac13a7f0)) +* typo in migration guide ([984a350](https://github.com/watson-developer-cloud/java-sdk/commit/984a3503502a7867470b3e342fe959643ae0a561)) +* update version to 9.0.0-rc.2 ([ab57379](https://github.com/watson-developer-cloud/java-sdk/commit/ab573794f351e00f6fb97e3fed0e7d3ad20fb824)) + + +### chore + +* update for semantic-release ([22a7d00](https://github.com/watson-developer-cloud/java-sdk/commit/22a7d008c6e333a944c3b0f6a96f142f587e5aed)) + + +### Features + +* **generation:** api def tag 'sdk-major-release-2020' gen tag 3.19.0 ([3414833](https://github.com/watson-developer-cloud/java-sdk/commit/3414833807abe8534e6daf838500a5426e9e4e04)) +* add bumpversion release candidate support ([b794bb6](https://github.com/watson-developer-cloud/java-sdk/commit/b794bb6407e461af0edd99952e08b98e8d4a95e2)) +* **generation:** api def tag 'sdk-major-release-2020-rc01' gen commit '7cc0550' ([3bec20d](https://github.com/watson-developer-cloud/java-sdk/commit/3bec20d5ccae38ba2a1f1d8adf6cf16cdc2c6a18)) +* **speech-to-text-v1:** add RecognizeWithWebsocketsOptions model ([d3b7fe9](https://github.com/watson-developer-cloud/java-sdk/commit/d3b7fe91fad17fa6ef6dd00a5ecc38b689dfd016)) + + +### BREAKING CHANGES + +* **generation:** api def tag 'sdk-major-release-2020' gen tag 3.19.0 +* generated with 3.18.0 of the IBM openapi sdk generator + +# [9.0.0-rc.3](https://github.com/watson-developer-cloud/java-sdk/compare/v9.0.0-rc.2...v9.0.0-rc.3) (2020-12-03) + + +### Features + +* **generation:** api def tag 'sdk-major-release-2020' gen tag 3.19.0 ([3414833](https://github.com/watson-developer-cloud/java-sdk/commit/3414833807abe8534e6daf838500a5426e9e4e04)) + + +### BREAKING CHANGES + +* **generation:** api def tag 'sdk-major-release-2020' gen tag 3.19.0 + +# [9.0.0-rc.2](https://github.com/watson-developer-cloud/java-sdk/compare/v9.0.0-rc.1...v9.0.0-rc.2) (2020-11-11) + + +### Bug Fixes + +* typo in migration guide ([984a350](https://github.com/watson-developer-cloud/java-sdk/commit/984a3503502a7867470b3e342fe959643ae0a561)) +* update version to 9.0.0-rc.2 ([ab57379](https://github.com/watson-developer-cloud/java-sdk/commit/ab573794f351e00f6fb97e3fed0e7d3ad20fb824)) + + +### Features + +* add bumpversion release candidate support ([b794bb6](https://github.com/watson-developer-cloud/java-sdk/commit/b794bb6407e461af0edd99952e08b98e8d4a95e2)) + +# [9.0.0-rc.1](https://github.com/watson-developer-cloud/java-sdk/compare/v8.6.3...v9.0.0-rc.1) (2020-11-10) + + +### chore + +* update for semantic-release ([22a7d00](https://github.com/watson-developer-cloud/java-sdk/commit/22a7d008c6e333a944c3b0f6a96f142f587e5aed)) + + +### Features + +* **generation:** api def tag 'sdk-major-release-2020-rc01' gen commit '7cc0550' ([3bec20d](https://github.com/watson-developer-cloud/java-sdk/commit/3bec20d5ccae38ba2a1f1d8adf6cf16cdc2c6a18)) +* **speech-to-text-v1:** add RecognizeWithWebsocketsOptions model ([d3b7fe9](https://github.com/watson-developer-cloud/java-sdk/commit/d3b7fe91fad17fa6ef6dd00a5ecc38b689dfd016)) + + +### BREAKING CHANGES + +* generated with 3.18.0 of the IBM openapi sdk generator + +## [8.6.3](https://github.com/watson-developer-cloud/java-sdk/compare/v8.6.2...v8.6.3) (2020-10-26) + + +### Bug Fixes + +* **java-sdk-core-version:** update java-sdk-core version to fix serialization error on disco-v2 ([e75e97d](https://github.com/watson-developer-cloud/java-sdk/commit/e75e97d99b98376d568b87ba9747779bf9c8d39f)) + +## [8.6.2](https://github.com/watson-developer-cloud/java-sdk/compare/v8.6.1...v8.6.2) (2020-10-18) + + +### Bug Fixes + +* **decrpyt-script:** place encrypted file on the right path ([07737f2](https://github.com/watson-developer-cloud/java-sdk/commit/07737f257604defdda795511049b59ab19b8d406)) +* **decrypt-script:** update decrypt script ([2a28685](https://github.com/watson-developer-cloud/java-sdk/commit/2a286855dee6c663b9faeffbcae786364bec8e10)) +* **readme:** create a patch for latest update on speech-to-text ([b858e48](https://github.com/watson-developer-cloud/java-sdk/commit/b858e481ef9961c69e787652c67a9fcca661c0c4)) +* **tests&keys:** update api keys and integration tests ([26049c1](https://github.com/watson-developer-cloud/java-sdk/commit/26049c160b91e23f8f41703f3a90ebfdfb2e778c)) + +## [8.6.1](https://github.com/watson-developer-cloud/java-sdk/compare/v8.6.0...v8.6.1) (2020-09-28) + + +### Bug Fixes + +* **generation:** api def tag 'sdk-2020-08-20' with disco-v2 passage update gen tag '2.3.1' ([1b8b67c](https://github.com/watson-developer-cloud/java-sdk/commit/1b8b67c194c4cd2d0a6b01c43a4e15da31b9294b)) + +# [8.6.0](https://github.com/watson-developer-cloud/java-sdk/compare/v8.5.0...v8.6.0) (2020-08-25) + + +### Features + +* **generation:** api def tag 'sdk-2020-08-20' and gen tag '2.3.1' ([1129e9b](https://github.com/watson-developer-cloud/java-sdk/commit/1129e9b39e417408dc4cb22f497d7f3bb4361f9e)) + +# [8.5.0](https://github.com/watson-developer-cloud/java-sdk/compare/v8.4.0...v8.5.0) (2020-06-03) + + +### Features + +* june release ([a637c98](https://github.com/watson-developer-cloud/java-sdk/commit/a637c985990f7776a7fec25f6190405991a1cc87)) + +# [8.4.0](https://github.com/watson-developer-cloud/java-sdk/compare/v8.3.1...v8.4.0) (2020-04-23) + + +### Bug Fixes + +* **javadoc:** update links to common classes ([973d153](https://github.com/watson-developer-cloud/java-sdk/commit/973d153fa0b66be2ad486f394e87d1f32b9a836a)) + + +### Features + +* **assistant:** auto-generate code ([515fb60](https://github.com/watson-developer-cloud/java-sdk/commit/515fb605e110e3171fcecb1323ae7ccb2ac9a07e)) +* **discovery:** auto-generate code ([9812072](https://github.com/watson-developer-cloud/java-sdk/commit/9812072be571d908156b43a508c61dc5057ef10f)) +* **language-translator:** auto-generate code ([2676798](https://github.com/watson-developer-cloud/java-sdk/commit/2676798211fe65bb972107907df5c4febe813d27)) +* **speech-to-text:** auto-generate code ([2261d67](https://github.com/watson-developer-cloud/java-sdk/commit/2261d67fb350df90bb932c4878edf93001f73dba)) +* **text-to-speech:** auto-generate code ([87be679](https://github.com/watson-developer-cloud/java-sdk/commit/87be6796a17402aa03456de37c2510b889e3fe06)) + +## [8.3.1](https://github.com/watson-developer-cloud/java-sdk/compare/v8.3.0...v8.3.1) (2020-03-06) + + +### Bug Fixes + +* **Discovery v1:** environment document count should use 'available' ([0567073](https://github.com/watson-developer-cloud/java-sdk/commit/0567073cc4e0ed3c83cd095ba9e0bc2c43e8925a)) + +# [8.3.0](https://github.com/watson-developer-cloud/java-sdk/compare/v8.2.1...v8.3.0) (2020-02-24) + + +### Features + +* **assistant:** generated code ([10108d9](https://github.com/watson-developer-cloud/java-sdk/commit/10108d98767413bc23dfdfc8719e58eec0b1e614)) +* **common:** generated code ([cae0d2c](https://github.com/watson-developer-cloud/java-sdk/commit/cae0d2ce1021e6354abc9a7e8b5c71d0bebd934b)) +* **compare-comply:** generated code ([e03192f](https://github.com/watson-developer-cloud/java-sdk/commit/e03192f8e4dbcc7a1d3ffc7cafac47ce1593ad0f)) +* **discovery:** generated code ([4baea9e](https://github.com/watson-developer-cloud/java-sdk/commit/4baea9eed6cefb3b2d9d8f8986b07266509101e6)) +* **examples:** generated code ([2d93247](https://github.com/watson-developer-cloud/java-sdk/commit/2d932472659bc7b53259028062bcaf857ce98b18)) +* **language-translator:** generated code ([65f5d55](https://github.com/watson-developer-cloud/java-sdk/commit/65f5d5505994a59d10a460bcfbea1c8586366572)) +* **natural-language-classifier:** generated code ([d088954](https://github.com/watson-developer-cloud/java-sdk/commit/d088954520bf9fb8be347212dbe486d629a66341)) +* **natural-language-understanding:** generated code ([5d2dd6d](https://github.com/watson-developer-cloud/java-sdk/commit/5d2dd6d75cb6c07c23dd0765b69e605e0efdd170)) +* **personality-insights:** generated code ([883b971](https://github.com/watson-developer-cloud/java-sdk/commit/883b9717c42466e050d673acbcccff90429889dd)) +* **speech-to-text:** generated code ([d3de7f1](https://github.com/watson-developer-cloud/java-sdk/commit/d3de7f1ef6c16a003f13430207ca23f4c5576789)) +* **text-to-speech:** generated code ([f4548f2](https://github.com/watson-developer-cloud/java-sdk/commit/f4548f2d436157fe43b9bcd0ab129948acc70d26)) +* **tone-analyzer:** generated code ([a753857](https://github.com/watson-developer-cloud/java-sdk/commit/a753857949d42b4a4dc3c5a4b5e6a05861128ee0)) +* **visual-recognition:** generated code ([8d16bf3](https://github.com/watson-developer-cloud/java-sdk/commit/8d16bf3fdc4c7a8715119552dc334336253baa73)) + +## [8.2.1](https://github.com/watson-developer-cloud/java-sdk/compare/v8.2.0...v8.2.1) (2020-01-18) + + +### Bug Fixes + +* **Natural Language Understanding:** Add back model parameter in CategoriesOptions which was mistake ([58111ff](https://github.com/watson-developer-cloud/java-sdk/commit/58111ff5e14dca1cea3e8eaca53404a2a6dbcb85)) + +# [8.2.0](https://github.com/watson-developer-cloud/java-sdk/compare/v8.1.0...v8.2.0) (2020-01-16) + + +### Bug Fixes + +* **Discovery v1:** Ensure collectionIds are supplied to avoid service error ([955742b](https://github.com/watson-developer-cloud/java-sdk/commit/955742b4bd41640a86c8f2eee9b89231068b0654)) +* **Discovery v2:** Ensure all required props are sent to prevent service errors ([aab26b7](https://github.com/watson-developer-cloud/java-sdk/commit/aab26b738cf8c0778afd0fda493147ea49407b75)) + + +### Features + +* **Assistant v2:** Add system prop to MessageContentSkill ([b95388a](https://github.com/watson-developer-cloud/java-sdk/commit/b95388a9196a152a1cc5d86fc5ee803a6389def2)) +* **Speech to Text:** Add endOfPhraseSilenceTime and splitTranscriptAtPhraseEnd props to CreateJobOp ([be54f7f](https://github.com/watson-developer-cloud/java-sdk/commit/be54f7fe80d7eccb8af40912905759202940715f)) +* **Speech to Text:** Add endOfUtterance prop to SpeechRecognitionResult ([42f6ec6](https://github.com/watson-developer-cloud/java-sdk/commit/42f6ec65b1536d578f7464822d94db7639a9df81)) +* **Speech to Text:** Add support for Italian and Dutch models ([6f707da](https://github.com/watson-developer-cloud/java-sdk/commit/6f707da5120a870cc6fa2d84df5f70bfb7993f23)) +* **Text to Speech:** Add Argentinean, Dutch, and Chinese voices ([62259ca](https://github.com/watson-developer-cloud/java-sdk/commit/62259ca1bead8e97bb3a037b39d0699ade5e166a)) + +# [8.1.0](https://github.com/watson-developer-cloud/java-sdk/compare/java-sdk-8.0.1...java-sdk-8.1.0) (2019-11-27) + + +### Bug Fixes + +* **Discovery:** Add GenericQueryAggregation classes ([11f04fb](https://github.com/watson-developer-cloud/java-sdk/commit/11f04fb3329781f1ffc159755086882b7805aff9)) +* **Discovery v1:** Remove incorrectly-defined title prop from QuertResult and QueryNoticesResult ([28d4f5c](https://github.com/watson-developer-cloud/java-sdk/commit/28d4f5c9d08d0ab18cfe41f28fe942b69dc76d35)) +* **Visual Recognition:** Fix incorrectly-defined errors property in Image and ImageDetails ([5ce250b](https://github.com/watson-developer-cloud/java-sdk/commit/5ce250b54fb6705636c494be5bdaf3716fd7e15b)) + + +### Features + +* **Assistant v1:** Add disambiguationOptOut prop to dialog nodes ([38c610c](https://github.com/watson-developer-cloud/java-sdk/commit/38c610c2184b84d1a8350ee30744df147fb4566e)) +* **Assistant v1:** Add offTopic prop to WorkspaceSystemSettings ([34809d3](https://github.com/watson-developer-cloud/java-sdk/commit/34809d3c5175799fca1a100dec6ecf71da411581)) +* **Assistant v1:** Add randomize and maxSuggestions props to WorkspaceSystemSettingsDisambiguation ([8db7136](https://github.com/watson-developer-cloud/java-sdk/commit/8db7136c345bcd333b648b2f506000c99a12811b)) +* **Assistant v1:** Add suggestionTextPolicy prop to WorkspaceSystemSettingsDisambiguation ([2741942](https://github.com/watson-developer-cloud/java-sdk/commit/27419420cc8b150440dbf1758a163b5e5fe3ebca)) +* **Assistant v1:** Add webhook functionality ([252f385](https://github.com/watson-developer-cloud/java-sdk/commit/252f3850fbf0b853d3cf18dda13945a1acf11237)) +* **Discovery v2:** Add custom deserializer for aggregations ([a6dec27](https://github.com/watson-developer-cloud/java-sdk/commit/a6dec27245c7675c1619763bbb874516323c8999)) +* **Discovery v2:** Add initial generation of service ([ac17067](https://github.com/watson-developer-cloud/java-sdk/commit/ac17067ea1493f1afca6d5f813980533af6b4534)) +* **Visual Recognition v4:** Add getTrainingUsage method ([14fefbd](https://github.com/watson-developer-cloud/java-sdk/commit/14fefbd74572d6dcc72e895961a50485697fa166)) +* **Visual Recognition v4:** Add THUMBNAIL size constant to GetJpegImageOptions ([ee3298d](https://github.com/watson-developer-cloud/java-sdk/commit/ee3298d46f86e172a2f92eee8debcab34c35fb47)) + +## [8.0.1](https://github.com/watson-developer-cloud/java-sdk/compare/java-sdk-8.0.0...java-sdk-8.0.1) (2019-11-12) + + +### Bug Fixes + +* Update core dependency to remove unwanted transitive dependencies ([95c759a](https://github.com/watson-developer-cloud/java-sdk/commit/95c759a625187430d09bd564ddc4f73988afbc34)) diff --git a/MIGRATION.md b/MIGRATION.md deleted file mode 100644 index 3249733f932..00000000000 --- a/MIGRATION.md +++ /dev/null @@ -1,97 +0,0 @@ -# 4.0 - -## Conversation - -- No old version dates -- just current -- All methods now take options objects, e.g.: - - ```java - MessageRequest request = new MessageRequest.Builder() - .inputText(message) - .build(); - service.message(workspaceId, request).execute(); - ``` - is now: - - ```java - MessageOptions messageOptions = new MessageOptions.Builder() - .workspaceId(workspaceId) - .input(new InputData.Builder(message).build()) - .build(); - service.message(messageOptions).execute(); - ``` -- `Context` is now a formal class that extends map. -- Many classes have been renamed - mostly dropping "Response" from classnames. - - `EntityResponse` is now `Entity` - - `ExampleResponse` is now `Example` - - `IntentResponse` is now Intent - - `WorkspaceResponse` is now `Workspace` - - _This renaming was done for simplicity and to improve consistency across SDKs going forward._ - -- Counterexample now has its own classes no longer overloaded on Example - -## Tone Analyzer - -- The method `getTone()` was replaced with: `tone()`. - - For example: - - ```java - public ServiceCall getTone(String text, ToneOptions options) - ``` - - Is now: - ```java - public ServiceCall tone(ToneOptions options) - ``` - - `tone()` example: - ```java - ToneOptions toneOptions = new ToneOptions.Builder() - .text(text) - .build(); - ToneAnalysis tone = service.tone(toneOptions).execute(); - ``` - -- The method `getToneChat()` was replaced with: `toneChat()`. - - For example: - - ```java - public ServiceCall getChatTone(ToneChatRequest options) - ``` - - Is now: - - ```java - public ServiceCall chatTone(ToneChatOptions options) { - - ``` - - `chatTone()` example: - ```java - String[] texts = { - "My charger isn't working.", - "Thanks for reaching out. Can you give me some more detail about the issue?", - "I put my charger in my tablet to charge it up last night and it keeps saying it isn't" - + " charging. The charging icon comes on, but it stays on even when I take the charger out. " - + "Which is ridiculous, it's brand new.", - "I'm sorry you're having issues with charging. What kind of charger are you using?" - }; - - List utterances = new ArrayList<>(); - for (int i = 0; i < texts.length; i++) { - Utterance utterance = new Utterance.Builder() - .text(texts[i]) - .user(users[i]) - .build(); - utterances.add(utterance); - } - ToneChatOptions toneChatOptions = new ToneChatOptions.Builder() - .utterances(utterances) - .build(); - - // Call the service - UtteranceAnalyses utterancesTone = service.toneChat(toneChatOptions).execute(); - ``` \ No newline at end of file diff --git a/README.md b/README.md index 1735465e460..ab338ba30cb 100644 --- a/README.md +++ b/README.md @@ -1,298 +1,501 @@ # Watson APIs Java SDK +[![Build and Test](https://github.com/watson-developer-cloud/java-sdk/actions/workflows/build-test.yml/badge.svg)](https://github.com/watson-developer-cloud/java-sdk/actions/workflows/build-test.yml) +[![Deploy and Publish](https://github.com/watson-developer-cloud/java-sdk/actions/workflows/deploy.yml/badge.svg)](https://github.com/watson-developer-cloud/java-sdk/actions/workflows/deploy.yml) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson/ibm-watson/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson/ibm-watson) +[![CLA assistant](https://cla-assistant.io/readme/badge/watson-developer-cloud/java-sdk)](https://cla-assistant.io/watson-developer-cloud/java-sdk) +## Deprecated builds [![Build Status](https://travis-ci.org/watson-developer-cloud/java-sdk.svg?branch=master)](https://travis-ci.org/watson-developer-cloud/java-sdk) -[![Slack](https://wdc-slack-inviter.mybluemix.net/badge.svg)](https://wdc-slack-inviter.mybluemix.net) -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson.developer_cloud/java-sdk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson.developer_cloud/java-sdk) -[![CLA assistant](https://cla-assistant.io/readme/badge/watson-developer-cloud/java-sdk)](https://cla-assistant.io/watson-developer-cloud/java-sdk) -Node.js client library to use the [Watson APIs][wdc]. - -
- Table of Contents - - * [Installation](#installation) - * [Maven](#maven) - * [Gradle](#gradle) - * [Usage](#usage) - * [Getting the Service Credentials](#getting-the-service-credentials) - * IBM Watson Services - * [Conversation](conversation) - * [Discovery](discovery) - * [Language Translator](language-translator) - * [Natural Language Classifier](natural-language-classifier) - * [Natural Language Understanding](natural-language-understanding) - * [Personality Insights](personality-insights) - * [Speech to Text](speech-to-text) - * [Text to Speech](text-to-speech) - * [Tone Analyzer](tone-analyzer) - * [Tradeoff Analytics](tradeoff-analytics) - * [Visual Recognition](visual-recognition) - * [Changes for v4.0](#changes-for-v40) - * [Using a Proxy](#using-a-proxy) - * [Android](#android) - * [Running in IBM Cloud](#running-in-ibm-cloud) - * [Default Headers](#default-headers) - * [Debug](#debug) - * [Eclipse and Intellij](#working-with-eclipse-and-intellij-idea) - * [License](#license) - * [Contributing](#contributing) - -
+Java client library to use the [Watson APIs][wdc]. + +## Before you begin +* You need an [IBM Cloud][ibm-cloud-onboarding] account. ## Installation ##### Maven - All the services: ```xml - com.ibm.watson.developer_cloud - java-sdk - 4.2.1 + com.ibm.watson + ibm-watson + 16.1.0 ``` -Only Retrieve and Rank: +Only Discovery: ```xml - com.ibm.watson.developer_cloud - retrieve-and-rank - 4.2.1 + com.ibm.watson + discovery + 16.1.0 ``` ##### Gradle - All the services: ```gradle -'com.ibm.watson.developer_cloud:java-sdk:4.2.1' +'com.ibm.watson:ibm-watson:16.1.0' ``` -Only Conversation: +Only Assistant: ```gradle -'com.ibm.watson.developer_cloud:conversation:4.2.1' +'com.ibm.watson:assistant:16.1.0' ``` -##### Development Snapshots +Now, you are ready to see some [examples](https://github.com/watson-developer-cloud/java-sdk/tree/master/examples/src/main/java/com/ibm/watson). -Snapshots of the development version are available in [Sonatype's snapshots repository][sonatype_snapshots]. +## Usage -###### Gradle +The examples within each service assume that you already have service credentials. If not, +you will have to [create a service](#getting-credentials) in IBM Cloud. -Add repository to your project Gradle file +If you are running your application in IBM Cloud (or other platforms based on Cloud Foundry), you don't need to specify the +credentials; the library will get them for you by looking at the [`VCAP_SERVICES`][vcap_services] environment variable. -```gradle -allprojects { - repositories { - maven { url "https://oss.sonatype.org/content/repositories/snapshots" } - } -} +## Running in IBM Cloud + +When running in IBM Cloud (or other platforms based on Cloud Foundry), the library will automatically get the credentials from [`VCAP_SERVICES`][vcap_services]. +If you have more than one plan, you can use `CredentialUtils` to get the service credentials for an specific plan. + +## Authentication + +Watson services are migrating to token-based Identity and Access Management (IAM) authentication. + +As of `v9.2.1`, the preferred approach of initializing an authenticator is the builder pattern. This pattern supports +constructing the authenticator with only the properties that you need. Also, if you're authenticating to a Watson service +on Cloud Pak for Data that supports IAM, you must use the builder pattern. + +- You can initialize the authenticator with either of the following approaches: + - In the builder of the authenticator (builder pattern). + - In the constructor of the authenticator (deprecated, but still available). +- 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. +- If you're using a Watson service on Cloud Pak for Data, you'll need to authenticate in a [specific way](#cloud-pak-for-data). + +### 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: + +1. Go to the IBM Cloud [Dashboard](https://cloud.ibm.com/) page. +1. Either click an existing Watson service instance in your [resource list](https://cloud.ibm.com/resources) or click [**Create resource > AI**](https://cloud.ibm.com/catalog?category=ai) and create a service instance. +1. Click on the **Manage** item in the left nav bar of your service instance. + +On this page, you should be able to see your credentials for accessing your service instance. + +In your code, you can use these values in the service constructor or with a method call after instantiating your service. + +### Supplying credentials + +There are two ways to supply the credentials you found above to the SDK for authentication. + +#### Credential file (easier!) + +With a credential file, you just need to put the file in the right place and the SDK will do the work of parsing it and authenticating. You can get this file by clicking the **Download** button for the credentials in the **Manage** tab of your service instance. + +The file downloaded will be called `ibm-credentials.env`. This is the name the SDK will search for and **must** be preserved unless you want to configure the file path (more on that later). The SDK will look for your `ibm-credentials.env` file in the following places (in order): + +- Your system's home directory +- The top-level directory of the project you're using the SDK in + +As long as you set that up correctly, you don't have to worry about setting any authentication options in your code. So, for example, if you created and downloaded the credential file for your Discovery instance, you just need to do the following: + +```java +Discovery service = new Discovery("2023-03-31"); ``` -And then reference the snapshot version on your app module gradle -Only Speech to Text: +And that's it! -```gradle -'com.ibm.watson.developer_cloud:speech-to-text:3.8.1-SNAPSHOT' +If you're using more than one service at a time in your code and get two different `ibm-credentials.env` files, just put the contents together in one `ibm-credentials.env` file and the SDK will handle assigning credentials to their appropriate services. + +If you would like to configure the location/name of your credential file, you can set an environment variable called `IBM_CREDENTIALS_FILE`. **This will take precedence over the locations specified above.** Here's how you can do that: + +```bash +export IBM_CREDENTIALS_FILE="" ``` -##### JAR +where `` is something like `/home/user/Downloads/.env`. -Download the jar with dependencies [here][jar]. +#### Manually -Now, you are ready to see some [examples](https://github.com/watson-developer-cloud/java-sdk/tree/master/examples/src/main/java/com/ibm/watson/developer_cloud). +If you'd prefer to set authentication values manually in your code, the SDK supports that as well. The way you'll do this depends on what type of credentials your service instance gives you. -## Usage +##### IAM -The examples within each service assume that you already have service credentials. If not, -you will have to create a service in [IBM Cloud][ibm_cloud]. +Some services use token-based Identity and Access Management (IAM) authentication. IAM authentication uses a service API key to get an access token that is passed with the call. Access tokens are valid for approximately one hour and must be regenerated. -If you are running your application in IBM Cloud (or other platforms based on Cloud Foundry), you don't need to specify the -credentials; the library will get them for you by looking at the [`VCAP_SERVICES`][vcap_services] environment variable. +You supply either an IAM service **API key** or an **access token**: -## Getting the Service Credentials +- Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary. +- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/watson?topic=watson-iam). -You will need the `username` and `password` (`api_key` for Visual Recognition) credentials, and the API endpoint for each service. Service credentials are different from your IBM Cloud account username and password. -To get your service credentials, follow these steps: +Supplying the IAM API key: -1. Log in to [IBM Cloud](https://console.bluemix.net/catalog?category=watson) -1. In the IBM Cloud **Catalog**, select the service you want to use. -1. Click **Create**. -1. On the left side of the page, click **Service Credentials**, and then **View credentials** to view your service credentials. -1. Copy `url`, `username` and `password`(`api_key` for AlchemyAPI or Visual Recognition). +Builder pattern approach: -## Changes for v4.0 -Version 4.0 focuses on the move to programmatically-generated code for many of the services. See the [changelog](https://github.com/watson-developer-cloud/java-sdk/wiki/Changelog) for the details. +```java +// letting the SDK manage the IAM token +Authenticator authenticator = new IamAuthenticator.Builder() + .apikey("") + .build(); +Discovery service = new Discovery("2023-03-31", authenticator); +``` -## Migration -This version includes many breaking changes as a result of standardizing behavior across the new generated services. Full details on migration from previous versions can be found [here](https://github.com/watson-developer-cloud/java-sdk/wiki/Migration). +Deprecated constructor approach: -## Android +```java +// letting the SDK manage the IAM token +Authenticator authenticator = new IamAuthenticator(""); +Discovery service = new Discovery("2023-03-31", authenticator); +``` -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][]. +Supplying the access token: -## Using a Proxy +```java +// assuming control of managing IAM token +Authenticator authenticator = new BearerTokenAuthenticator(""); +Discovery service = new Discovery("2023-03-31", authenticator); +``` -Override the `configureHttpClient()` method and add the proxy using the `OkHttpClient.Builder` object. +#### Username and password -For example: +Builder pattern approach: ```java -ConversationService service = new ConversationService("2017-05-26") { - @Override - protected OkHttpClient configureHttpClient() { - Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080)); - return super.configureHttpClient().newBuilder().proxy(proxy).build(); - } -}; +Authenticator authenticator = new BasicAuthenticator.Builder() + .username("") + .password("") + .build(); +Discovery service = new Discovery("2023-03-31", authenticator); +``` -service.setUsernameAndPassword("", ""); +Deprecated constructor approach: -WorkspaceCollectionResponse workspaces = service.listWorkspaces(null, null, null, null).execute(); -System.out.println(workspaces); +```java +Authenticator authenticator = new BasicAuthenticator("", ""); +Discovery service = new Discovery("2023-03-31", authenticator); ``` -For more information see: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564) +#### ICP +Authenticating with ICP is similar to the basic username and password method, except that you need to make sure to disable SSL verification to authenticate properly. See [here](#configuring-the-http-client) for more information. -## Running in IBM Cloud +```java +Authenticator authenticator = new BasicAuthenticator("", ""); +Discovery service = new Discovery("2023-03-31", authenticator); -When running in IBM Cloud (or other platforms based on Cloud Foundry), the library will automatically get the credentials from [`VCAP_SERVICES`][vcap_services]. -If you have more than one plan, you can use `CredentialUtils` to get the service credentials for an specific plan. +HttpConfigOptions options = new HttpConfigOptions.Builder() + .disableSslVerification(true) + .build(); + +service.configureClient(options); +``` + +#### Cloud Pak for Data +Like IAM, you can pass in credentials to let the SDK manage an access token for you or directly supply an access token to do it yourself. + +Builder pattern approach: ```java -PersonalityInsights service = new PersonalityInsights(); -String apiKey = CredentialUtils.getAPIKey(service.getName(), CredentialUtils.PLAN_STANDARD); -service.setApiKey(apiKey); +// letting the SDK manage the token +Authenticator authenticator = new CloudPakForDataAuthenticator.Builder() + .url("") + .username("") + .password("") + .disableSSLVerification(true) + .headers(null) + .build(); +Discovery service = new Discovery("2023-03-31", authenticator); +service.setServiceUrl(""); ``` -## Default Headers +Deprecated constructor approach: -Default headers can be specified at any time by using the `setDefaultHeaders(Map headers)` method. +```java +// letting the SDK manage the token +Authenticator authenticator = new CloudPakForDataAuthenticator( + "", + "", + "", + true, // disabling SSL verification + null, +); +Discovery service = new Discovery("2023-03-31", authenticator); +service.setServiceUrl(""); +``` -The example below sends the `X-Watson-Learning-Opt-Out` header in every request preventing Watson from using the payload to improve the service. +```java +// assuming control of managing the access token +Authenticator authenticator = new BearerTokenAuthenticator(""); +Discovery service = new Discovery("2023-03-31", authenticator); +service.setServiceUrl(""); +``` + +Be sure to both disable SSL verification when authenticating and set the endpoint explicitly to the URL given in Cloud Pak for Data. + +#### MCSP +To use the SDK through a third party cloud provider (such as AWS), use the `MCSPAuthenticator`. This will require the base endpoint URL for the MCSP token service (e.g. https://iam.platform.saas.ibm.com) and an apikey. ```java -PersonalityInsights service = new PersonalityInsights(); +// letting the SDK manage the token +Authenticator authenticator = new MCSPAuthenticator.Builder() + .apikey("apikey") + .url("token_service_endpoint") + .build(); +Assistant service = new Assistant("2023-06-15", authenticator); +service.setServiceUrl(""); +``` -Map headers = new HashMap(); -headers.put(HttpHeaders.X_WATSON_LEARNING_OPT_OUT, 1); +## Using the SDK -service.setDefaultHeaders(headers); +### Parsing responses -// All the api calls from now on will send the default headers +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()); + +// grabbing headers that came back with our API response +Headers responseHeaders = response.getHeaders(); +System.out.println("Response header names: " + responseHeaders.names()); ``` -## Specifying a service URL +### Configuring the HTTP client -You can set the correct API Endpoint for your service calling `setEndPoint()`. +The HTTP client can be configured by using the `setProxy()` method on your authenticator and using the `configureClient()` method on your service object, passing in an `HttpConfigOptions` object. For a full list of configurable options look at this linked Builder class for [HttpConfigOptions](https://github.com/IBM/java-sdk-core/blob/c053e1ccf4bc4267b0ce0be5538564fac088f57b/src/main/java/com/ibm/cloud/sdk/core/http/HttpConfigOptions.java#L95). Currently, the following options are supported: +- Disabling SSL verification (only do this if you really mean to!) ⚠️ +- Setting gzip compression +- Setting max retry and retry interval +- Using a proxy (more info here: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564)) +- Setting HTTP logging verbosity -For example, if you have the conversation service in Germany, the Endpoint may be `https://gateway-fra.watsonplatform.net/conversation/api`. +Here's an example of setting the above: -You will need to call +```java +Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080)); +IamAuthenticator authenticator = new IamAuthenticator(apiKey); +authenticator.setProxy(proxy); + +Discovery service = new Discovery("2023-03-31", authenticator); + +// setting configuration options +HttpConfigOptions options = new HttpConfigOptions.Builder() + .disableSslVerification(true) + .proxy(proxy) + .loggingLevel(HttpConfigOptions.LoggingLevel.BASIC) + .build(); + +service.configureClient(options); +``` + +### 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 -Conversation service = new Conversation(""); -service.sentEndPoint("https://gateway-fra.watsonplatform.net/conversation/api") +// make API call +Response response = service.listEnvironments().execute(); + +// continue execution ``` -## 401 Unauthorized error +However, if you need to perform these calls in the background, there are two other methods to do this asynchronously: `enqueue()` and `reactiveRequest()`. -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()`. +#### `enqueue()` -## Debug +This method allows you to set a callback for the service response through the use of the `ServiceCallback` object. Here's an example: +```java +// make API call in the background +service.listEnvironments().enqueue(new ServiceCallback() { + @Override + public void onResponse(Response response) { + System.out.println("We did it! " + response); + } -HTTP requests can be logging by adding a `loggging.properties` file to your classpath. + @Override + public void onFailure(Exception e) { + System.out.println("Whoops..."); + } +}); -```none -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINE -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s %4$s: %5$s%n -.level=SEVERE -# HTTP Logging - Basic -com.ibm.watson.developer_cloud.util.HttpLogging.level=INFO +// continue working in the meantime! ``` -The configuration above will log only the URL and query parameters for each request. +#### `reactiveRequest()` -For example: +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 +// get stream with request +Single> observableRequest + = service.listEnvironments().reactiveRequest(); + +// 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)); -```none -Mar 30, 2017 7:31:22 PM okhttp3.internal.platform.Platform log -INFO: --> POST https://gateway.watsonplatform.net/tradeoff-analytics/api/v1/dilemmas?generate_visualization=false http/1.1 (923-byte body) -Mar 30, 2017 7:31:22 PM okhttp3.internal.platform.Platform log -INFO: <-- 200 OK https://gateway.watsonplatform.net/tradeoff-analytics/api/v1/dilemmas?generate_visualization=false (104ms, unknown-length body) -Mar 30, 2017 7:31:23 PM okhttp3.internal.platform.Platform log -INFO: --> POST https://gateway.watsonplatform.net/tradeoff-analytics/api/v1/dilemmas?generate_visualization=true http/1.1 (12398-byte body) -Mar 30, 2017 7:31:35 PM okhttp3.internal.platform.Platform log -INFO: <-- 200 OK https://gateway.watsonplatform.net/tradeoff-analytics/api/v1/dilemmas?generate_visualization=true (12311ms, unknown-length body) +// continue working in the meantime! ``` -**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. +### Default headers + +Default headers can be specified at any time by using the `setDefaultHeaders(Map headers)` method. + +The example below sends the `X-Watson-Learning-Opt-Out` header in every request preventing Watson from using the payload to improve the service. -## Build + Test +```java +PersonalityInsights service = new PersonalityInsights("2017-10-13", new NoAuthAuthenticator()); -To build and test the project you can use [Gradle][] (version 1.x). +Map headers = new HashMap(); +headers.put(WatsonHttpHeaders.X_WATSON_LEARNING_OPT_OUT, "true"); -Gradle: +service.setDefaultHeaders(headers); -```sh -cd java-sdk -gradle jar # build jar file (build/libs/watson-developer-cloud-4.2.1.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) +// All the api calls from now on will send the default headers ``` -## Working with Eclipse and Intellij IDEA +### Sending request headers -If you want to work on the code in an IDE instead of a text editor you can -easily create project files with gradle: +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: -```sh -gradle idea # Intellij IDEA -gradle eclipse # Eclipse +```java +Response workspaces = service.listWorkspaces() + .addHeader("Custom-Header", "custom_value") + .execute(); ``` -## Open Source @ IBM +### Canceling requests -Find more open source projects on the [IBM Github Page](http://ibm.github.io/) +It's possible that you may want to cancel a request you make to a service. For example, you may set some timeout threshold and just want to cancel an asynchronous if it doesn't respond in time. You can do that by calling the `cancel()` method on your `ServiceCall` object. For example: -## License +```java +// time to consider timeout (in ms) +long timeoutThreshold = 3000; -This library is licensed under Apache 2.0. Full license text is -available in [LICENSE](LICENSE). +// storing ServiceCall object we'll use to list our Assistant v1 workspaces +ServiceCall call = service.listWorkspaces(); -## Contributing +long startTime = System.currentTimeMillis(); +call.enqueue(new ServiceCallback() { + @Override + public void onResponse(Response response) { + // store the result somewhere + fakeDb.store("my-key", response.getResult()); + } + + @Override + public void onFailure(Exception e) { + System.out.println("The request failed :("); + } +}); + +// keep waiting for the call to complete while we're within the timeout bounds +while ((fakeDb.retrieve("my-key") == null) && (System.currentTimeMillis() - startTime < timeoutThreshold)) { + Thread.sleep(500); +} + +// if we timed out and it's STILL not complete, we'll just cancel the call +if (fakeDb.retrieve("my-key") == null) { + call.cancel(); +} +``` + +Doing so will call your `onFailure()` implementation. + +### Transaction IDs + +Every SDK call returns a response with a transaction ID in the `X-Global-Transaction-Id` header. This transaction ID is useful for troubleshooting and accessing relevant logs from your service instance. + +```java +Assistant service = new Assistant("2019-02-28"); +ListWorkspacesOptions options = new ListWorkspacesOptions.Builder().build(); +Response response; + +try { + // In a successful case, you can grab the ID with the following code. + response = service.listWorkspaces(options).execute(); + String transactionId = response.getHeaders().values("X-Global-Transaction-Id").get(0); +} catch (ServiceResponseException e) { + // This is how you get the ID from a failed request. + // Make sure to use the ServiceResponseException class or one of its subclasses! + String transactionId = e.getHeaders().values("X-Global-Transaction-Id").get(0); +} +``` + +However, the transaction ID isn't available when the API doesn't return a response for some reason. In that case, you can set your own transaction ID in the request. For example, replace `` in the following example with a unique transaction ID. +```java +Authenticator authenticator = new IamAuthenticator("apiKey"); +service = new Assistant("{version-date}", authenticator); +service.setServiceUrl("{serviceUrl}"); + +Map headers = new HashMap<>(); +headers.put("X-Global-Transaction-Id", ""); +service.setDefaultHeaders(headers); + +MessageOptions options = new MessageOptions.Builder(workspaceId).build(); +MessageResponse result = service.message(options).execute().getResult(); +``` + +## FAQ -See [CONTRIBUTING.md](.github/CONTRIBUTING.md). +### Does this SDK play well with Android? -## Code of Conduct +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). -See [CODE_OF_CONDUCT.md](.github/CODE_OF_CONDUCT.md). +### How can I contribute? -### Other +Great question (and please do)! You can find contributing information [here](.github/CONTRIBUTING.md). -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). +### Where can I get more help with using Watson APIs? +If you have issues with the APIs or have a question about the Watson services, see [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-watson+java). + +### 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://console.bluemix.net -[Gradle]: http://www.gradle.org/ -[OkHttp]: http://square.github.io/okhttp/ -[gson]: https://github.com/google/gson +[ibm_cloud]: https://cloud.ibm.com [apache_maven]: http://maven.apache.org/ -[sonatype_snapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/ibm/watson/developer_cloud/ -[vcap_services]: https://docs.run.pivotal.io/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES +[vcap_services]: https://cloud.ibm.com/docs/watson?topic=watson-vcapServices +[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/v16.1.0/ibm-watson-16.1.0-jar-with-dependencies.jar + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + + + + +

Logan Patino

💻 🎨 🐛

Ajiemar Santiago

💻 🎨 🐛

German Attanasio

💻 🎨 📖 ⚠️

Kevin Kowalski

💻 🎨 🐛 📖 ⚠️ 💬️

Jeff Arn

💻 🎨 🐛 📖 ⚠️ 💬️

Angelo Paparazzi

💻 🎨 🐛 📖 ⚠️ 💬️ 🥷🏼
+ + + + -[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-4.2.0/java-sdk-4.2.1-jar-with-dependencies.jar +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/RELEASE.md b/RELEASE.md index 5020dd35144..02e3e8a4a07 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,42 +1,45 @@ -# Release Process +# Release process -* code: https://github.com/watson-developer-cloud/java-sdk -* maven: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22java-sdk%22 +The Java SDK has been configured so that releases should happen **automatically**. -## Guide to uploading artifacts to the Central Repository +If everything goes smoothly, commits to `master` should trigger new package versions using [semantic-release](https://github.com/semantic-release/semantic-release), which bases the release type (major, minor, patch, none) on the commit messages, which should always follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). -We use Sonatype as repository manager, it's used as the input channel for the Central Repository running the Sonatype Open Source Repository Hosting(OSSRH) service. +When new versions are released, the code is pushed to Bintray and synced to Maven Central. The packages can be found [here](https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo) on Bintray and [here](https://search.maven.org/search?q=com.ibm.watson) on Maven Central. -### Prerequisites +The Javadocs for the new version should also be pushed automatically. Docs are located in the `gh-pages` branch of the repo, and that gets synced to the following GitHub Pages link: http://watson-developer-cloud.github.io/java-sdk/ -If you are not familiar with Sonatype and/or the maven release process please read the following material: +If things **don't** go smoothly, you'll need to follow some other instructions to get things in order. -* Sonatype: http://central.sonatype.org/pages/apache-maven.html -* Releasing artifacts to Sonatype: http://kirang89.github.io/blog/2013/01/20/uploading-your-jar-to-maven-central/ -* Install GPG, and create a public key. More info: http://central.sonatype.org/pages/working-with-pgp-signatures.html +## Fixing broken releases -### Release steps +### Travis timeouts - 1. Update all READMEs to include the new version number +The most common reason for a release to fail is because of a Travis timeout. Builds are only allowed to run for a maximum of 1 hour, and unfortunately the syncing process between Bintray and Maven Central can be slow enough to go over this time limit sometimes. If this happens, you should do the following: - This can be done using [bumpversion]. If necessary, it can be installed with the following command: +- Navigate to the code on Bintray at [this URL](https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo). If you're not a member of the ibm-cloud-sdks organization, ask the maintainer of this SDK repo for access. +- Navigate to the "Maven Central" tab in each of the packages that didn't sync. Here's an example: https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo/com.ibm.watson%3Anatural-language-understanding#central. You can figure out which packages to sync manually by checking the failed Travis build log or by looking at the "Last Synced" date for the package. +- Click the "Sync" button. If you need to provide Sonatype credentials, you can also ask the maintainer of this SDK repo for those. - ```bash - pip install bumpversion - ``` + Bintray sync - To then update all version numbers, simply run: +- After doing this with all of the necessary packages, you can verify that things worked by checking the available versions on [Maven Central](https://search.maven.org/search?q=com.ibm.watson). This could take up to an hour. - ```bash - bumpversion major|minor|patch - ``` +### Unsuccessful Bintray deployment - 1. Perform a release deployment to OSSRH (Staging) with: +This case is much more unlikely, since integration tests don't run on `master` and builds are very unlikely to be passing in a PR but fail once it's merged. Nevertheless, if this does happen and files aren't deployed to Bintray, you'll need to follow some steps to do this manually: - ```bash - `gradle release` - ``` +- Navigate to the code on Bintray at [this URL](https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo). If you're not a member of the ibm-cloud-sdks organization, ask the maintainer of this SDK repo for access. +- For each package in the SDK, if the new version isn't present, you can add it by navigating to the package and adding it manually: - You will have to answer prompts for versions and tags. That will tag and commit a new version into your repository automatically. + Bintray new version -[bumpversion]: https://pypi.python.org/pypi/bumpversion \ No newline at end of file +- To add the files, make sure to first generate all of the necessary artifacts locally. Check out the new release tag and generate them with the following commands (from the SDK repo): + ``` + git checkout {release tag} + ./gradlew shadowJar + ``` +- In the new version of the package on Bintray, add the files with the "Upload Files" button. Follow the file structure of previous releases to ensure everything works properly. The files to add should be in the `build/libs` folder of each local package in the SDK. + + Bintray upload files + +- Finally, be sure to sync the artifacts with Maven Central. You can look at the [Travis timeouts](#travis-timeouts) section above for more information on this. diff --git a/alchemy/README.md b/alchemy/README.md deleted file mode 100644 index db3989828a0..00000000000 --- a/alchemy/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# Alchemy Services - -## Installation - -##### Maven - -```xml - - com.ibm.watson.developer_cloud - alchemy - 4.2.1 - -``` - -##### Gradle - -```gradle -'com.ibm.watson.developer_cloud:alchemy:4.2.1' -``` - -## Alchemy Language - -[Alchemy Language][alchemy_language] offers 12 API functions as part of its text analysis service, each of which uses sophisticated natural language processing techniques to analyze your content and add high-level semantic information. - -Use the [Sentiment Analysis][sentiment_analysis] endpoint to identify positive/negative sentiment within a sample text document. - -```java -AlchemyLanguage service = new AlchemyLanguage(); -service.setApiKey(""); - -Map params = new HashMap(); -params.put(AlchemyLanguage.TEXT, "IBM Watson won the Jeopardy television show hosted by Alex Trebek"); -DocumentSentiment sentiment = service.getSentiment(params).execute(); - -System.out.println(sentiment); -``` - -We also offer a cognitive client which makes use of this API to provide enhanced features for applications using our natural language understanding services such as AlchemyLanguage and NaturalLanguageUnderstanding: -https://github.com/watson-developer-cloud/cognitive-client-java - -## Alchemy Vision - -[Alchemy Vision][alchemy_vision] uses deep learning innovations to understand a picture's content and context. It sees complex visual scenes in their entirety —without needing any textual clues— leveraging a holistic approach to understand the objects, faces, and words in an image. - -Example: Extract keywords from an image. - -```java -AlchemyVision service = new AlchemyVision(); -service.setApiKey(""); - -File image = new File("src/test/resources/alchemy/obama.jpg"); -Boolean forceShowAll = false; -Boolean knowledgeGraph = false; -ImageKeywords keywords = service.getImageKeywords(image, forceShowAll, knowledgeGraph).execute(); - -System.out.println(keywords); -``` - -## Alchemy Data News - -[Alchemy Data News][alchemy_data_news] indexes 250k to 300k English language news and -blog articles every day with historical search available for the past 60 days. -Example: Get 7 documents between Friday 28th August 2015 and Friday 4th September 2015. - -```java -AlchemyDataNews service = new AlchemyDataNews(); -service.setApiKey(""); - -Map params = new HashMap(); - -String[] fields = - new String[] {"enriched.url.title", "enriched.url.url", "enriched.url.author", - "enriched.url.publicationDate", "enriched.url.enrichedTitle.entities", - "enriched.url.enrichedTitle.docSentiment"}; -params.put(AlchemyDataNews.RETURN, StringUtils.join(fields, ",")); -params.put(AlchemyDataNews.START, "1440720000"); -params.put(AlchemyDataNews.END, "1441407600"); -params.put(AlchemyDataNews.COUNT, 7); - -DocumentsResult result = service.getNewsDocuments(params).execute(); - -System.out.println(result); -``` - -## Concept Insights - -The Concept Insights service has been deprecated, AlchemyLanguage's concept function can be used as a replacement for most Concept Insights use cases; therefore, we encourage existing Concept Insights service users to migrate to AlchemyLanguage. - -[alchemy_language]: http://www.alchemyapi.com/products/alchemylanguage -[alchemy_data_news]: http://www.alchemyapi.com/products/alchemydata-news -[alchemy_vision]: http://www.alchemyapi.com/products/ -[sentiment_analysis]: http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis diff --git a/alchemy/build.gradle b/alchemy/build.gradle deleted file mode 100644 index c40bec51bac..00000000000 --- a/alchemy/build.gradle +++ /dev/null @@ -1,113 +0,0 @@ -plugins { - id 'ru.vyarus.animalsniffer' version '1.3.0' -} - -defaultTasks 'clean' - -apply from: '../utils.gradle' -import org.apache.tools.ant.filters.* - -apply plugin: 'java' -apply plugin: 'ru.vyarus.animalsniffer' -apply plugin: 'maven' -apply plugin: 'signing' -apply plugin: 'checkstyle' -apply plugin: 'eclipse' - -task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -repositories { - mavenCentral() -} - -artifacts { - archives sourcesJar - archives javadocJar -} - -signing { - sign configurations.archives -} - -signArchives { - onlyIf { Task task -> - def shouldExec = false - for (myArg in project.gradle.startParameter.taskRequests[0].args) { - if (myArg.toLowerCase().contains('signjars') || myArg.toLowerCase().contains('uploadarchives')) { - shouldExec = true - } - } - return shouldExec - } -} - -checkstyle { - configFile = rootProject.file('checkstyle.xml') - ignoreFailures = false -} - -dependencies { - compile project(':core') - - testCompile project(path: ':core', configuration: 'tests') - - signature 'org.codehaus.mojo.signature:java17:1.0@signature' -} - -processResources { - filter ReplaceTokens, tokens: [ - "pom.version": project.version, - "build.date" : getDate() - ] -} - -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 'alchemy' - packaging 'jar' - // optionally artifactId can be defined here - description 'Client library to use the IBM Watson Alchemy Service' - url 'https://www.ibm.com/watson/developercloud/alchemy-language.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' - } - } - } - } - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyDataNews.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyDataNews.java deleted file mode 100644 index 758c0558cb4..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyDataNews.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1; - -import java.util.HashMap; -import java.util.Map; - -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentsResult; -import com.ibm.watson.developer_cloud.alchemy.v1.model.VolumeResult; -import com.ibm.watson.developer_cloud.http.RequestBuilder; -import com.ibm.watson.developer_cloud.http.ServiceCall; -import com.ibm.watson.developer_cloud.service.AlchemyService; -import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; -import com.ibm.watson.developer_cloud.util.Validator; - -/** - * AlchemyData News indexes 250k to 300k English language news and blog articles every day with historical search - * available for the past 60 days. - * - * @version v1 - * @see
Alchemy Data News - */ -public class AlchemyDataNews extends AlchemyService { - private static final String JSON = "json"; - private static final String NEWS_END_POINT = "/data/GetNews"; - - /** The Constant COUNT (value is "count"). */ - public static final String COUNT = "count"; - - /** - * The Constant END. the time (in UTC seconds) of the end of the query duration (value is "end") - */ - public static final String END = "end"; - - /** The Constant String RETURN (value is "return"). */ - public static final String RETURN = "return"; - - /** - * The Constant START. the time (in UTC seconds) of the beginning of the query duration. (value is "start") - */ - public static final String START = "start"; - - /** - * The Constant TIME_SLICE. the duration (in seconds) of each time slice (value is "timeSlice") - */ - public static final String TIME_SLICE = "timeSlice"; - - /** - * Instantiates a new alchemy data news service. - */ - public AlchemyDataNews() { - super(); - } - - /** - * Instantiates a new alchemy data news service by apiKey. - * - * @param apiKey the api key - */ - public AlchemyDataNews(String apiKey) { - super(apiKey); - } - - /** - * Gets the news documents. - * - * @param parameters the parameters - * @return the news documents - */ - public ServiceCall getNewsDocuments(final Map parameters) { - Validator.notNull(parameters.get(START), "start time cannot be null"); - Validator.notNull(parameters.get(END), "end time cannot be null"); - Validator.notNull(parameters.get(RETURN), "return cannot be null"); - - // clone parameters, to prevent errors if the user continues to use the provided Map, or it is - // immutable - final Map parametersCopy = new HashMap(parameters); - - // Return json - parametersCopy.put(OUTPUT_MODE, JSON); - - // Prevent jsonp to be returned - parametersCopy.remove(JSONP); - - final RequestBuilder requestBuilder = RequestBuilder.get(NEWS_END_POINT); - for (final String param : parametersCopy.keySet()) { - requestBuilder.query(param, parametersCopy.get(param)); - } - - return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(DocumentsResult.class)); - } - - /** - * Get a handle on how many documents are relevant for your query. - * - * @param start String the time (in UTC seconds) of the beginning of the query duration, - * @param end String the time (in UTC seconds) of the end of the query duration. - * @param timeSlice String the duration (in seconds) of each time slice. - * @return {@link VolumeResult} - */ - public ServiceCall getVolume(final String start, final String end, final String timeSlice) { - Validator.notNull(start, "start time cannot be null"); - Validator.notNull(end, "end time cannot be null"); - - final RequestBuilder requestBuilder = RequestBuilder.get(NEWS_END_POINT); - - requestBuilder.query(START, start); - requestBuilder.query(END, end); - requestBuilder.query(OUTPUT_MODE, JSON); - if (timeSlice != null) { - requestBuilder.query(TIME_SLICE, timeSlice); - } - return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(VolumeResult.class)); - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguage.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguage.java deleted file mode 100644 index 5753114d2ab..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguage.java +++ /dev/null @@ -1,430 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import com.ibm.watson.developer_cloud.alchemy.v1.model.AlchemyGenericModel; -import com.ibm.watson.developer_cloud.alchemy.v1.model.CombinedResults; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Concepts; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Dates; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentAuthors; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentEmotion; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentPublicationDate; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentSentiment; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentText; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentTitle; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Entities; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Feeds; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Keywords; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Language; -import com.ibm.watson.developer_cloud.alchemy.v1.model.LanguageSelection; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Microformats; -import com.ibm.watson.developer_cloud.alchemy.v1.model.SAORelations; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Taxonomies; -import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedRelations; -import com.ibm.watson.developer_cloud.alchemy.v1.util.AlchemyEndPoints; -import com.ibm.watson.developer_cloud.alchemy.v1.util.AlchemyEndPoints.AlchemyAPI; -import com.ibm.watson.developer_cloud.http.RequestBuilder; -import com.ibm.watson.developer_cloud.http.ServiceCall; -import com.ibm.watson.developer_cloud.service.AlchemyService; -import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; - -/** - * The Alchemy Language service uses offers 12 text analysis services, each of which uses sophisticated natural language - * processing techniques to analyze your content and add high-level semantic information. - * - * @version v1 - * @see Alchemy Language - */ -public class AlchemyLanguage extends AlchemyService { - - /** The Constant BASE_URL. */ - public static final String BASE_URL = "baseUrl"; - - /** The Constant COREFERENCE. */ - public static final String COREFERENCE = "coreference"; - - /** The Constant CQUERY. */ - public static final String CQUERY = "cquery"; - - /** The Constant DISAMBIGUATE. */ - public static final String DISAMBIGUATE = "disambiguate"; - - /** The Constant ENTITIES. */ - public static final String ENTITIES = "entities"; - - /** The Constant EXTRACT. */ - public static final String EXTRACT = "extract"; - - /** The Constant EXTRACT_LINK. */ - public static final String EXTRACT_LINK = "extractLinks"; - - /** The Constant FORCED_GLOSSARY. */ - public static final String FORCED_GLOSSARY = "forced_glossary"; - - /** The Constant HTML. */ - public static final String HTML = "html"; - - /** The Constant KEYWORD_EXTRACT_MODE. */ - public static final String KEYWORD_EXTRACT_MODE = "keywordExtractMode"; - - /** The Constant KEYWORDS. */ - public static final String KEYWORDS = "keywords"; - - /** The Constant KNOWLEDGE_GRAPH. */ - public static final String KNOWLEDGE_GRAPH = "knowledgeGraph"; - - /** The Constant LINKED_DATA. */ - public static final String LINKED_DATA = "linkedData"; - - /** The Constant MAX_RETRIEVE. */ - public static final String MAX_RETRIEVE = "maxRetrieve"; - - /** The Constant QUOTATIONS. */ - public static final String QUOTATIONS = "quotations"; - - /** The Constant RAW. */ - public static final String RAW = "raw"; - - /** The Constant REQUIRED_ENTITIES. */ - public static final String REQUIRED_ENTITIES = "requireEntities"; - - /** The Constant SENTIMENT. */ - public static final String SENTIMENT = "sentiment"; - - /** The Constant SENTIMENT_EXCLUDE_ENTITIES. */ - public static final String SENTIMENT_EXCLUDE_ENTITIES = "sentimentExcludeEntities"; - - /** The Constant SHOW_SOURCE_TEXT. */ - public static final String SHOW_SOURCE_TEXT = "showSourceText"; - - /** The Constant SOURCE_TEXT. */ - public static final String SOURCE_TEXT = "sourceText"; - - /** The Constant STRUCTURED_ENTITIES. */ - public static final String STRUCTURED_ENTITIES = "structuredEntities"; - - /** The Constant TARGET. */ - public static final String TARGET = "target"; - - /** The Constant TEXT. */ - public static final String TEXT = "text"; - - /** The Constant URL. */ - public static final String URL = "url"; - - /** The Constant USE_METADATA. */ - public static final String USE_METADATA = "useMetadata"; - - /** The Constant XPATH. */ - public static final String XPATH = "xpath"; - - /** The Constant TARGETS. */ - public static final String TARGETS = "targets"; - - /** The Constant ANCHOR_DATE. */ - public static final String ANCHOR_DATE = "anchorDate"; - - /** The Constant MODEL_ID. */ - public static final String MODEL_ID = "model_id"; - - private LanguageSelection language = LanguageSelection.DETECT; - - private static final SimpleDateFormat anchorDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - private static final String LANGUAGE = "language"; - - /** - * Instantiates a new alchemy data news service. - */ - public AlchemyLanguage() { - super(); - } - - /** - * Instantiates a new alchemy language service by apiKey. - * - * @param apiKey the api key - */ - public AlchemyLanguage(String apiKey) { - super(apiKey); - } - - /** - * Execute the request and return the POJO that represent the response. - * - * @param The POJO that represents the response object - * @param params the request parameters - * @param operation the alchemy operation - * @param returnType the POJO class to be parsed from the response - * @param acceptedFormats the accepted input formats e.g. "html", "text"... - * @return the POJO object that represent the response - */ - private ServiceCall createServiceCall(final Map params, - AlchemyAPI operation, Class returnType, String... acceptedFormats) { - - // clone params, to prevent errors if the user continues to use the provided Map, or it is - // immutable - final Map paramsCopy = new HashMap(params); - - // Get the input format and check for missing parameters - final String format = getInputFormat(paramsCopy, acceptedFormats); - - // Get the path that represent this operation based on the operation and format - final String path = AlchemyEndPoints.getPath(operation, format); - - // Return json - paramsCopy.put(OUTPUT_MODE, "json"); - - if (!paramsCopy.containsKey(LANGUAGE) && (language != LanguageSelection.DETECT)) { - paramsCopy.put(LANGUAGE, language.toString().toLowerCase()); - } - - // Prevent jsonp to be returned - paramsCopy.remove(JSONP); - - final RequestBuilder requestBuilder = RequestBuilder.post(path); - for (final String param : paramsCopy.keySet()) { - requestBuilder.form(param, paramsCopy.get(param)); - } - - if ((operation == AlchemyAPI.TYPED) && params.containsKey(MODEL_ID)) { - requestBuilder.query(MODEL_ID, params.get(MODEL_ID)); - } - - return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(returnType)); - } - - - /** - * Allows users to set language of input text. - * - * @param language The language to use - */ - public void setLanguage(LanguageSelection language) { - this.language = language; - } - - - /** - * Extracts the authors from a URL or HTML. - * - * @param params The parameters to be used in the service call, html or url should be specified. - * @return {@link DocumentAuthors} - */ - public ServiceCall getAuthors(Map params) { - return createServiceCall(params, AlchemyAPI.AUTHORS, DocumentAuthors.class, HTML, URL); - } - - - /** - * Extracts concepts tags for text, HTML, or a URLL. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link Concepts} - */ - public ServiceCall getConcepts(Map params) { - return createServiceCall(params, AlchemyAPI.CONCEPTS, Concepts.class, TEXT, HTML, URL); - } - - /** - * Extracts publication date information when it is specified in web pages. - * - * @param params The parameters to be used in the service call, html or url should be specified. - * @return {@link DocumentPublicationDate} - */ - public ServiceCall getPublicationDate(Map params) { - return createServiceCall(params, AlchemyAPI.PUBLICATION_DATE, DocumentPublicationDate.class, HTML, URL); - } - - /** - * Categorized through the taxonomy call for text, HTML, or a URL. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link Taxonomies} - */ - public ServiceCall getTaxonomy(Map params) { - return createServiceCall(params, AlchemyAPI.TAXONOMY, Taxonomies.class, TEXT, HTML, URL); - } - - /** - * Automatically perform analysis using multiple features on any web page or posted (uploaded) HTML/text file. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link Microformats} - */ - public ServiceCall getCombinedResults(Map params) { - Map paramsCopy = new HashMap(params); - - if (params.containsKey(ANCHOR_DATE) && (params.get(ANCHOR_DATE) instanceof Date)) { - String anchorDate = formatDate((Date) params.get(ANCHOR_DATE)); - paramsCopy.put(ANCHOR_DATE, anchorDate); - } - - return createServiceCall(paramsCopy, AlchemyAPI.COMBINED, CombinedResults.class, TEXT, HTML, URL); - } - - /** - * Extracts a grouped, ranked list of named entities (people, companies, organizations, etc.) from text, a URL or - * HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link Entities} - */ - public ServiceCall getEntities(Map params) { - return createServiceCall(params, AlchemyAPI.ENTITIES, Entities.class, TEXT, HTML, URL); - } - - /** - * Detects the RSS/ATOM feeds for a URL or HTML. - * - * @param params The parameters to be used in the service call, html or url should be specified. - * @return {@link Feeds} - */ - public ServiceCall getFeeds(Map params) { - return createServiceCall(params, AlchemyAPI.FEEDS, Feeds.class, HTML, URL); - } - - /** - * Extracts the keywords from text, a URL or HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link Keywords} - */ - public ServiceCall getKeywords(Map params) { - return createServiceCall(params, AlchemyAPI.KEYWORDS, Keywords.class, TEXT, HTML, URL); - } - - /** - * Detects the language for text, a URL or HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link Language} - */ - public ServiceCall getLanguage(Map params) { - return createServiceCall(params, AlchemyAPI.LANGUAGE, Language.class, TEXT, HTML, URL); - } - - /** - * Parses the {@link Microformats} for a URL or HTML. - * - * @param params The parameters to be used in the service call, html or url should be specified - * @return {@link Microformats} - */ - public ServiceCall getMicroformats(Map params) { - return createServiceCall(params, AlchemyAPI.MICROFORMATS, Microformats.class, HTML, URL); - } - - /** - * Extracts Subject-Action-Object(SAO) relations from text, a URL or HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link SAORelations} - */ - public ServiceCall getRelations(Map params) { - return createServiceCall(params, AlchemyAPI.RELATIONS, SAORelations.class, TEXT, HTML, URL); - } - - /** - * Calculates the sentiment for text, a URL or HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link DocumentSentiment} - */ - public ServiceCall getSentiment(Map params) { - AlchemyAPI operation = AlchemyAPI.SENTIMENT; - if ((params.get(TARGET) != null) || (params.get(TARGETS) != null)) { - operation = AlchemyAPI.SENTIMENT_TARGETED; - } - - return createServiceCall(params, operation, DocumentSentiment.class, TEXT, HTML, URL); - } - - /** - * Extracts the cleaned text (removes ads, navigation, etc.) for a URL or HTML. if raw is true, extracts the cleaned - * text (removes ads, navigation, etc.). - * - * @param params The parameters to be used in the service call, html or url should be specified. - * @return {@link DocumentText} - */ - public ServiceCall getText(Map params) { - AlchemyAPI operation = AlchemyAPI.TEXT; - if (params.get(RAW) != null) { - operation = AlchemyAPI.TEXT_RAW; - } - - return createServiceCall(params, operation, DocumentText.class, HTML, URL); - } - - /** - * Extracts the title for a URL or HTML. - * - * @param params The parameters to be used in the service call, html or url should be specified. - * @return {@link DocumentTitle} - */ - public ServiceCall getTitle(Map params) { - return createServiceCall(params, AlchemyAPI.TITLE, DocumentTitle.class, HTML, URL); - } - - /** - * Detects emotions in a text, URL or HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified - * @return {@link DocumentEmotion} - */ - public ServiceCall getEmotion(Map params) { - return createServiceCall(params, AlchemyAPI.EMOTION, DocumentEmotion.class, TEXT, HTML, URL); - } - - /** - * Finds entities and their relationships from a text, URL or HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified - * @return {@link DocumentEmotion} - */ - public ServiceCall getTypedRelations(Map params) { - return createServiceCall(params, AlchemyAPI.TYPED, TypedRelations.class, TEXT, HTML, URL); - } - - /** - * Extracts dates for text, a URL or HTML. - * - * @param params The parameters to be used in the service call, text, html or url should be specified. - * @return {@link Dates} - */ - public ServiceCall getDates(final Map params) { - Map paramsCopy = new HashMap(params); - - if (params.containsKey(ANCHOR_DATE) && (params.get(ANCHOR_DATE) instanceof Date)) { - String anchorDate = formatDate((Date) params.get(ANCHOR_DATE)); - paramsCopy.put(ANCHOR_DATE, anchorDate); - } - - return createServiceCall(paramsCopy, AlchemyAPI.DATES, Dates.class, TEXT, HTML, URL); - } - - /** - * Format date. - * - * @param anchorDate the anchor date - * @return the formatted date as string - */ - private synchronized String formatDate(final Date anchorDate) { - return anchorDateFormat.format(anchorDate); - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVision.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVision.java deleted file mode 100644 index a89b8d65212..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVision.java +++ /dev/null @@ -1,309 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1; - -import java.io.File; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import com.ibm.watson.developer_cloud.alchemy.v1.model.AlchemyGenericModel; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageFaces; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageKeywords; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageLink; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageSceneText; -import com.ibm.watson.developer_cloud.alchemy.v1.util.AlchemyEndPoints; -import com.ibm.watson.developer_cloud.alchemy.v1.util.AlchemyEndPoints.AlchemyAPI; -import com.ibm.watson.developer_cloud.http.HttpMediaType; -import com.ibm.watson.developer_cloud.http.RequestBuilder; -import com.ibm.watson.developer_cloud.http.ServiceCall; -import com.ibm.watson.developer_cloud.service.AlchemyService; -import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; -import com.ibm.watson.developer_cloud.util.Validator; - -import okhttp3.RequestBody; - -/** - * The Alchemy Vision service uses deep learning innovations to understand a picture’s content and context. It sees - * complex visual scenes in their entirety —without needing any textual clues— leveraging a holistic approach to - * understanding the multiple objects and surroundings. - * - * @version v1 - * @see Alchemy Vision - */ -public class AlchemyVision extends AlchemyService { - private static final String FORCE_SHOW_ALL = "forceShowAll"; - private static final String HTML = "html"; - private static final String IMAGE = "image"; - private static final String IMAGE_POST_MODE = "imagePostMode"; - private static final String KNOWLEDGE_GRAPH = "knowledgeGraph"; - private static final String NOT_RAW = "not-raw"; - private static final String RAW = "raw"; - private static final String URL = "url"; - - /** - * Instantiates a new alchemy data news service. - */ - public AlchemyVision() { - super(); - } - - /** - * Instantiates a new alchemy vision service by apiKey. - * - * @param apiKey the api key - */ - public AlchemyVision(String apiKey) { - super(apiKey); - } - - /** - * Executes the request and return the POJO that represent the response. - * - * @param The POJO that represents the response object - * @param params the request parameters - * @param operation the alchemy operation - * @param returnType the POJO class to be parsed from the response - * @return the POJO object that represent the response - */ - private ServiceCall createServiceCall(Map params, - AlchemyAPI operation, Class returnType) { - final String inputType = getInputFormat(params, IMAGE, URL, HTML); - final String path = AlchemyEndPoints.getPath(operation, inputType); - - final RequestBuilder requestBuilder = RequestBuilder.post(path); - if (IMAGE.equals(inputType)) { - if (params.get(IMAGE) instanceof String) { - params.put(IMAGE_POST_MODE, NOT_RAW); - } else { - params.put(IMAGE_POST_MODE, RAW); - final File image = (File) params.get(IMAGE); - if (!image.exists()) { - throw new IllegalArgumentException("The file: " + image.getAbsolutePath() + " does not exist."); - } else { - requestBuilder.body(RequestBody.create(HttpMediaType.BINARY_FILE, (File) params.get(IMAGE))); - params.remove(IMAGE); - } - } - } - - // set json as default output mode - params.put(OUTPUT_MODE, "json"); - - // add all the parameters into the request as form-url-encoded parameters - for (final String param : params.keySet()) { - if (inputType.equals(IMAGE)) { - requestBuilder.query(param, params.get(param)); - } else { - requestBuilder.form(param, params.get(param)); - } - } - - return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(returnType)); - } - - /** - * Identifies text in an image. - * - * @param image the image file - * @return {@link ImageSceneText} - */ - public ServiceCall getImageSceneText(File image) { - Validator.notNull(image, "image cannot be null"); - Validator.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found"); - - final Map params = new HashMap(); - params.put(IMAGE, image); - - return createServiceCall(params, AlchemyAPI.IMAGE_SCENE_TEXT, ImageSceneText.class); - } - - /** - * Identifies text in an image specified by URL or in the primary image in a web page specified by URL. - * - * @param url the image URL - * @return {@link ImageSceneText} - */ - public ServiceCall getImageSceneText(URL url) { - Validator.notNull(url, "url cannot be null"); - - final Map params = new HashMap(); - params.put(URL, url); - - return createServiceCall(params, AlchemyAPI.IMAGE_SCENE_TEXT, ImageSceneText.class); - } - - /** - * Extracts keywords from an image. - * - * @param image the image file - * @param forceShowAll Includes lower confidence tags - * @param knowledgeGraph Include knowledge graph information in the the results. - * @return {@link ImageKeywords} - */ - public ServiceCall getImageKeywords(File image, Boolean forceShowAll, Boolean knowledgeGraph) { - Validator.notNull(image, "image cannot be null"); - Validator.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found"); - - final Map params = new HashMap(); - params.put(IMAGE, image); - - if (forceShowAll != null) { - params.put(FORCE_SHOW_ALL, forceShowAll ? 1 : 0); - } - - if (knowledgeGraph != null) { - params.put(KNOWLEDGE_GRAPH, knowledgeGraph ? 1 : 0); - } - - return createServiceCall(params, AlchemyAPI.IMAGE_KEYWORDS, ImageKeywords.class); - - } - - - /** - * Extracts keywords from a URL. - * - * @param url the image URL - * @param forceShowAll Includes lower confidence tags - * @param knowledgeGraph Include knowledge graph information in the the results. - * @return {@link ImageKeywords} - */ - public ServiceCall getImageKeywords(URL url, Boolean forceShowAll, Boolean knowledgeGraph) { - Validator.notNull(url, "url cannot be null"); - - final Map params = new HashMap(); - params.put(URL, url); - - if (forceShowAll != null) { - params.put(FORCE_SHOW_ALL, forceShowAll ? 1 : 0); - } - - if (knowledgeGraph != null) { - params.put(KNOWLEDGE_GRAPH, knowledgeGraph ? 1 : 0); - } - - return createServiceCall(params, AlchemyAPI.IMAGE_KEYWORDS, ImageKeywords.class); - } - - /** - * Extracts main image link from a URL. - * - * @param url the image URL - * @return {@link ImageLink} - */ - public ServiceCall getImageLink(URL url) { - Validator.notNull(url, "url cannot be null"); - - final Map params = new HashMap(); - params.put(URL, url); - - return createServiceCall(params, AlchemyAPI.IMAGE_LINK, ImageLink.class); - } - - /** - * Extracts the main image link from a HTML page. - * - * @param html the HTML - * @return {@link ImageLink} - */ - public ServiceCall getImageLink(String html) { - Validator.notNull(html, "html cannot be null"); - - final Map params = new HashMap(); - params.put(HTML, html); - - return createServiceCall(params, AlchemyAPI.IMAGE_LINK, ImageLink.class); - } - - /** - * Recognizes faces from an image.
- * For each face detected returns: - *
    - *
  • Bounding box - *
  • Gender - *
  • Approximate age - *
  • Name (if celebrity is detected) - *
- *
- * Here is an example of how to recognize faces in an image: - * - *
-   * AlchemyVision service = new AlchemyVision();
-   * service.setApiKey("<api_key>");
-   *
-   * File image = new File("obama.jpg");
-   * ImageFaces faces = service.recognizeFaces(image, true).execute();
-   *
-   * System.out.println(faces);
-   * 
- * - * @param image the image - * @param knowledgeGraph provide extra metadata for detected celebrities - * @return {@link ImageFaces} - */ - public ServiceCall recognizeFaces(File image, Boolean knowledgeGraph) { - Validator.notNull(image, "image cannot be null"); - Validator.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found"); - - final Map params = new HashMap(); - params.put(IMAGE, image); - - if (knowledgeGraph != null) { - params.put(KNOWLEDGE_GRAPH, knowledgeGraph ? 1 : 0); - } - - - return createServiceCall(params, AlchemyAPI.IMAGE_RECOGNITION, ImageFaces.class); - } - - /** - * Recognizes faces from a URL.
- * For each face detected returns: - *
    - *
  • Bounding box - *
  • Gender - *
  • Approximate age - *
  • Name (if celebrity is detected) - *
- *
- * Here is an example of how to recognize faces in an image: - * - *
-   * AlchemyVision service = new AlchemyVision();
-   * service.setApiKey("<api_key>");
-   *
-   * URL image = new URL("http://foo.com/the-image.png");
-   * ImageFaces faces = service.recognizeFaces(image, true).execute();
-   *
-   * System.out.println(faces);
-   * 
- * - * @param url the image URL - * @param knowledgeGraph provide extra metadata for detected celebrities - * @return {@link ImageFaces} - */ - public ServiceCall recognizeFaces(URL url, Boolean knowledgeGraph) { - Validator.notNull(url, "url cannot be null"); - - final Map params = new HashMap(); - params.put(URL, url); - - if (knowledgeGraph != null) { - params.put(KNOWLEDGE_GRAPH, knowledgeGraph ? 1 : 0); - } - - - return createServiceCall(params, AlchemyAPI.IMAGE_RECOGNITION, ImageFaces.class); - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/AlchemyGenericModel.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/AlchemyGenericModel.java deleted file mode 100644 index 5f4d931f0d6..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/AlchemyGenericModel.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Alchemy generic model with the number of transactions of each operation. - */ -public abstract class AlchemyGenericModel extends GenericModel { - - /** The total transactions. */ - private Integer totalTransactions; - - /** - * Gets the total transactions. - * - * @return the totalTransactions - */ - public Integer getTotalTransactions() { - return totalTransactions; - } - - /** - * Sets the total transactions. - * - * @param totalTransactions the totalTransactions to set - */ - public void setTotalTransactions(Integer totalTransactions) { - this.totalTransactions = totalTransactions; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/AlchemyLanguageGenericModel.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/AlchemyLanguageGenericModel.java deleted file mode 100644 index f43ec373b08..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/AlchemyLanguageGenericModel.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -/** - * Abstract model class for Alchemy Language models. - */ -public abstract class AlchemyLanguageGenericModel extends AlchemyGenericModel { - - private String language; - private String url; - - /** - * Gets the language. - * - * @return the language - */ - public String getLanguage() { - return language; - } - - /** - * Gets the url. - * - * @return the url - */ - public String getUrl() { - return url; - } - - /** - * Sets the language. - * - * @param language the language to set - */ - public void setLanguage(String language) { - this.language = language; - } - - /** - * Sets the url. - * - * @param url the url to set - */ - public void setUrl(String url) { - this.url = url; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Article.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Article.java deleted file mode 100755 index 421f1337d6e..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Article.java +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyDataNews; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Article returned by the {@link AlchemyDataNews} service. - */ -public class Article extends GenericModel { - - /** - * EnrichedTitle returned from {@link AlchemyDataNews#getNewsDocuments(java.util.Map)}. - */ - public static class EnrichedTitle extends GenericModel { - - private List concepts; - private List entities; - private List keywords; - private List relations; - @SerializedName("docSentiment") - private Sentiment sentiment; - private List taxonomy; - - - /** - * Gets the concepts. - * - * @return the concepts - */ - public List getConcepts() { - return concepts; - } - - /** - * Gets the entities. - * - * @return the entities - */ - public List getEntities() { - return entities; - } - - /** - * Gets the keywords. - * - * @return the keywords - */ - public List getKeywords() { - return keywords; - } - - /** - * Gets the relations. - * - * @return the relations - */ - public List getRelations() { - return relations; - } - - /** - * Gets the sentiment. - * - * @return the sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the taxonomy. - * - * @return the taxonomy - */ - public List getTaxonomy() { - return taxonomy; - } - - /** - * Sets the concepts. - * - * @param concepts the new concepts - */ - public void setConcepts(List concepts) { - this.concepts = concepts; - } - - /** - * Sets the entities. - * - * @param entities the new entities - */ - public void setEntities(List entities) { - this.entities = entities; - } - - /** - * Sets the keywords. - * - * @param keywords the new keywords - */ - public void setKeywords(List keywords) { - this.keywords = keywords; - } - - /** - * Sets the relations. - * - * @param relations the new relations - */ - public void setRelations(List relations) { - this.relations = relations; - } - - /** - * Sets the sentiment. - * - * @param sentiment the new sentiment - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the taxonomy. - * - * @param taxonomy the new taxonomy - */ - public void setTaxonomy(List taxonomy) { - this.taxonomy = taxonomy; - } - } - - private String author; - private String cleanedTitle; - private List concepts; - private EnrichedTitle enrichedTitle; - private List entities; - private List feeds; - private String image; - private List imageKeywords; - private List keywords; - private String language; - private PublicationDate publicationDate; - private List relations; - @SerializedName("docSentiment") - private Sentiment sentiment; - private List taxonomy; - private String text; - private String title; - private String url; - - /** - * Gets the author. - * - * @return the author - */ - public String getAuthor() { - return author; - } - - /** - * Gets the cleaned title. - * - * @return the cleaned title - */ - public String getCleanedTitle() { - return cleanedTitle; - } - - /** - * Gets the concepts. - * - * @return the concepts - */ - public List getConcepts() { - return concepts; - } - - /** - * Gets the enriched title. - * - * @return the enriched title - */ - public EnrichedTitle getEnrichedTitle() { - return enrichedTitle; - } - - /** - * Gets the entities. - * - * @return the entities - */ - public List getEntities() { - return entities; - } - - /** - * Gets the feeds. - * - * @return the feeds - */ - public List getFeeds() { - return feeds; - } - - /** - * Gets the image. - * - * @return the image - */ - public String getImage() { - return image; - } - - /** - * Gets the image keywords. - * - * @return the image keywords - */ - public List getImageKeywords() { - return imageKeywords; - } - - /** - * Gets the keywords. - * - * @return the keywords - */ - public List getKeywords() { - return keywords; - } - - /** - * Gets the language. - * - * @return the language - */ - public String getLanguage() { - return language; - } - - /** - * Gets the publication date. - * - * @return the publication date - */ - public PublicationDate getPublicationDate() { - return publicationDate; - } - - /** - * Gets the relations. - * - * @return the relations - */ - public List getRelations() { - return relations; - } - - /** - * Gets the sentiment. - * - * @return the sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the taxonomy. - * - * @return the taxonomy - */ - public List getTaxonomy() { - return taxonomy; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Gets the title. - * - * @return the title - */ - public String getTitle() { - return title; - } - - /** - * Gets the url. - * - * @return the url - */ - public String getUrl() { - return url; - } - - /** - * Sets the author. - * - * @param author the new author - */ - public void setAuthor(String author) { - this.author = author; - } - - /** - * Sets the cleaned title. - * - * @param cleanedTitle the new cleaned title - */ - public void setCleanedTitle(String cleanedTitle) { - this.cleanedTitle = cleanedTitle; - } - - - /** - * Sets the concepts. - * - * @param concepts the new concepts - */ - public void setConcepts(List concepts) { - this.concepts = concepts; - } - - /** - * Sets the enriched title. - * - * @param enrichedTitle the new enriched title - */ - public void setEnrichedTitle(EnrichedTitle enrichedTitle) { - this.enrichedTitle = enrichedTitle; - } - - /** - * Sets the entities. - * - * @param entities the new entities - */ - public void setEntities(List entities) { - this.entities = entities; - } - - /** - * Sets the feeds. - * - * @param feeds the new feeds - */ - public void setFeeds(List feeds) { - this.feeds = feeds; - } - - /** - * Sets the image. - * - * @param image the new image - */ - public void setImage(String image) { - this.image = image; - } - - /** - * Sets the image keywords. - * - * @param imageKeywords the new image keywords - */ - public void setImageKeywords(List imageKeywords) { - this.imageKeywords = imageKeywords; - } - - /** - * Sets the keywords. - * - * @param keywords the new keywords - */ - public void setKeywords(List keywords) { - this.keywords = keywords; - } - - /** - * Sets the language. - * - * @param language the new language - */ - public void setLanguage(String language) { - this.language = language; - } - - /** - * Sets the publication date. - * - * @param publicationDate the new publication date - */ - public void setPublicationDate(PublicationDate publicationDate) { - this.publicationDate = publicationDate; - } - - /** - * Sets the relations. - * - * @param relations the new relations - */ - public void setRelations(List relations) { - this.relations = relations; - } - - /** - * Sets the sentiment. - * - * @param sentiment the new sentiment - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the taxonomy. - * - * @param taxonomy the new taxonomy - */ - public void setTaxonomy(List taxonomy) { - this.taxonomy = taxonomy; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(String text) { - this.text = text; - } - - /** - * Sets the title. - * - * @param title the new title - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Sets the url. - * - * @param url the new url - */ - public void setUrl(String url) { - this.url = url; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/CombinedResults.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/CombinedResults.java deleted file mode 100644 index 90eb9ac5247..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/CombinedResults.java +++ /dev/null @@ -1,323 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Dates.ExtractedDate; - -/** - * Combined returned by the {@link AlchemyLanguage} service. - * - */ -public class CombinedResults extends AlchemyLanguageGenericModel { - - private String text; - - /** The author. */ - private String author; - - /** The concepts. */ - private List concepts; - - /** The entities. */ - private List entities; - - /** The extracted dates. */ - List dates; - - /** The feeds. */ - private List feeds; - - /** The image. */ - private String image; - - /** The image keywords. */ - private List imageKeywords; - - /** The keywords. */ - private List keywords; - - /** The publication date. */ - private PublicationDate publicationDate; - - /** The relations. */ - private List relations; - - /** The doc sentiment. */ - @SerializedName("docSentiment") - private Sentiment sentiment; - - /** The taxonomy. */ - private List taxonomy; - - /** The title. */ - private String title; - - /** - * Gets the author. - * - * @return the author - */ - public String getAuthor() { - return author; - } - - /** - * Gets the concepts. - * - * @return the concepts - */ - public List getConcepts() { - return concepts; - } - - /** - * Gets the entities. - * - * @return the entities - */ - public List getEntities() { - return entities; - } - - /** - * Gets the feeds. - * - * @return the feeds - */ - public List getFeeds() { - return feeds; - } - - /** - * Gets the image. - * - * @return the image - */ - public String getImage() { - return image; - } - - /** - * Gets the image keywords. - * - * @return the imageKeywords - */ - public List getImageKeywords() { - return imageKeywords; - } - - - /** - * Gets the dates. - * - * @return the dates - */ - public List getDates() { - return dates; - } - - /** - * Sets the dates. - * - * @param dates the new dates - */ - public void setDates(List dates) { - this.dates = dates; - } - - /** - * Gets the keywords. - * - * @return the keywords - */ - public List getKeywords() { - return keywords; - } - - /** - * Gets the publication date. - * - * @return the publicationDate - */ - public PublicationDate getPublicationDate() { - return publicationDate; - } - - /** - * Gets the relations. - * - * @return the relations - */ - public List getRelations() { - return relations; - } - - /** - * Gets the sentiment. - * - * @return the sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the taxonomy. - * - * @return the taxonomy - */ - public List getTaxonomy() { - return taxonomy; - } - - /** - * Gets the title. - * - * @return the title - */ - public String getTitle() { - return title; - } - - /** - * Sets the author. - * - * @param author the author to set - */ - public void setAuthor(String author) { - this.author = author; - } - - /** - * Sets the concepts. - * - * @param concepts the concepts to set - */ - public void setConcepts(List concepts) { - this.concepts = concepts; - } - - /** - * Sets the entities. - * - * @param entities the entities to set - */ - public void setEntities(List entities) { - this.entities = entities; - } - - /** - * Sets the feeds. - * - * @param feeds the feeds to set - */ - public void setFeeds(List feeds) { - this.feeds = feeds; - } - - /** - * Sets the image. - * - * @param image the image to set - */ - public void setImage(String image) { - this.image = image; - } - - /** - * Sets the image keywords. - * - * @param imageKeywords the imageKeywords to set - */ - public void setImageKeywords(List imageKeywords) { - this.imageKeywords = imageKeywords; - } - - /** - * Sets the keywords. - * - * @param keywords the keywords to set - */ - public void setKeywords(List keywords) { - this.keywords = keywords; - } - - /** - * Sets the publication date. - * - * @param publicationDate the publicationDate to set - */ - public void setPublicationDate(PublicationDate publicationDate) { - this.publicationDate = publicationDate; - } - - /** - * Sets the relations. - * - * @param relations the relations to set - */ - public void setRelations(List relations) { - this.relations = relations; - } - - /** - * Sets the sentiment. - * - * @param sentiment the sentiment to set - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the taxonomy. - * - * @param taxonomy the taxonomy to set - */ - public void setTaxonomy(List taxonomy) { - this.taxonomy = taxonomy; - } - - /** - * Sets the title. - * - * @param title the title to set - */ - public void setTitle(String title) { - this.title = title; - } - - - /** - * Returned if showSourceText is set to 1. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Concept.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Concept.java deleted file mode 100644 index d28c0f48db9..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Concept.java +++ /dev/null @@ -1,319 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Concept returned by the AlchemyLanguage service. - * - */ -public class Concept extends GenericModel { - - /** - * The link to the US Census for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String census; - - /** - * The cia link to the CIA World Factbook for the disambiguated entity. Note: Provided only for entities that exist in - * this linked data-set. - */ - private String ciaFactbook; - - /** - * The link to CrunchBase for the disambiguated entity. Note: Provided only for entities that exist in CrunchBase. - */ - private String crunchbase; - - /** - * The link to DBpedia for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String dbpedia; - - /** - * The link to Freebase for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String freebase; - - /** The geographic coordinates. */ - private String geo; - - /** - * The link to Geonames for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String geonames; - - /** - * The link to OpenCyc for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String opencyc; - - /** The relevance. */ - private Double relevance; - - /** The text. */ - private String text; - - /** The website. */ - private String website; - - /** - * The link to YAGO for the disambiguated entity. Note: Provided only for entities that exist in this linked data-set. - */ - private String yago; - - - /** The knowledge graph. */ - private KnowledgeGraph knowledgeGraph; - - /** - * Gets the knowledge graph. - * - * @return the knowledge graph - */ - public KnowledgeGraph getKnowledgeGraph() { - return knowledgeGraph; - } - - /** - * Sets the knowledge graph. - * - * @param knowledgeGraph the new knowledge graph - */ - public void setKnowledgeGraph(KnowledgeGraph knowledgeGraph) { - this.knowledgeGraph = knowledgeGraph; - } - - /** - * Gets the census. - * - * @return the census - */ - public String getCensus() { - return census; - } - - /** - * Gets the cia factbook. - * - * @return the ciaFactbook - */ - public String getCiaFactbook() { - return ciaFactbook; - } - - /** - * Gets the crunchbase. - * - * @return The crunchbase - */ - public String getCrunchbase() { - return crunchbase; - } - - /** - * Gets the dbpedia. - * - * @return The dbpedia - */ - public String getDbpedia() { - return dbpedia; - } - - /** - * Gets the freebase. - * - * @return The freebase - */ - public String getFreebase() { - return freebase; - } - - /** - * Gets the geo. - * - * @return the geo - */ - public String getGeo() { - return geo; - } - - /** - * Gets the geonames. - * - * @return the geonames - */ - public String getGeonames() { - return geonames; - } - - /** - * Gets the opencyc. - * - * @return The opencyc - */ - public String getOpencyc() { - return opencyc; - } - - /** - * Gets the relevance. - * - * @return The relevance - */ - public Double getRelevance() { - return relevance; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Gets the website. - * - * @return The website - */ - public String getWebsite() { - return website; - } - - /** - * Gets the yago. - * - * @return The yago - */ - public String getYago() { - return yago; - } - - /** - * Sets the census. - * - * @param census the census to set - */ - public void setCensus(String census) { - this.census = census; - } - - /** - * Sets the cia factbook. - * - * @param ciaFactbook the ciaFactbook to set - */ - public void setCiaFactbook(String ciaFactbook) { - this.ciaFactbook = ciaFactbook; - } - - /** - * Sets the crunchbase. - * - * @param crunchbase The crunchbase - */ - public void setCrunchbase(String crunchbase) { - this.crunchbase = crunchbase; - } - - /** - * Sets the dbpedia. - * - * @param dbpedia The dbpedia - */ - public void setDbpedia(String dbpedia) { - this.dbpedia = dbpedia; - } - - /** - * Sets the freebase. - * - * @param freebase The freebase - */ - public void setFreebase(String freebase) { - this.freebase = freebase; - } - - /** - * Sets the geo. - * - * @param geo the geo to set - */ - public void setGeo(String geo) { - this.geo = geo; - } - - /** - * Sets the geonames. - * - * @param geonames the geonames to set - */ - public void setGeonames(String geonames) { - this.geonames = geonames; - } - - /** - * Sets the opencyc. - * - * @param opencyc The opencyc - */ - public void setOpencyc(String opencyc) { - this.opencyc = opencyc; - } - - /** - * Sets the relevance. - * - * @param relevance The relevance - */ - public void setRelevance(Double relevance) { - this.relevance = relevance; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - /** - * Sets the website. - * - * @param website The website - */ - public void setWebsite(String website) { - this.website = website; - } - - /** - * Sets the yago. - * - * @param yago The yago - */ - public void setYago(String yago) { - this.yago = yago; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Concepts.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Concepts.java deleted file mode 100644 index eca87e084fa..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Concepts.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Concepts returned by {@link AlchemyLanguage#getConcepts(java.util.Map)}. - * - */ -public class Concepts extends AlchemyLanguageGenericModel { - - /** The concepts. */ - private List concepts; - - /** - * Gets the concepts. - * - * @return the concepts - */ - public List getConcepts() { - return concepts; - } - - /** - * Sets the concepts. - * - * @param concepts the concepts to set - */ - public void setConcepts(List concepts) { - this.concepts = concepts; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Dates.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Dates.java deleted file mode 100644 index c293f854093..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Dates.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.Date; -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Extracted dates by the {@link AlchemyLanguage#getDates(java.util.Map)} method. - */ -public class Dates extends AlchemyLanguageGenericModel { - - /** - * The date along with the text from where the date was extracted. - */ - public static class ExtractedDate extends GenericModel { - - private Date date; - private String text; - - /** - * Gets the date. - * - * @return the date - */ - public Date getDate() { - return date; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the date. - * - * @param date the new date - */ - public void setDate(Date date) { - this.date = date; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(String text) { - this.text = text; - } - - } - - private List dates; - - private String text; - - /** - * Gets the dates. - * - * @return the dates - */ - public List getDates() { - return dates; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the dates. - * - * @param dates the new dates - */ - public void setDates(List dates) { - this.dates = dates; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DisambiguatedLinks.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DisambiguatedLinks.java deleted file mode 100755 index e8cbfbd3a43..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DisambiguatedLinks.java +++ /dev/null @@ -1,347 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Disambiguated returned by Alchemy services. - * - */ -public class DisambiguatedLinks extends GenericModel { - - /** - * The link to the US Census for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String census; - - /** - * The cia link to the CIA World Factbook for the disambiguated entity. Note: Provided only for entities that exist in - * this linked data-set. - */ - private String ciaFactbook; - - /** - * The link to CrunchBase for the disambiguated entity. Note: Provided only for entities that exist in CrunchBase. - */ - private String crunchbase; - - /** - * The link to DBpedia for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String dbpedia; - - /** - * The link to Freebase for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String freebase; - - /** The geographic coordinates. */ - private String geo; - - /** - * The link to Geonames for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String geonames; - - /** - * The music link to MusicBrainz for the disambiguated entity. Note: Provided only for entities that exist in this - * linked data-set. - */ - private String musicBrainz; - - /** The entity name. */ - private String name; - - /** - * The link to OpenCyc for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String opencyc; - - /** The disambiguated entity subType. */ - private List subType; - - /** - * The link to UMBEL for the disambiguated entity. Note: Provided only for entities that exist in this linked - * data-set. - */ - private String umbel; - - /** The website. */ - private String website; - - /** - * The link to YAGO for the disambiguated entity. Note: Provided only for entities that exist in this linked data-set. - */ - private String yago; - - /** - * Gets the census. - * - * @return the census - */ - public String getCensus() { - return census; - } - - /** - * Gets the cia factbook. - * - * @return the ciaFactbook - */ - public String getCiaFactbook() { - return ciaFactbook; - } - - /** - * Gets the crunchbase. - * - * @return the crunchbase - */ - public String getCrunchbase() { - return crunchbase; - } - - /** - * Gets the dbpedia. - * - * @return The dbpedia - */ - public String getDbpedia() { - return dbpedia; - } - - /** - * Gets the freebase. - * - * @return The freebase - */ - public String getFreebase() { - return freebase; - } - - /** - * Gets the geo. - * - * @return the geo - */ - public String getGeo() { - return geo; - } - - /** - * Gets the geonames. - * - * @return the geonames - */ - public String getGeonames() { - return geonames; - } - - /** - * Gets the music brainz. - * - * @return the musicBrainz - */ - public String getMusicBrainz() { - return musicBrainz; - } - - /** - * Gets the name. - * - * @return The name - */ - public String getName() { - return name; - } - - /** - * Gets the opencyc. - * - * @return the opencyc - */ - public String getOpencyc() { - return opencyc; - } - - /** - * Gets the sub type. - * - * @return The subType - */ - public List getSubType() { - return subType; - } - - /** - * Gets the umbel. - * - * @return the umbel - */ - public String getUmbel() { - return umbel; - } - - /** - * Gets the website. - * - * @return The website - */ - public String getWebsite() { - return website; - } - - /** - * Gets the yago. - * - * @return the yago - */ - public String getYago() { - return yago; - } - - /** - * Sets the census. - * - * @param census the census to set - */ - public void setCensus(String census) { - this.census = census; - } - - /** - * Sets the cia factbook. - * - * @param ciaFactbook the ciaFactbook to set - */ - public void setCiaFactbook(String ciaFactbook) { - this.ciaFactbook = ciaFactbook; - } - - /** - * Sets the crunchbase. - * - * @param crunchbase the crunchbase to set - */ - public void setCrunchbase(String crunchbase) { - this.crunchbase = crunchbase; - } - - /** - * Sets the dbpedia. - * - * @param dbpedia The dbpedia - */ - public void setDbpedia(String dbpedia) { - this.dbpedia = dbpedia; - } - - /** - * Sets the freebase. - * - * @param freebase The freebase - */ - public void setFreebase(String freebase) { - this.freebase = freebase; - } - - /** - * Sets the geo. - * - * @param geo the geo to set - */ - public void setGeo(String geo) { - this.geo = geo; - } - - /** - * Sets the geonames. - * - * @param geonames the geonames to set - */ - public void setGeonames(String geonames) { - this.geonames = geonames; - } - - /** - * Sets the music brainz. - * - * @param musicBrainz the musicBrainz to set - */ - public void setMusicBrainz(String musicBrainz) { - this.musicBrainz = musicBrainz; - } - - /** - * Sets the name. - * - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the opencyc. - * - * @param opencyc the opencyc to set - */ - public void setOpencyc(String opencyc) { - this.opencyc = opencyc; - } - - /** - * Sets the sub type. - * - * @param subType The subType - */ - public void setSubType(List subType) { - this.subType = subType; - } - - /** - * Sets the umbel. - * - * @param umbel the umbel to set - */ - public void setUmbel(String umbel) { - this.umbel = umbel; - } - - /** - * Sets the website. - * - * @param website The website - */ - public void setWebsite(String website) { - this.website = website; - } - - /** - * Sets the yago. - * - * @param yago the yago to set - */ - public void setYago(String yago) { - this.yago = yago; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Document.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Document.java deleted file mode 100755 index 2c30174e91c..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Document.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.JsonAdapter; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyDataNews; -import com.ibm.watson.developer_cloud.service.model.GenericModel; -import com.ibm.watson.developer_cloud.util.LongToDateTypeAdapter; - -/** - * Doc returned by the {@link AlchemyDataNews} service. - * - */ -public class Document extends GenericModel { - - /** The id. */ - private String id; - - /** The source. */ - private Source source; - - /** The timestamp. */ - @JsonAdapter(LongToDateTypeAdapter.class) - private Date timestamp; - - /** - * Gets the id. - * - * @return The id - */ - public String getId() { - return id; - } - - /** - * Gets the source. - * - * @return The source - */ - public Source getSource() { - return source; - } - - /** - * Gets the timestamp. - * - * @return The timestamp - */ - public Date getTimestamp() { - return timestamp; - } - - /** - * Sets the id. - * - * @param id The id - */ - public void setId(String id) { - this.id = id; - } - - /** - * Sets the source. - * - * @param source The source - */ - public void setSource(Source source) { - this.source = source; - } - - /** - * Sets the timestamp. - * - * @param timestamp The timestamp - */ - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentAuthors.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentAuthors.java deleted file mode 100644 index cec105c97f3..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentAuthors.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Author returned by the {@link AlchemyLanguage} service. - * - */ -public class DocumentAuthors extends AlchemyLanguageGenericModel { - - /** - * Authors returned by the {@link AlchemyLanguage} service. - * - */ - public static class Authors extends GenericModel { - - /** The confident. */ - private String confident; - - /** - * The names. - */ - private List names = new ArrayList(); - - /** - * Gets the confident. - * - * @return the confident - */ - public String getConfident() { - return confident; - } - - /** - * Gets the names. - * - * @return The names - */ - public List getNames() { - return names; - } - - /** - * Sets the confident. - * - * @param confident the confident to set - */ - public void setConfident(String confident) { - this.confident = confident; - } - - /** - * Sets the names. - * - * @param names The names - */ - public void setNames(List names) { - this.names = names; - } - } - - /** - * The authors. - */ - private Authors authors; - - /** - * Gets the authors. - * - * @return The authors - */ - public Authors getAuthors() { - return authors; - } - - /** - * Sets the authors. - * - * @param authors The authors - */ - public void setAuthors(Authors authors) { - this.authors = authors; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentEmotion.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentEmotion.java deleted file mode 100644 index 82efbaa9f5e..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentEmotion.java +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * The document emotion from {@link AlchemyLanguage#getEmotion(java.util.Map)}. - * - */ -public class DocumentEmotion extends AlchemyLanguageGenericModel { - - /** - * The extracted emotion from {@link AlchemyLanguage#getEmotion(java.util.Map)}. - */ - public static class Emotion extends GenericModel { - private Double anger; - private Double disgust; - private Double fear; - private Double joy; - private Double sadness; - - /** - * Gets the anger. - * - * @return the anger - */ - public Double getAnger() { - return anger; - } - - /** - * Gets the disgust. - * - * @return the disgust - */ - public Double getDisgust() { - return disgust; - } - - /** - * Gets the fear. - * - * @return the fear - */ - public Double getFear() { - return fear; - } - - /** - * Gets the joy. - * - * @return the joy - */ - public Double getJoy() { - return joy; - } - - /** - * Gets the sadness. - * - * @return the sadness - */ - public Double getSadness() { - return sadness; - } - - /** - * Sets the anger. - * - * @param anger the new anger - */ - public void setAnger(Double anger) { - this.anger = anger; - } - - /** - * Sets the disgust. - * - * @param disgust the new disgust - */ - public void setDisgust(Double disgust) { - this.disgust = disgust; - } - - /** - * Sets the fear. - * - * @param fear the new fear - */ - public void setFear(Double fear) { - this.fear = fear; - } - - /** - * Sets the joy. - * - * @param joy the new joy - */ - public void setJoy(Double joy) { - this.joy = joy; - } - - /** - * Sets the sadness. - * - * @param sadness the new sadness - */ - public void setSadness(Double sadness) { - this.sadness = sadness; - } - - } - - @SerializedName("docEmotions") - private Emotion emotion; - - private String text; - - /** - * Gets the emotion. - * - * @return the emotion - */ - public Emotion getEmotion() { - return emotion; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the emotion. - * - * @param emotion the new emotion - */ - public void setEmotion(Emotion emotion) { - this.emotion = emotion; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(String text) { - this.text = text; - } -} - diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentPublicationDate.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentPublicationDate.java deleted file mode 100644 index 0f1e22c6980..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentPublicationDate.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Publication date returned by {@link AlchemyLanguage#getPublicationDate(java.util.Map)}. - * - */ -public class DocumentPublicationDate extends AlchemyLanguageGenericModel { - - private PublicationDate publicationDate; - - /** - * Gets the publication date. - * - * @return the publication date - */ - public PublicationDate getPublicationDate() { - return publicationDate; - } - - /** - * Sets the publication date. - * - * @param publicationDate the publicationDate to set - */ - public void setPublicationDate(PublicationDate publicationDate) { - this.publicationDate = publicationDate; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentSentiment.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentSentiment.java deleted file mode 100644 index fef601eed33..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentSentiment.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * DocSentiment returned by the {@link AlchemyLanguage} service. - * - */ -public class DocumentSentiment extends AlchemyLanguageGenericModel { - - /** The doc sentiment. */ - @SerializedName("docSentiment") - private Sentiment sentiment; - - /** The text. */ - private String text; - - /** - * Gets the sentiment. - * - * @return the sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the sentiment. - * - * @param sentiment the sentiment to set - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the text. - * - * @param text the text to set - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentText.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentText.java deleted file mode 100644 index f9a4e004e92..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentText.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Text extracted from an html or url page and returned by the {@link AlchemyLanguage} service. - * - */ -public class DocumentText extends AlchemyLanguageGenericModel { - - /** The text. */ - private String text; - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the text. - * - * @param text the text to set - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentTitle.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentTitle.java deleted file mode 100644 index 7d0278ad991..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentTitle.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Title returned by the {@link AlchemyLanguage} service. - * - */ -public class DocumentTitle extends AlchemyLanguageGenericModel { - - /** The title. */ - private String title; - - /** - * Gets the title. - * - * @return The title - */ - public String getTitle() { - return title; - } - - /** - * Sets the title. - * - * @param title The title - */ - public void setTitle(String title) { - this.title = title; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Documents.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Documents.java deleted file mode 100755 index 91f3bcd4d18..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Documents.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyDataNews; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Documents by the {@link AlchemyDataNews} service. - * - */ -public class Documents extends GenericModel { - - /** The documents. */ - @SerializedName("docs") - private List documents; - - /** The next. */ - private String next; - - /** - * Gets the documents. - * - * @return the documents - */ - public List getDocuments() { - return documents; - } - - /** - * Gets the next. - * - * @return The next - */ - public String getNext() { - return next; - } - - /** - * Sets the docs. - * - * @param docs The docs - */ - public void setDocs(List docs) { - documents = docs; - } - - /** - * Sets the documents. - * - * @param documents the documents to set - */ - public void setDocuments(List documents) { - this.documents = documents; - } - - /** - * Sets the next. - * - * @param next The next - */ - public void setNext(String next) { - this.next = next; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentsResult.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentsResult.java deleted file mode 100755 index 961a91cbe62..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentsResult.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyDataNews; - -/** - * Result by the {@link AlchemyDataNews} service. - * - */ -public class DocumentsResult extends AlchemyGenericModel { - - /** The document. */ - @SerializedName("result") - private Documents documents; - - /** - * Gets the document. - * - * @return the document - */ - public Documents getDocuments() { - return documents; - } - - /** - * Sets the document. - * - * @param documents the document to set - */ - public void setDocuments(Documents documents) { - this.documents = documents; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Entities.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Entities.java deleted file mode 100644 index ba0e515e436..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Entities.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Entities returned by the {@link AlchemyLanguage} service. - * - */ -public class Entities extends AlchemyLanguageGenericModel { - - /** The entities. */ - private List entities; - - - /** - * Gets the entities. - * - * @return The entities - */ - public List getEntities() { - return entities; - } - - /** - * Sets the entities. - * - * @param entities The entities - */ - public void setEntities(List entities) { - this.entities = entities; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Entity.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Entity.java deleted file mode 100644 index 5cfeac148e6..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Entity.java +++ /dev/null @@ -1,210 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - - -import java.util.List; - -/** - * Entity returned by the AlchemyDataNews and AlchemyLanguage service. - */ -public class Entity extends AlchemyGenericModel { - - /** The count. */ - private Integer count; - - /** The disambiguated. */ - private DisambiguatedLinks disambiguated; - - /** The knowledge graph. */ - private KnowledgeGraph knowledgeGraph; - - /** The quotations. */ - private List quotations; - - /** The relevance. */ - private Double relevance; - - /** The sentiment. */ - private Sentiment sentiment; - - /** The text. */ - private String text; - - /** The type. */ - private String type; - - private DocumentEmotion emotions; - - /** - * Gets the count. - * - * @return The count - */ - public int getCount() { - return count; - } - - /** - * Gets the disambiguated. - * - * @return The disambiguated - */ - public DisambiguatedLinks getDisambiguated() { - return disambiguated; - } - - /** - * Gets the knowledge graph. - * - * @return The knowledgeGraph - */ - public KnowledgeGraph getKnowledgeGraph() { - return knowledgeGraph; - } - - /** - * Gets the quotations. - * - * @return The quotations - */ - public List getQuotations() { - return quotations; - } - - /** - * Gets the relevance. - * - * @return The relevance - */ - public Double getRelevance() { - return relevance; - } - - /** - * Gets the sentiment. - * - * @return The sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Gets the type. - * - * @return The type - */ - public String getType() { - return type; - } - - /** - * Gets the emotions. - * - * @return The emotions - */ - public DocumentEmotion getEmotions() { - return emotions; - } - - /** - * Sets the count. - * - * @param count The count - */ - public void setCount(int count) { - this.count = count; - } - - /** - * Sets the disambiguated. - * - * @param disambiguated The disambiguated - */ - public void setDisambiguated(DisambiguatedLinks disambiguated) { - this.disambiguated = disambiguated; - } - - /** - * Sets the knowledge graph. - * - * @param knowledgeGraph The knowledgeGraph - */ - public void setKnowledgeGraph(KnowledgeGraph knowledgeGraph) { - this.knowledgeGraph = knowledgeGraph; - } - - /** - * Sets the quotations. - * - * @param quotations The quotations - */ - public void setQuotations(List quotations) { - this.quotations = quotations; - } - - /** - * Sets the relevance. - * - * @param relevance The relevance - */ - public void setRelevance(Double relevance) { - this.relevance = relevance; - } - - /** - * Sets the sentiment. - * - * @param sentiment The sentiment - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - /** - * Sets the type. - * - * @param type The type - */ - public void setType(String type) { - this.type = type; - } - - /** - * Sets the emotions. - * - * @param emotions The emotions - */ - public void setEmotions(DocumentEmotion emotions) { - this.emotions = emotions; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Feed.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Feed.java deleted file mode 100644 index 8b6b5d24ab8..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Feed.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Feed returned by the {@link AlchemyLanguage} service. - * - */ -public class Feed extends AlchemyGenericModel { - - /** The feed. */ - private String feed; - - /** - * Gets the feed. - * - * @return the feed - */ - public String getFeed() { - return feed; - } - - /** - * Sets the feed. - * - * @param feed the feed to set - */ - public void setFeed(String feed) { - this.feed = feed; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Feeds.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Feeds.java deleted file mode 100644 index b5426fdc912..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Feeds.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Feeds returned by the {@link AlchemyLanguage} service. - * - */ -public class Feeds extends AlchemyLanguageGenericModel { - - /** The feeds. */ - private List feeds; - - /** - * Gets the feeds. - * - * @return the feeds - */ - public List getFeeds() { - return feeds; - } - - /** - * Sets the feeds. - * - * @param feeds the feeds to set - */ - public void setFeeds(List feeds) { - this.feeds = feeds; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Identity.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Identity.java deleted file mode 100644 index 649bfa5acd2..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Identity.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Identity by the {@link AlchemyVision} service. - * - */ -public class Identity extends GenericModel { - - /** The disambiguated. */ - private DisambiguatedLinks disambiguated; - - /** The knowledge graph. */ - private KnowledgeGraph knowledgeGraph; - - /** The name. */ - private String name; - - /** The score. */ - private String score; - - /** - * Gets the disambiguated. - * - * @return The disambiguated - */ - public DisambiguatedLinks getDisambiguated() { - return disambiguated; - } - - /** - * Gets the knowledge graph. - * - * @return The knowledgeGraph - */ - public KnowledgeGraph getKnowledgeGraph() { - return knowledgeGraph; - } - - /** - * Gets the name. - * - * @return The name - */ - public String getName() { - return name; - } - - /** - * Gets the score. - * - * @return The score - */ - public String getScore() { - return score; - } - - /** - * Sets the disambiguated. - * - * @param disambiguated The disambiguated - */ - public void setDisambiguated(DisambiguatedLinks disambiguated) { - this.disambiguated = disambiguated; - } - - /** - * Sets the knowledge graph. - * - * @param knowledgeGraph The knowledgeGraph - */ - public void setKnowledgeGraph(KnowledgeGraph knowledgeGraph) { - this.knowledgeGraph = knowledgeGraph; - } - - /** - * Sets the name. - * - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the score. - * - * @param score The score - */ - public void setScore(String score) { - this.score = score; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageFace.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageFace.java deleted file mode 100644 index ace55ce99c4..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageFace.java +++ /dev/null @@ -1,267 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * ImageFace returned by {@link AlchemyVision#recognizeFaces(java.io.File, Boolean)}. - * - */ -public class ImageFace extends GenericModel { - - /** - * Face Age range. - */ - public static class AgeRange extends GenericModel { - - /** The age range. */ - private String ageRange; - - /** The score. */ - private Double score; - - /** - * Gets the age range. - * - * @return The ageRange - */ - public String getAgeRange() { - return ageRange; - } - - /** - * Gets the score. - * - * @return The score - */ - public Double getScore() { - return score; - } - - /** - * Sets the age range. - * - * @param ageRange The ageRange - */ - public void setAgeRange(String ageRange) { - this.ageRange = ageRange; - } - - /** - * Sets the score. - * - * @param score The score - */ - public void setScore(Double score) { - this.score = score; - } - } - - /** - * Face gender. - */ - public static class Gender extends GenericModel { - - /** The gender. */ - private String gender; - - /** The score. */ - private Double score; - - /** - * Gets the gender. - * - * @return The gender - */ - public String getGender() { - return gender; - } - - /** - * Gets the score. - * - * @return The score - */ - public Double getScore() { - return score; - } - - /** - * Sets the gender. - * - * @param gender The gender - */ - public void setGender(String gender) { - this.gender = gender; - } - - /** - * Sets the score. - * - * @param score The score - */ - public void setScore(Double score) { - this.score = score; - } - - } - - /** The age. */ - private AgeRange age; - - /** The gender. */ - private Gender gender; - - /** The height. */ - private Integer height; - - /** The identity. */ - private Identity identity; - - /** The position x. */ - private Integer positionX; - - /** The position y. */ - private Integer positionY; - - /** The width. */ - private Integer width; - - /** - * Gets the age. - * - * @return The age - */ - public AgeRange getAge() { - return age; - } - - /** - * Gets the gender. - * - * @return The gender - */ - public Gender getGender() { - return gender; - } - - /** - * Gets the height. - * - * @return The height - */ - public Integer getHeight() { - return height; - } - - /** - * Gets the identity. - * - * @return The identity - */ - public Identity getIdentity() { - return identity; - } - - /** - * Gets the position x. - * - * @return The positionX - */ - public Integer getPositionX() { - return positionX; - } - - /** - * Gets the position y. - * - * @return The positionY - */ - public Integer getPositionY() { - return positionY; - } - - /** - * Gets the width. - * - * @return The width - */ - public Integer getWidth() { - return width; - } - - /** - * Sets the age. - * - * @param age The age - */ - public void setAge(AgeRange age) { - this.age = age; - } - - /** - * Sets the gender. - * - * @param gender The gender - */ - public void setGender(Gender gender) { - this.gender = gender; - } - - /** - * Sets the height. - * - * @param height The height - */ - public void setHeight(Integer height) { - this.height = height; - } - - /** - * Sets the identity. - * - * @param identity The identity - */ - public void setIdentity(Identity identity) { - this.identity = identity; - } - - /** - * Sets the position x. - * - * @param positionX The positionX - */ - public void setPositionX(Integer positionX) { - this.positionX = positionX; - } - - /** - * Sets the position y. - * - * @param positionY The positionY - */ - public void setPositionY(Integer positionY) { - this.positionY = positionY; - } - - /** - * Sets the width. - * - * @param width The width - */ - public void setWidth(Integer width) { - this.width = width; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageFaces.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageFaces.java deleted file mode 100644 index df62778ecbc..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageFaces.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; - -/** - * FaceTag by the {@link AlchemyVision} service. - * - */ -public class ImageFaces extends AlchemyGenericModel { - - /** The image faces. */ - private List imageFaces; - - /** The url. */ - private String url; - - /** - * Gets the image faces. - * - * @return The imageFaces - */ - public List getImageFaces() { - return imageFaces; - } - - /** - * Gets the url. - * - * @return The url - */ - public String getUrl() { - return url; - } - - /** - * Sets the image faces. - * - * @param imageFaces The imageFaces - */ - public void setImageFaces(List imageFaces) { - this.imageFaces = imageFaces; - } - - /** - * Sets the url. - * - * @param url The url - */ - public void setUrl(String url) { - this.url = url; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java deleted file mode 100644 index 2f62d829033..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * ImageKeyword by the {@link AlchemyVision} service. - * - */ -public class ImageKeyword extends GenericModel { - - /** The {@link KnowledgeGraph}. */ - private KnowledgeGraph knowledgeGraph; - - /** The score. */ - private Double score; - - /** The text. */ - private String text; - - /** - * Gets the hierarchy. A value is only present if the request that produced this instance was made with - * {@code knowledgeGraph = true}. - * - * @return The hierarchy, if it exists. - */ - public String getHierarchy() { - return (knowledgeGraph == null) ? null : knowledgeGraph.getTypeHierarchy(); - } - - /** - * Gets the score. - * - * @return The score - */ - public Double getScore() { - return score; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Sets the hierarchy. - * - * @param hierarchy The hierarchy. - */ - public void setHierarchy(String hierarchy) { - if (knowledgeGraph == null) { - knowledgeGraph = new KnowledgeGraph(); - } - - knowledgeGraph.setTypeHierarchy(hierarchy); - } - - /** - * Sets the score. - * - * @param score The score - */ - public void setScore(Double score) { - this.score = score; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeywords.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeywords.java deleted file mode 100644 index 0dc521da0df..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeywords.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; - -/** - * Image by the {@link AlchemyVision} service. - * - */ -public class ImageKeywords extends AlchemyGenericModel { - - /** The image keywords. */ - private List imageKeywords; - - /** The url. */ - private String url; - - /** - * Gets the image keywords. - * - * @return The imageKeywords - */ - public List getImageKeywords() { - return imageKeywords; - } - - /** - * Gets the url. - * - * @return The url - */ - public String getUrl() { - return url; - } - - /** - * Sets the image keywords. - * - * @param imageKeywords The imageKeywords - */ - public void setImageKeywords(List imageKeywords) { - this.imageKeywords = imageKeywords; - } - - /** - * Sets the url. - * - * @param url The url - */ - public void setUrl(String url) { - this.url = url; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageLink.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageLink.java deleted file mode 100644 index e12abde3f17..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageLink.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; - -/** - * ImageLink by the {@link AlchemyVision} service. - * - */ -public class ImageLink extends AlchemyGenericModel { - - /** The image. */ - private String image; - - /** The url. */ - private String url; - - /** - * Gets the image. - * - * @return The image - */ - public String getImage() { - return image; - } - - /** - * Gets the url. - * - * @return The url - */ - public String getUrl() { - return url; - } - - /** - * Sets the image. - * - * @param image The image - */ - public void setImage(String image) { - this.image = image; - } - - /** - * Sets the url. - * - * @param url The url - */ - public void setUrl(String url) { - this.url = url; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneText.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneText.java deleted file mode 100644 index d69379bd068..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneText.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; - -/** - * SceneText by the {@link AlchemyVision} service. - * - */ -public class ImageSceneText extends AlchemyGenericModel { - - /** The scene text. */ - private String sceneText; - - /** The image text lines. */ - private List sceneTextLines; - - /** The url. */ - private String url; - - /** - * Gets the scene text. - * - * @return The scene text - */ - public String getSceneText() { - return sceneText; - } - - /** - * Gets the image faces. - * - * @return The imageFaces - */ - public List getSceneTextLines() { - return sceneTextLines; - } - - /** - * Gets the url. - * - * @return The url - */ - public String getUrl() { - return url; - } - - /** - * Sets the image texts. - * - * @param imageTexts The imageTexts - */ - public void setSceneTextLines(List imageTexts) { - sceneTextLines = imageTexts; - } - - /** - * Sets the url. - * - * @param url The url - */ - public void setUrl(String url) { - this.url = url; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneTextLine.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneTextLine.java deleted file mode 100644 index 50fbeca699a..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneTextLine.java +++ /dev/null @@ -1,270 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVision; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * ImageSceneTextLine returned by {@link AlchemyVision#getImageSceneText(java.io.File)}. - * - */ -public class ImageSceneTextLine extends GenericModel { - - /** - * Region. - */ - public static class Region extends GenericModel { - - /** The height. */ - private Integer height; - - /** The width. */ - private Integer width; - - /** The x. */ - private Integer x; - - /** The y. */ - private Integer y; - - /** - * Gets the region height. - * - * @return The height - */ - public Integer getHeight() { - return height; - } - - /** - * Gets the region width. - * - * @return The width - */ - public Integer getWidth() { - return width; - } - - /** - * Gets the region x. - * - * @return The x - */ - public Integer getX() { - return x; - } - - /** - * Gets the region y. - * - * @return The y - */ - public Integer getY() { - return y; - } - - /** - * Sets the region height. - * - * @param height The height - */ - public void setHeight(Integer height) { - this.height = height; - } - - /** - * Sets the region width. - * - * @param width The width - */ - public void setWidth(Integer width) { - this.width = width; - } - - /** - * Sets the region x. - * - * @param x The x. - */ - public void setX(Integer x) { - this.x = x; - } - - /** - * Sets the region y. - * - * @param y The y - */ - public void setY(Integer y) { - this.y = y; - } - } - - /** - * A word within a line of text. - */ - public static class Word extends GenericModel { - - /** The confidence. */ - private Double confidence; - - /** The region. */ - private Region region; - - /** The text. */ - private String text; - - /** - * Gets the confidence. - * - * @return The confidence - */ - public Double getConfidence() { - return confidence; - } - - /** - * Gets the region. - * - * @return The region - */ - public Region getRegion() { - return region; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Sets the confidence. - * - * @param confidence The confidence - */ - public void setConfidence(Double confidence) { - this.confidence = confidence; - } - - /** - * Sets the region. - * - * @param region The region - */ - public void setRegion(Region region) { - this.region = region; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - } - - /** The confidence. */ - private Double confidence; - - /** The region. */ - private Region region; - - /** The text. */ - private String text; - - /** The words. */ - private List words; - - /** - * Gets the confidence. - * - * @return The confidence - */ - public Double getConfidence() { - return confidence; - } - - /** - * Gets the region. - * - * @return The region - */ - public Region getRegion() { - return region; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Gets the words. - * - * @return The words - */ - public List getWords() { - return words; - } - - /** - * Sets the confidence. - * - * @param confidence The confidence - */ - public void setConfidence(Double confidence) { - this.confidence = confidence; - } - - /** - * Sets the region. - * - * @param region The region - */ - public void setRegion(Region region) { - this.region = region; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - /** - * Sets the words. - * - * @param words The words - */ - public void setWords(List words) { - this.words = words; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Keyword.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Keyword.java deleted file mode 100644 index 0bc8c1738ac..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Keyword.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -/** - * Keyword returned by the AlchemyLanguage service. - * - */ -public class Keyword extends AlchemyLanguageGenericModel { - - /** The knowledge graph. */ - private KnowledgeGraph knowledgeGraph; - - /** The relevance. */ - private Double relevance; - - /** The sentiment. */ - private Sentiment sentiment; - - /** The text. */ - private String text; - - /** - * Gets the knowledge graph. - * - * @return the knowledgeGraph - */ - public KnowledgeGraph getKnowledgeGraph() { - return knowledgeGraph; - } - - /** - * Gets the relevance. - * - * @return The relevance - */ - public Double getRelevance() { - return relevance; - } - - /** - * Gets the sentiment. - * - * @return The sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Sets the knowledge graph. - * - * @param knowledgeGraph the knowledgeGraph to set - */ - public void setKnowledgeGraph(KnowledgeGraph knowledgeGraph) { - this.knowledgeGraph = knowledgeGraph; - } - - /** - * Sets the relevance. - * - * @param relevance The relevance - */ - public void setRelevance(Double relevance) { - this.relevance = relevance; - } - - /** - * Sets the sentiment. - * - * @param sentiment The sentiment - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Keywords.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Keywords.java deleted file mode 100644 index 174b88c0bdd..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Keywords.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Keywords returned by the {@link AlchemyLanguage} service. - * - */ -public class Keywords extends AlchemyLanguageGenericModel { - - /** The keywords. */ - private List keywords; - - /** The text. */ - private String text; - - - /** - * Gets the keywords. - * - * @return The keywords - */ - public List getKeywords() { - return keywords; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the keywords. - * - * @param keywords The keywords - */ - public void setKeywords(List keywords) { - this.keywords = keywords; - } - - /** - * Sets the text. - * - * @param text the text to set - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/KnowledgeGraph.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/KnowledgeGraph.java deleted file mode 100755 index 12fd3843309..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/KnowledgeGraph.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -/** - * Entity returned by the AlchemyDataNews service. - * - */ -public class KnowledgeGraph extends AlchemyGenericModel { - - /** The type hierarchy. */ - private String typeHierarchy; - - /** - * Gets the type hierarchy. - * - * @return The typeHierarchy - */ - public String getTypeHierarchy() { - return typeHierarchy; - } - - /** - * Sets the type hierarchy. - * - * @param typeHierarchy The typeHierarchy - */ - public void setTypeHierarchy(String typeHierarchy) { - this.typeHierarchy = typeHierarchy; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Language.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Language.java deleted file mode 100644 index 8786b2b9259..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Language.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Language returned by the {@link AlchemyLanguage} service. - * - */ -public class Language extends AlchemyLanguageGenericModel { - - /** The ethnologue. */ - private String ethnologue; - - /** The iso6391. */ - @SerializedName("iso-639-1") - private String iso6391; - - /** The iso6392. */ - @SerializedName("iso-639-2") - private String iso6392; - - /** The iso6393. */ - @SerializedName("iso-639-3") - private String iso6393; - - /** The native speakers. */ - @SerializedName("native-speakers") - private String nativeSpeakers; - - /** The wikipedia. */ - private String wikipedia; - - /** - * Gets the ethnologue. - * - * @return The ethnologue - */ - public String getEthnologue() { - return ethnologue; - } - - /** - * Gets the iso6391. - * - * @return The iso6391 - */ - public String getIso6391() { - return iso6391; - } - - /** - * Gets the iso6392. - * - * @return The iso6392 - */ - public String getIso6392() { - return iso6392; - } - - /** - * Gets the iso6393. - * - * @return The iso6393 - */ - public String getIso6393() { - return iso6393; - } - - /** - * Gets the native speakers. - * - * @return The nativeSpeakers - */ - public String getNativeSpeakers() { - return nativeSpeakers; - } - - /** - * Gets the wikipedia. - * - * @return The wikipedia - */ - public String getWikipedia() { - return wikipedia; - } - - /** - * Sets the ethnologue. - * - * @param ethnologue The ethnologue - */ - public void setEthnologue(String ethnologue) { - this.ethnologue = ethnologue; - } - - /** - * Sets the iso6391. - * - * @param iso6391 The iso-639-1 - */ - public void setIso6391(String iso6391) { - this.iso6391 = iso6391; - } - - /** - * Sets the iso6392. - * - * @param iso6392 The iso-639-2 - */ - public void setIso6392(String iso6392) { - this.iso6392 = iso6392; - } - - /** - * Sets the iso6393. - * - * @param iso6393 The iso-639-3 - */ - public void setIso6393(String iso6393) { - this.iso6393 = iso6393; - } - - /** - * Sets the native speakers. - * - * @param nativeSpeakers The native-speakers - */ - public void setNativeSpeakers(String nativeSpeakers) { - this.nativeSpeakers = nativeSpeakers; - } - - /** - * Sets the wikipedia. - * - * @param wikipedia The wikipedia - */ - public void setWikipedia(String wikipedia) { - this.wikipedia = wikipedia; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/LanguageSelection.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/LanguageSelection.java deleted file mode 100644 index 987a2d7b011..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/LanguageSelection.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Supported Language by the {@link AlchemyLanguage} service. - * - */ -public enum LanguageSelection { - - /** The detect. */ - DETECT, /** The english. */ - ENGLISH, /** The french. */ - FRENCH, /** The german. */ - GERMAN, /** The italian. */ - ITALIAN, /** The portuguese. */ - PORTUGUESE, /** The russian. */ - RUSSIAN, /** The spanish. */ - SPANISH, /** The swedish. */ - SWEDISH -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Microformat.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Microformat.java deleted file mode 100644 index fe62ce27f3a..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Microformat.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Microformat returned by the {@link AlchemyLanguage} service. - * - */ -public class Microformat extends GenericModel { - - /** The data. */ - private String data; - - /** The field. */ - private String field; - - /** - * Gets the data. - * - * @return the data - */ - public String getData() { - return data; - } - - /** - * Gets the field. - * - * @return the field - */ - public String getField() { - return field; - } - - /** - * Sets the data. - * - * @param data the data to set - */ - public void setData(String data) { - this.data = data; - } - - /** - * Sets the field. - * - * @param field the field to set - */ - public void setField(String field) { - this.field = field; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Microformats.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Microformats.java deleted file mode 100644 index d8f7f4dac63..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Microformats.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Microformats returned by the {@link AlchemyLanguage} service. - * - */ -public class Microformats extends AlchemyLanguageGenericModel { - - /** The microformats. */ - private List microformats; - - /** - * Gets the microformats. - * - * @return the microformats - */ - public List getMicroformats() { - return microformats; - } - - /** - * Sets the microformats. - * - * @param microformats the microformats to set - */ - public void setMicroformats(List microformats) { - this.microformats = microformats; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/PublicationDate.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/PublicationDate.java deleted file mode 100644 index 154d9342dea..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/PublicationDate.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.JsonAdapter; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.util.BooleanToStringTypeAdapter; - -/** - * PublicationDate returned by the {@link AlchemyLanguage} service. - * - */ -public class PublicationDate extends AlchemyLanguageGenericModel { - - /** The confident. */ - @JsonAdapter(BooleanToStringTypeAdapter.class) - private Boolean confident = true; - - /** The date. */ - private Date date; - - /** - * Gets the confident. - * - * @return the confident - */ - public Boolean getConfident() { - return confident; - } - - /** - * Gets the date. - * - * @return the date - */ - public Date getDate() { - return date; - } - - /** - * Sets the confident. - * - * @param confident the confident to set - */ - public void setConfident(Boolean confident) { - this.confident = confident; - } - - /** - * Sets the date. - * - * @param date the date to set - */ - public void setDate(Date date) { - this.date = date; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Quotation.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Quotation.java deleted file mode 100644 index 95793567619..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Quotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * The Class Quotation. - */ -public class Quotation extends GenericModel { - - /** The quotation. */ - private String quotation; - - /** - * Gets the quotation. - * - * @return the quotation - */ - public String getQuotation() { - return quotation; - } - - /** - * Sets the quotation. - * - * @param quotation the quotation to set - */ - public void setQuotation(String quotation) { - this.quotation = quotation; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/SAORelation.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/SAORelation.java deleted file mode 100644 index 408594e8a4e..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/SAORelation.java +++ /dev/null @@ -1,452 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Subject-Action-Object(SAO) relation returned by the AlchemyLanguage service. - * - */ -public class SAORelation extends GenericModel { - - /** - * The Class Action. - */ - public static class Action extends GenericModel { - - /** - * The Class Verb. - */ - public static class Verb extends GenericModel { - - /** The negated. */ - private Integer negated; - - /** The tense. */ - private String tense; - - /** The text. */ - private String text; - - /** - * Gets the negated. - * - * @return the negated - */ - public Integer getNegated() { - return negated; - } - - /** - * Gets the tense. - * - * @return The tense - */ - public String getTense() { - return tense; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Sets the negated. - * - * @param negated the negated to set - */ - public void setNegated(Integer negated) { - this.negated = negated; - } - - /** - * Sets the tense. - * - * @param tense The tense - */ - public void setTense(String tense) { - this.tense = tense; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - } - - /** The lemmatized. */ - private String lemmatized; - - /** The text. */ - private String text; - - /** The verb. */ - private Verb verb; - - /** - * Gets the lemmatized. - * - * @return The lemmatized - */ - public String getLemmatized() { - return lemmatized; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Gets the verb. - * - * @return The verb - */ - public Verb getVerb() { - return verb; - } - - /** - * Sets the lemmatized. - * - * @param lemmatized The lemmatized - */ - public void setLemmatized(String lemmatized) { - this.lemmatized = lemmatized; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - /** - * Sets the verb. - * - * @param verb The verb - */ - public void setVerb(Verb verb) { - this.verb = verb; - } - } - - /** - * The Class RelationObject. - */ - public static class RelationObject extends GenericModel { - - /** The entity. */ - private Entity entity; - - /** The keywords. */ - private List keywords; - - /** The sentiment. */ - private Sentiment sentiment; - - /** The sentiment. */ - private Sentiment sentimentFromSubject; - - /** The text. */ - private String text; - - /** - * Gets the entity. - * - * @return the entity - */ - public Entity getEntity() { - return entity; - } - - /** - * Gets the keywords. - * - * @return the keywords - */ - public List getKeywords() { - return keywords; - } - - /** - * Gets the sentiment. - * - * @return The sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the sentiment from subject. - * - * @return the sentimentFromSubject - */ - public Sentiment getSentimentFromSubject() { - return sentimentFromSubject; - } - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Sets the entity. - * - * @param entity the new entity - */ - public void setEntity(Entity entity) { - this.entity = entity; - } - - /** - * Sets the keywords. - * - * @param keywords the keywords to set - */ - public void setKeywords(List keywords) { - this.keywords = keywords; - } - - /** - * Sets the sentiment. - * - * @param sentiment The sentiment - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the sentiment from subject. - * - * @param sentimentFromSubject the sentimentFromSubject to set - */ - public void setSentimentFromSubject(Sentiment sentimentFromSubject) { - this.sentimentFromSubject = sentimentFromSubject; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - } - - /** - * The Subject relation. - */ - public static class Subject extends GenericModel { - - /** The entities. */ - private Entity entity; - - /** The keywords. */ - private List keywords; - - /** The sentiment. */ - private Sentiment sentiment; - - /** The text. */ - private String text; - - /** - * Gets the entity. - * - * @return the entity - */ - public Entity getEntity() { - return entity; - } - - /** - * Gets the keywords. - * - * @return the keywords - */ - public List getKeywords() { - return keywords; - } - - /** - * Gets the sentiment. - * - * @return the sentiment - */ - public Sentiment getSentiment() { - return sentiment; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the entity. - * - * @param entity the entity to set - */ - public void setEntity(Entity entity) { - this.entity = entity; - } - - /** - * Sets the keywords. - * - * @param keywords the keywords to set - */ - public void setKeywords(List keywords) { - this.keywords = keywords; - } - - /** - * Sets the sentiment. - * - * @param sentiment the sentiment to set - */ - public void setSentiment(Sentiment sentiment) { - this.sentiment = sentiment; - } - - /** - * Sets the text. - * - * @param text the text to set - */ - public void setText(String text) { - this.text = text; - } - - } - - /** The action. */ - private Action action; - - /** The object. */ - private RelationObject object; - - /** The sentence. */ - private String sentence; - - /** The subject. */ - private Subject subject; - - /** - * Gets the action. - * - * @return The action - */ - public Action getAction() { - return action; - } - - /** - * Gets the object. - * - * @return The object - */ - public RelationObject getObject() { - return object; - } - - /** - * Gets the sentence. - * - * @return The sentence - */ - public String getSentence() { - return sentence; - } - - /** - * Gets the subject. - * - * @return The subject - */ - public Subject getSubject() { - return subject; - } - - /** - * Sets the action. - * - * @param action The action - */ - public void setAction(Action action) { - this.action = action; - } - - /** - * Sets the object. - * - * @param object The object - */ - public void setObject(RelationObject object) { - this.object = object; - } - - /** - * Sets the sentence. - * - * @param sentence The sentence - */ - public void setSentence(String sentence) { - this.sentence = sentence; - } - - /** - * Sets the subject. - * - * @param subject The subject - */ - public void setSubject(Subject subject) { - this.subject = subject; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/SAORelations.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/SAORelations.java deleted file mode 100644 index b867bbee397..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/SAORelations.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Subject-Action-Object(SAO) relations returned by the {@link AlchemyLanguage} service. - * - */ -public class SAORelations extends AlchemyLanguageGenericModel { - - /** The relations. */ - private List relations; - - /** The text. */ - private String text; - - /** - * Gets the relations. - * - * @return The relations - */ - public List getRelations() { - return relations; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the relations. - * - * @param relations The relations - */ - public void setRelations(List relations) { - this.relations = relations; - } - - /** - * Sets the text. - * - * @param text the text to set - */ - public void setText(String text) { - this.text = text; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Sentiment.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Sentiment.java deleted file mode 100644 index bb43613daa1..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Sentiment.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Sentiment returned by the AlchemyLanguage service. - * - */ -public class Sentiment extends GenericModel { - - /** - * Sentiment type enumeration. - */ - public enum SentimentType { - - /** negative sentiment. */ - @SerializedName("negative") NEGATIVE, - - /** neutral sentiment. */ - @SerializedName("neutral") NEUTRAL, - - /** positive sentiment. */ - @SerializedName("positive") POSITIVE - } - - /** The mixed. */ - private String mixed; - - /** The score. */ - private Double score; - - /** The sentiment type. */ - private SentimentType type; - - /** - * Gets the mixed. - * - * @return the mixed - */ - public String getMixed() { - return mixed; - } - - /** - * Gets the score. - * - * @return the score - */ - public Double getScore() { - return score; - } - - /** - * Gets the type. - * - * @return The type - */ - public SentimentType getType() { - return type; - } - - /** - * Sets the mixed. - * - * @param mixed the mixed to set - */ - public void setMixed(String mixed) { - this.mixed = mixed; - } - - /** - * Sets the score. - * - * @param score the new score - */ - public void setScore(Double score) { - this.score = score; - } - - /** - * Sets the type. - * - * @param type The type - */ - public void setType(SentimentType type) { - this.type = type; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Source.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Source.java deleted file mode 100755 index e9d6e67a815..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Source.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyDataNews; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Source by the {@link AlchemyDataNews} service. - * - */ -public class Source extends GenericModel { - - /** The enriched. */ - private Url enriched; - - /** - * Gets the enriched. - * - * @return The enriched - */ - public Url getEnriched() { - return enriched; - } - - /** - * Sets the enriched. - * - * @param enriched The enriched - */ - public void setEnriched(Url enriched) { - this.enriched = enriched; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomies.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomies.java deleted file mode 100644 index ec52aa82f9c..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomies.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Taxonomies returned by the {@link AlchemyLanguage} service. - * - */ -public class Taxonomies extends AlchemyLanguageGenericModel { - - /** The taxonomy. */ - private List taxonomy; - - /** - * Gets the taxonomy. - * - * @return The taxonomy - */ - public List getTaxonomy() { - return taxonomy; - } - - /** - * Sets the taxonomy. - * - * @param taxonomy The taxonomy - */ - public void setTaxonomy(List taxonomy) { - this.taxonomy = taxonomy; - } -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomy.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomy.java deleted file mode 100644 index 981e50c0dc7..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomy.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.google.gson.annotations.JsonAdapter; -import com.ibm.watson.developer_cloud.service.model.GenericModel; -import com.ibm.watson.developer_cloud.util.BooleanToStringTypeAdapter; - -/** - * Taxonomy returned by the {@link AlchemyLanguage} service. - * - */ - -/** - * - */ -public class Taxonomy extends GenericModel { - - /** The confident. */ - @JsonAdapter(BooleanToStringTypeAdapter.class) - private Boolean confident = true; - - /** The label. */ - private String label; - - /** The score. */ - private Double score; - - /** - * Gets the confident. - * - * @return the confident - */ - public Boolean getConfident() { - return confident; - } - - /** - * Gets the label. - * - * @return The label - */ - public String getLabel() { - return label; - } - - /** - * Gets the score. - * - * @return The score - */ - public Double getScore() { - return score; - } - - /** - * Sets the confident. - * - * @param confident the confident to set - */ - public void setConfident(Boolean confident) { - this.confident = confident; - } - - /** - * Sets the label. - * - * @param label The label - */ - public void setLabel(String label) { - this.label = label; - } - - /** - * Sets the score. - * - * @param score The score - */ - public void setScore(Double score) { - this.score = score; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedArguments.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedArguments.java deleted file mode 100644 index 68c5494560c..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedArguments.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Argument of a typed relation. It includes the detected {@link TypedEntity}, text and part. - * - * @see AlchemyLanguage#getTypedRelations(java.util.Map) - */ -public class TypedArguments extends GenericModel { - - private String part; - private String text; - private List entities; - - /** - * Gets the entities. - * - * @return the entities - */ - public List getEntities() { - return entities; - } - - /** - * Sets the entities. - * - * @param entities the new entities - */ - public void setTypedEntities(List entities) { - this.entities = entities; - } - - /** - * Gets the part. - * - * @return the part - */ - public String getPart() { - return part; - } - - /** - * Sets the part. - * - * @param part the new part - */ - public void setPart(String part) { - this.part = part; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedEntity.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedEntity.java deleted file mode 100644 index f9860cfa26b..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedEntity.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Recognized entity from {@link AlchemyLanguage#getTypedRelations(java.util.Map)}. - */ -public class TypedEntity extends GenericModel { - - private String id; - private String text; - private String type; - - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } - - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } - - /** - * Gets the type. - * - * @return The type - */ - public String getType() { - return type; - } - - /** - * Sets the type. - * - * @param type The type - */ - public void setType(String type) { - this.type = type; - } - - /** - * Gets the id. - * - * @return The id - */ - public String getId() { - return id; - } - - /** - * Sets the id. - * - * @param id The id - */ - public void setId(String id) { - this.id = id; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelation.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelation.java deleted file mode 100644 index 4b76104bea6..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelation.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Typed relation between {@link TypedArguments}. - * - * @see AlchemyLanguage#getTypedRelations(java.util.Map) - */ -public class TypedRelation extends GenericModel { - - private String sentence; - private String type; - private Double score; - - private List arguments; - - /** - * Gets the type. - * - * @return The type - */ - public String getType() { - return type; - } - - /** - * Sets the type. - * - * @param type The type - */ - public void setType(String type) { - this.type = type; - } - - /** - * Gets the score. - * - * @return The score - */ - public Double getScore() { - return score; - } - - /** - * Sets the score. - * - * @param score The score - */ - public void setScore(Double score) { - this.score = score; - } - - /** - * Gets the sentence. - * - * @return the sentence - */ - public String getSentence() { - return sentence; - } - - /** - * Sets the sentence. - * - * @param sentence the new sentence - */ - public void setSentence(String sentence) { - this.sentence = sentence; - } - - /** - * Gets the arguments. - * - * @return the arguments - */ - public List getArguments() { - return arguments; - } - - /** - * Sets the arguments. - * - * @param arguments the new arguments - */ - public void setArguments(List arguments) { - this.arguments = arguments; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelations.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelations.java deleted file mode 100644 index d59ac4fedbe..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelations.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; - -/** - * Typed relation between {@link TypedEntity}. - * - * @see AlchemyLanguage#getTypedRelations(java.util.Map) - */ -public class TypedRelations extends AlchemyLanguageGenericModel { - - private String model; - - /** - * Gets the model. - * - * @return the model - */ - public String getModel() { - return model; - } - - /** - * Sets the model. - * - * @param model the new model - */ - public void setModel(String model) { - this.model = model; - } - - /** The typedRelations. */ - private List typedRelations; - - /** - * Gets the typed relations. - * - * @return the typed relations - */ - public List getTypedRelations() { - return typedRelations; - } - - /** - * Sets the typed relations. - * - * @param typedRelations the new typed relations - */ - public void setTypedRelations(List typedRelations) { - this.typedRelations = typedRelations; - } - - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Url.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Url.java deleted file mode 100755 index 2e5fc476d27..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Url.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyDataNews; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Enriched returned by the {@link AlchemyDataNews} service. - * - */ -public class Url extends GenericModel { - - /** The article. */ - @SerializedName("url") - private Article article; - - /** - * Gets the article. - * - * @return the article - */ - public Article getArticle() { - return article; - } - - /** - * Sets the article. - * - * @param article the article to set - */ - public void setArticle(Article article) { - this.article = article; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/VolumeResult.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/VolumeResult.java deleted file mode 100755 index 41f6a0ea131..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/VolumeResult.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyDataNews; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * VolumeResult by the {@link AlchemyDataNews#getVolume(String, String, String)} service. - * - */ -public class VolumeResult extends AlchemyGenericModel { - - /** - * The Class Volume. - */ - public static class Volume extends GenericModel { - - /** The count. */ - private Integer count; - - /** The slices. */ - private List slices; - - - /** - * Gets the count. - * - * @return The count - */ - public int getCount() { - return count; - } - - /** - * Gets the slices. - * - * @return The slices - */ - public List getSlices() { - return slices; - } - - /** - * Sets the count. - * - * @param count The count - */ - public void setCount(int count) { - this.count = count; - } - - /** - * Sets the slices. - * - * @param slices The slices - */ - public void setSlices(List slices) { - this.slices = slices; - } - - } - - /** The volume. */ - @SerializedName("result") - private Volume volume; - - /** - * Gets the volume. - * - * @return the volume - */ - public Volume getVolume() { - return volume; - } - - /** - * Sets the volume. - * - * @param volume the volume to set - */ - public void setVolume(Volume volume) { - this.volume = volume; - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/package-info.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/package-info.java deleted file mode 100644 index d97c413ee0e..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -/** - * Provides access to the Alchemy Language, Vision and DataNews services. - */ -package com.ibm.watson.developer_cloud.alchemy.v1; - diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/util/AlchemyEndPoints.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/util/AlchemyEndPoints.java deleted file mode 100644 index 548cf534bef..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/util/AlchemyEndPoints.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.developer_cloud.alchemy.v1.util; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonParser; - -/** - * The Class AlchemyEndPoints. - * - */ -public final class AlchemyEndPoints { - - /** - * The AlchemyOperations. - */ - public enum AlchemyAPI { - - /** The authors. */ - AUTHORS, - - /** The combined. */ - COMBINED, - - /** The concepts. */ - CONCEPTS, - - /** dates. */ - DATES, - - /** emotion. */ - EMOTION, - - /** The entities. */ - ENTITIES, - - /** The feeds. */ - FEEDS, - - /** The image_keywords. */ - IMAGE_KEYWORDS, - - /** The image_link. */ - IMAGE_LINK, - - /** The image_recognition. */ - IMAGE_RECOGNITION, - - /** The image_scene_text. */ - IMAGE_SCENE_TEXT, - - /** The keywords. */ - KEYWORDS, - - /** The language. */ - LANGUAGE, - - /** The microformats. */ - MICROFORMATS, - - /** The publication date. */ - PUBLICATION_DATE, - - /** The relations. */ - RELATIONS, - - /** The sentiment. */ - SENTIMENT, - - /** The sentiment_targeted. */ - SENTIMENT_TARGETED, - - /** The taxonomy. */ - TAXONOMY, - - /** The text. */ - TEXT, - - /** The text_raw. */ - TEXT_RAW, - - /** The title. */ - TITLE, - - /** The typed. */ - TYPED - } - - private static final String FILE_PATH = "/alchemy_endpoints.json"; - private static final Logger LOG = Logger.getLogger(AlchemyEndPoints.class.getName()); - private static Map> operationsByEndpoint; - - static { - loadEndPointsFromJsonFile(); - } - - private AlchemyEndPoints() { - // This is a utility class - no instantiation allowed. - } - - /** - * Load the endpoints from json file. - */ - private static void loadEndPointsFromJsonFile() { - LOG.log(Level.FINE, "Parsing End Points JSON file "); - operationsByEndpoint = new HashMap>(); - final JsonParser parser = new JsonParser(); - - Reader fileReader = null; - try { - final InputStream is = AlchemyEndPoints.class.getResourceAsStream(FILE_PATH); - if (null != is) { - fileReader = new InputStreamReader(is); - } - final Object obj = parser.parse(fileReader); - final JsonObject jsonObject = (JsonObject) obj; - for (final AlchemyAPI object : AlchemyAPI.values()) { - if (jsonObject.get(object.name()) == null) { - continue; - } - final JsonElement elt = jsonObject.get(object.name()).getAsJsonObject(); - if (elt.isJsonObject()) { - final Map records = new HashMap(); - for (final Map.Entry e : elt.getAsJsonObject().entrySet()) { - records.put(e.getKey(), e.getValue().getAsString()); - } - operationsByEndpoint.put(object.name(), records); - } - } - } catch (final JsonParseException e) { - LOG.log(Level.SEVERE, "Could not parse json file: " + FILE_PATH, e); - } catch (final NullPointerException e) { - LOG.log(Level.SEVERE, "Not able to locate the end points json file: " + FILE_PATH, e); - } finally { - if (fileReader != null) { - try { - fileReader.close(); - } catch (final IOException e) { - LOG.log(Level.SEVERE, "Could not close file reader: " + FILE_PATH, e); - } - } - } - } - - /** - * Gets the path based on the operation and input type. - * - * @param operation the operation - * @param inputType the input type - * @return the string that represent the path based on the operation and input type - */ - public static String getPath(AlchemyAPI operation, String inputType) { - if ((operationsByEndpoint.get(operation.name()) != null) - && (operationsByEndpoint.get(operation.name()).get(inputType) != null)) { - return operationsByEndpoint.get(operation.name()).get(inputType); - } else { - final String error = "Operation: " + operation + ", inputType: " + inputType + " not found"; - LOG.log(Level.SEVERE, error); - throw new IllegalArgumentException(error); - } - } - -} diff --git a/alchemy/src/main/java/com/ibm/watson/developer_cloud/service/AlchemyService.java b/alchemy/src/main/java/com/ibm/watson/developer_cloud/service/AlchemyService.java deleted file mode 100644 index 5b85a686c86..00000000000 --- a/alchemy/src/main/java/com/ibm/watson/developer_cloud/service/AlchemyService.java +++ /dev/null @@ -1,218 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.service; - -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.google.gson.JsonObject; -import com.ibm.watson.developer_cloud.http.HttpStatus; -import com.ibm.watson.developer_cloud.http.ResponseConverter; -import com.ibm.watson.developer_cloud.service.exception.BadRequestException; -import com.ibm.watson.developer_cloud.service.exception.ServiceResponseException; -import com.ibm.watson.developer_cloud.service.exception.TooManyRequestsException; -import com.ibm.watson.developer_cloud.service.exception.UnauthorizedException; -import com.ibm.watson.developer_cloud.util.RequestUtils; -import com.ibm.watson.developer_cloud.util.ResponseUtils; - -import okhttp3.HttpUrl; -import okhttp3.Request.Builder; -import okhttp3.Response; - -/** - * Abstract class which has functionality for the different Alchemy services. - */ -public abstract class AlchemyService extends WatsonService { - private static final String SERVICE_NAME = "alchemy_api"; - private static final String DAILY_TRANSACTION_LIMIT_EXCEEDED = "daily-transaction-limit-exceeded"; - private static final String INVALID_API_KEY = "invalid-api-key"; - private static final String PARAM_APIKEY = "apikey"; - private static final String STATUS_ERROR = "ERROR"; - private static final String X_ALCHEMY_API_ERROR_MSG = "X-AlchemyAPI-Error-Msg"; - private static final String X_ALCHEMY_API_STATUS = "X-AlchemyAPI-Status"; - private static final Logger LOG = Logger.getLogger(AlchemyService.class.getName()); - - /** The Constant ENDPOINT. */ - protected static final String ENDPOINT = "https://gateway-a.watsonplatform.net/calls"; - - /** The Constant JSONP. */ - protected static final String JSONP = "jsonp"; - - /** The Constant OUTPUT_MODE. */ - protected static final String OUTPUT_MODE = "outputMode"; - - /** - * Instantiates a new alchemy service. - */ - public AlchemyService() { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(ENDPOINT); - } - } - - /** - * Instantiates a new alchemy service by apiKey. - * - * @param apiKey The API key - */ - public AlchemyService(String apiKey) { - this(); - setApiKey(apiKey); - } - - /** - * Adds the Alchemy API key to HTTP request. - * - * @param builder the builder - * @param apiKey the API key token - */ - private void addApiKeyToRequest(Builder builder, String apiKey) { - final HttpUrl url = HttpUrl.parse(builder.build().url().toString()); - if ((url.query() == null) || url.query().isEmpty()) { - builder.url(builder.build().url() + "?" + apiKey); - } else { - builder.url(builder.build().url() + "&" + apiKey); - } - } - - /** - * Detect the error code based on the error message. - * - * @param errorMessage the error message - * @return the int - */ - private int detectErrorCode(String errorMessage) { - final String error = errorMessage != null ? errorMessage : null; - if (error == null) { - return 400; - } - if (error.equals(DAILY_TRANSACTION_LIMIT_EXCEEDED)) { - return 429; - } else if (error.equals(INVALID_API_KEY)) { - return 401; - } else { - return 400; - } - } - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developer_cloud.service.WatsonService#processServiceCall(com.ibm.watson. - * watson.developer_cloud.service.ResponseConverter, okhttp3.Response) - */ - @Override - protected T processServiceCall(ResponseConverter converter, Response response) { - final JsonObject error = getErrorMessage(response); - - if (response.isSuccessful() && (error == null)) { - return converter.convert(response); - } - - // There was a Client Error 4xx or a Server Error 5xx - // Get the error message and create the exception - final String errorMessage; - final int code; - if (error != null) { - errorMessage = error.get(MESSAGE_ERROR).getAsString(); - code = error.get(MESSAGE_CODE).getAsInt(); - } else { - errorMessage = null; - code = -1; - } - - LOG.log(Level.SEVERE, response.request().method() + " " + response.request().url().toString() + ", API status: " - + response.code() + ", error: " + errorMessage); - - switch (code) { - case HttpStatus.BAD_REQUEST: // HTTP 400 - throw new BadRequestException(errorMessage, response); - case HttpStatus.UNAUTHORIZED: // HTTP 401 - throw new UnauthorizedException("Unauthorized: Access is denied due to invalid credentials", response); - case HttpStatus.TOO_MANY_REQUESTS: // HTTP 429 - throw new TooManyRequestsException(errorMessage, response); - default: // other errors - throw new ServiceResponseException(code, errorMessage, response); - } - } - - - /** - * Gets the error message from the {@link Response} by looking at the headers returned by the Alchemy service - * X-AlchemyAPI-Status and X-AlchemyAPI-Error-Msg - * - *
-   * {
-   *   code: 400
-   *   error: 'bad request'
-   * }
-   * 
- * - * . - * - * @param response the HTTP response - * @return the error message from the json object, or null if none found - */ - private JsonObject getErrorMessage(Response response) { - - final String status = response.header(X_ALCHEMY_API_STATUS); - final String errorMessage = response.header(X_ALCHEMY_API_ERROR_MSG); - - if (STATUS_ERROR.equals(status)) { - final int code = detectErrorCode(errorMessage); - final JsonObject error = new JsonObject(); - error.addProperty(MESSAGE_ERROR, errorMessage != null ? errorMessage : "Unknown error"); - error.addProperty(MESSAGE_CODE, code); - - // #242: Close the request body to prevent a connection leak - ResponseUtils.getString(response); - - return error; - } - return null; // no error - } - - /** - * Returns the first non-null accepted format from the parameter map. - * - * @param params the request parameters - * @param acceptedFormats the accepted formats - * @return the first accepted format found in the map - */ - protected String getInputFormat(Map params, String... acceptedFormats) { - int i = 0; - while ((i < acceptedFormats.length) && (params != null) && !params.containsKey(acceptedFormats[i])) { - i++; - } - - if ((params == null) || (i == acceptedFormats.length)) { - throw new IllegalArgumentException(RequestUtils.join(acceptedFormats, ",") + " should be specified"); - } - return acceptedFormats[i]; - } - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developer_cloud.service.WatsonService#setAuthentication(okhttp3.Request. Builder) - */ - @Override - protected void setAuthentication(Builder builder) { - if (getApiKey() == null) { - throw new IllegalArgumentException("apiKey not specified"); - } - addApiKeyToRequest(builder, PARAM_APIKEY + "=" + getApiKey()); - } -} diff --git a/alchemy/src/main/resources/alchemy_endpoints.json b/alchemy/src/main/resources/alchemy_endpoints.json deleted file mode 100644 index aa3d4cef86a..00000000000 --- a/alchemy/src/main/resources/alchemy_endpoints.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "ENTITIES": { - "url": "/url/URLGetRankedNamedEntities", - "text": "/text/TextGetRankedNamedEntities", - "html": "/html/HTMLGetRankedNamedEntities" - }, - "KEYWORDS": { - "url": "/url/URLGetRankedKeywords", - "text": "/text/TextGetRankedKeywords", - "html": "/html/HTMLGetRankedKeywords" - }, - "DATES": { - "url": "/url/URLExtractDates", - "text": "/text/TextExtractDates", - "html": "/html/HTMLExtractDates" - }, - "CONCEPTS": { - "url": "/url/URLGetRankedConcepts", - "text": "/text/TextGetRankedConcepts", - "html": "/html/HTMLGetRankedConcepts" - }, - "SENTIMENT": { - "url": "/url/URLGetTextSentiment", - "text": "/text/TextGetTextSentiment", - "html": "/html/HTMLGetTextSentiment" - }, - "EMOTION": { - "url": "/url/URLGetEmotion", - "text": "/text/TextGetEmotion", - "html": "/html/HTMLGetEmotion" - }, - "SENTIMENT_TARGETED": { - "url": "/url/URLGetTargetedSentiment", - "text": "/text/TextGetTargetedSentiment", - "html": "/html/HTMLGetTargetedSentiment" - }, - "RELATIONS": { - "url": "/url/URLGetRelations", - "text": "/text/TextGetRelations", - "html": "/html/HTMLGetRelations" - }, - "LANGUAGE": { - "url": "/url/URLGetLanguage", - "text": "/text/TextGetLanguage", - "html": "/html/HTMLGetLanguage" - }, - "TEXT": { - "url": "/url/URLGetText", - "html": "/html/HTMLGetText" - }, - "TEXT_RAW": { - "url": "/url/URLGetRawText", - "html": "/html/HTMLGetRawText" - }, - "AUTHORS": { - "url": "/url/URLGetAuthors", - "html": "/html/HTMLGetAuthors" - }, - "FEEDS": { - "url": "/url/URLGetFeedLinks", - "html": "/html/HTMLGetFeedLinks" - }, - "MICROFORMATS": { - "url": "/url/URLGetMicroformatData", - "html": "/html/HTMLGetMicroformatData" - }, - "TAXONOMY": { - "url": "/url/URLGetRankedTaxonomy", - "text": "/text/TextGetRankedTaxonomy", - "html": "/html/HTMLGetRankedTaxonomy" - }, - "COMBINED": { - "url": "/url/URLGetCombinedData", - "text": "/text/TextGetCombinedData", - "html": "/html/HTMLGetCombinedData" - }, - "PUBLICATION_DATE": { - "url": "/url/URLGetPubDate", - "html": "/html/HTMLGetPubDate" - }, - "IMAGE_LINK": { - "url": "/url/URLGetImage", - "html": "/html/HTMLGetImage" - }, - "IMAGE_KEYWORDS": { - "url": "/url/URLGetRankedImageKeywords", - "image": "/image/ImageGetRankedImageKeywords" - }, - "IMAGE_RECOGNITION": { - "url": "/url/URLGetRankedImageFaceTags", - "image": "/image/ImageGetRankedImageFaceTags" - }, - "IMAGE_SCENE_TEXT": { - "url": "/url/URLGetRankedImageSceneText", - "image": "/image/ImageGetRankedImageSceneText" - }, - "TITLE": { - "url": "/url/URLGetTitle", - "text": "/text/TextGetTitle", - "html": "/html/HTMLGetTitle" - }, - "TYPED": { - "url": "/url/URLGetTypedRelations", - "text": "/text/TextGetTypedRelations", - "html": "/html/HTMLGetTypedRelations" - } -} diff --git a/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyDataNewsIT.java b/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyDataNewsIT.java deleted file mode 100644 index b57efbea728..00000000000 --- a/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyDataNewsIT.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; - -import com.ibm.watson.developer_cloud.WatsonServiceTest; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentsResult; -import com.ibm.watson.developer_cloud.alchemy.v1.model.VolumeResult; - -/** - * The Class AlchemyDataNewsTest. - */ -public class AlchemyDataNewsIT extends WatsonServiceTest { - - private AlchemyDataNews service; - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp() - */ - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - String apiKey = getProperty("alchemy.alchemy"); - Assume.assumeFalse("config.properties doesn't have valid credentials.", - (apiKey == null) || apiKey.equals("API_KEY")); - - service = new AlchemyDataNews(); - service.setApiKey(apiKey); - service.setDefaultHeaders(getDefaultHeaders()); - } - - /** - * Test Get testGetCount. - */ - @Test - public void testGetCount() { - final VolumeResult result = service.getVolume("now-30", "now", null).execute(); - Assert.assertNotNull(result); - } - - /** - * Test Get test Count Time Slice. - */ - @Test - public void testGetCountTimeSlice() { - final VolumeResult result = service.getVolume("now-7d", "now", "12h").execute(); - Assert.assertNotNull(result); - } - - /** - * Test Get News. - */ - @Test - public void testNews() { - final Map params = new HashMap(); - - final String[] fields = - new String[] { "enriched.url.title", "enriched.url.url", "enriched.url.author", "enriched.url.publicationDate", - "enriched.url.enrichedTitle.entities", "enriched.url.enrichedTitle.docSentiment", - "enriched.url.enrichedTitle.concepts", "enriched.url.enrichedTitle.taxonomy", "enriched.url.entities", - "enriched.url.docSentiment", "enriched.url.concepts", "enriched.url.taxonomy" }; - params.put(AlchemyDataNews.RETURN, StringUtils.join(fields, ",")); - params.put(AlchemyDataNews.START, "now-30d"); - params.put(AlchemyDataNews.END, "now"); - params.put(AlchemyDataNews.COUNT, "7"); - params.put("q.enriched.url.enrichedTitle.entities.entity", "|text=IBM,type=company|"); - params.put("q.enriched.url.enrichedTitle.docSentiment.type", "positive"); - params.put("q.enriched.url.enrichedTitle.taxonomy.taxonomy_.label", "technology and computing"); - - final DocumentsResult result = service.getNewsDocuments(params).execute(); - Assert.assertNotNull(result); - Assert.assertNotNull(result.getDocuments()); - Assert.assertNotNull(result.getDocuments().getDocuments()); - } - - - /** - * Test json deserializer. - * - * @throws IOException Signals that an I/O exception has occurred. - */ - @Test - public void testJsonDeserializer() throws IOException { - DocumentsResult result = loadFixture("src/test/resources/alchemy/get_news.json", DocumentsResult.class); - Assert.assertNotNull(result); - - File temp = File.createTempFile("it-test", ".tmp"); - writeInputStreamToFile(new ByteArrayInputStream(result.toString().getBytes("UTF-8")), temp); - DocumentsResult loadedResult = loadFixture(temp.getAbsolutePath(), DocumentsResult.class); - Assert.assertNotNull(loadedResult); - } - -} diff --git a/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguageIT.java b/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguageIT.java deleted file mode 100755 index 1f17ecdbb22..00000000000 --- a/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguageIT.java +++ /dev/null @@ -1,533 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1; - -import java.io.FileInputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import com.ibm.watson.developer_cloud.WatsonServiceTest; -import com.ibm.watson.developer_cloud.alchemy.v1.model.CombinedResults; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Concepts; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Dates; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentAuthors; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentEmotion; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentPublicationDate; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentSentiment; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentText; -import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentTitle; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Entities; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Feeds; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Keywords; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Language; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Microformats; -import com.ibm.watson.developer_cloud.alchemy.v1.model.SAORelations; -import com.ibm.watson.developer_cloud.alchemy.v1.model.Taxonomies; -import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedArguments; -import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedEntity; -import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedRelation; -import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedRelations; -import com.ibm.watson.developer_cloud.util.RetryRunner; - -/** - * Alchemy Language Integration tests. - */ -@RunWith(RetryRunner.class) -public class AlchemyLanguageIT extends WatsonServiceTest { - - private static final String testURL = - "http://techcrunch.com/2012/03/01/" + "keen-on-anand-rajaraman-how-walmart-wants-to-leapfrog-over-amazon-tctv/"; - private String htmlExample; - private AlchemyLanguage service; - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp() - */ - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - - String apiKey = getProperty("alchemy.alchemy"); - Assume.assumeFalse("config.properties doesn't have valid credentials.", - (apiKey == null) || apiKey.equals("API_KEY")); - - service = new AlchemyLanguage(); - service.setApiKey(apiKey); - service.setDefaultHeaders(getDefaultHeaders()); - htmlExample = getStringFromInputStream(new FileInputStream("src/test/resources/alchemy/example.html")); - - } - - /** - * Test api key is null. - */ - @Test(expected = IllegalArgumentException.class) - public void testApiKeyIsNull() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - - final AlchemyLanguage language = new AlchemyLanguage(); - language.setApiKey(null); - language.getKeywords(params).execute(); - } - - /** - * Test combined. - */ - @Test - public void testCombined() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - params.put("showSourceText", "1"); - final CombinedResults combined = service.getCombinedResults(params).execute(); - Assert.assertNotNull(combined); - Assert.assertNotNull(combined.getText()); - } - - /** - * Test Get testFeeds. - */ - @Test - public void testFeeds() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final Feeds feeds = service.getFeeds(params).execute(); - Assert.assertNotNull(feeds); - } - - /** - * Test Get testGetAuthor. - */ - @Test - public void testGetAuthors() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, - "http://www.politico.com/blogs/media/2012/02/detroit-news-ed-upset-over-romney-edit-115247.html"); - final DocumentAuthors authors = service.getAuthors(params).execute(); - Assert.assertNotNull(authors); - } - - /** - * Test get concepts HTML. - */ - @Test - public void testGetConceptsHTML() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - final Concepts concepts = service.getConcepts(params).execute(); - Assert.assertNotNull(concepts); - Assert.assertFalse(concepts.getConcepts().isEmpty()); - } - - /** - * Test get concepts Tet. - */ - @Test - public void testGetConceptsText() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.TEXT, htmlExample); - final Concepts concepts = service.getConcepts(params).execute(); - Assert.assertNotNull(concepts); - Assert.assertFalse(concepts.getConcepts().isEmpty()); - } - - /** - * Test Get getTaxonomy URL. - */ - @Test - public void testGetConceptsUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final Concepts concepts = service.getConcepts(params).execute(); - Assert.assertNotNull(concepts); - Assert.assertFalse(concepts.getConcepts().isEmpty()); - } - - /** - * Test Get entities HTML. - */ - @Test - public void testGetEntitiesHtml() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - - final Entities entities = service.getEntities(params).execute(); - Assert.assertNotNull(entities); - Assert.assertFalse(entities.getEntities().isEmpty()); - } - - /** - * Test Get entities URL. - */ - @Test - public void testGetEntitiesUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final Entities entities = service.getEntities(params).execute(); - Assert.assertNotNull(entities); - Assert.assertFalse(entities.getEntities().isEmpty()); - } - - /** - * Test Get entities HTML. - */ - @Test - public void testGetEntitiesWithDifferentCharacters() { - final Map params = new HashMap(); - final String text = "Mr. Vice President, my old colleague from Massachusetts" - + "and your new Speaker & John McCormack, Members of the 87th Congress, " - + "ladies and gentlemen: -.*&^%$#@!@#$%^&*()"; - params.put(AlchemyLanguage.TEXT, text); - - final Entities entities = service.getEntities(params).execute(); - Assert.assertNotNull(entities); - Assert.assertFalse(entities.getEntities().isEmpty()); - } - - /** - * Test Get testGetLanguage. - */ - @Test - public void testGetLanguage() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://news.google.fr/"); - final Language language = service.getLanguage(params).execute(); - Assert.assertNotNull(language); - } - - /** - * Test get publication date html. - */ - @Test - public void testGetPublicationDateHTML() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - final DocumentPublicationDate date = service.getPublicationDate(params).execute(); - Assert.assertNotNull(date); - Assert.assertNotNull(date.getPublicationDate()); - } - - /** - * Test get publication date url. - */ - @Test - public void testGetPublicationDateURL() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final DocumentPublicationDate date = service.getPublicationDate(params).execute(); - Assert.assertNotNull(date); - Assert.assertNotNull(date.getPublicationDate()); - } - - /** - * Test Get testGetRelationsHtml HTML. - * - */ - @Test - public void testGetRelationsHtml() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - final SAORelations relations = service.getRelations(params).execute(); - Assert.assertNotNull(relations); - } - - /** - * Test Get testGetRelationsUrl URL. - */ - @Test - public void testGetRelationsUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final SAORelations relations = service.getRelations(params).execute(); - Assert.assertNotNull(relations); - } - - /** - * Test Get testGetTargetedSentiment HTML. - */ - @Test - public void testGetTargetedSentimentHtml() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - params.put(AlchemyLanguage.TARGET, "Watson"); - final DocumentSentiment documentSentiment = service.getSentiment(params).execute(); - Assert.assertNotNull(documentSentiment); - } - - /** - * Test Get testGetTargetedSentiment Url. - */ - @Test - public void testGetTargetedSentimentURL() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, testURL); - params.put(AlchemyLanguage.TARGET, "Walmart"); - final DocumentSentiment documentSentiment = service.getSentiment(params).execute(); - Assert.assertNotNull(documentSentiment); - } - - /** - * Test Get testGetTargetedSentiment Url and multiple targets. - */ - @Test - public void testGetTargetedSentimentURLAndTargets() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, testURL); - params.put(AlchemyLanguage.TARGETS, "Walmart|Walmart"); - final DocumentSentiment documentSentiment = service.getSentiment(params).execute(); - Assert.assertNotNull(documentSentiment); - } - - /** - * Test Get getTaxonomy HTML. - * - * @throws IOException Signals that an I/O exception has occurred. - */ - @Test - public void testGetTaxonomyHtml() throws IOException { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - final Taxonomies taxonomy = service.getTaxonomy(params).execute(); - Assert.assertNotNull(taxonomy); - Assert.assertFalse(taxonomy.getTaxonomy().isEmpty()); - } - - /** - * Test Get getTaxonomy URL. - */ - @Test - public void testGetTaxonomyUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final Taxonomies taxonomy = service.getTaxonomy(params).execute(); - Assert.assertNotNull(taxonomy); - Assert.assertFalse(taxonomy.getTaxonomy().isEmpty()); - } - - /** - * Test Get testGetTextSentiment HTML. - */ - @Test - public void testGetTextSentimentHtml() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - final DocumentSentiment documentSentiment = service.getSentiment(params).execute(); - Assert.assertNotNull(documentSentiment); - } - - /** - * Test Get testGetTextSentiment URL. - */ - @Test - public void testGetTextSentimentUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final DocumentSentiment documentSentiment = service.getSentiment(params).execute(); - Assert.assertNotNull(documentSentiment); - } - - /** - * Test Get testGetTitle. - */ - @Test - public void testGetTitle() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final DocumentTitle title = service.getTitle(params).execute(); - Assert.assertNotNull(title); - } - - /** - * Test Get keywords HTML. - * - */ - @Test - public void testGetWordsHtml() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - - final Keywords keywords = service.getKeywords(params).execute(); - Assert.assertNotNull(keywords); - Assert.assertFalse(keywords.getKeywords().isEmpty()); - } - - /** - * Test Get keywords URL. - */ - @Test - public void testGetWordsUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final Keywords keywords = service.getKeywords(params).execute(); - Assert.assertNotNull(keywords); - Assert.assertFalse(keywords.getKeywords().isEmpty()); - } - - /** - * Test microformats. - */ - @Test - public void testMicroformats() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://microformats.org/wiki/hcard"); - final Microformats microformats = service.getMicroformats(params).execute(); - Assert.assertNotNull(microformats); - } - - /** - * Test Get testGetRawText. - * - * @throws Exception the exception - */ - @Test - @Ignore - public void testRawText() throws Exception { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.test.com/"); - params.put(AlchemyLanguage.RAW, true); - final DocumentText text = service.getText(params).execute(); - Assert.assertNotNull(text); - throw new Exception(); - } - - /** - * Test Get testGetText. - */ - @Test - public void testText() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final DocumentText text = service.getText(params).execute(); - Assert.assertNotNull(text); - } - - /** - * Test get dates from a url. - */ - @Test - public void testGetDates() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.TEXT, "Let's meet on January 4th, 2004"); - params.put(AlchemyLanguage.ANCHOR_DATE, "2013-12-16 20:06:18"); - - final Dates dates = service.getDates(params).execute(); - Assert.assertNotNull(dates); - Assert.assertNotNull(dates.getDates()); - Assert.assertFalse(dates.getDates().isEmpty()); - } - - /** - * Test get emotion from HTML. - */ - @Test - public void testGetEmotionHTML() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - final DocumentEmotion emotion = service.getEmotion(params).execute(); - Assert.assertNotNull(emotion); - Assert.assertNotNull(emotion.getEmotion()); - } - - /** - * Test get emotion from text. - */ - @Test - public void testGetEmotionText() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.TEXT, htmlExample); - final DocumentEmotion emotion = service.getEmotion(params).execute(); - Assert.assertNotNull(emotion); - Assert.assertNotNull(emotion.getEmotion()); - } - - /** - * Test Get emotion from URL. - */ - @Test - public void testGetEmotionUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final DocumentEmotion emotion = service.getEmotion(params).execute(); - Assert.assertNotNull(emotion); - Assert.assertNotNull(emotion.getEmotion()); - } - - /** - * Test get typed relations from HTML. - */ - @Test - @Ignore - public void testGetTypedRelationsHTML() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.HTML, htmlExample); - final TypedRelations typedRelations = service.getTypedRelations(params).execute(); - Assert.assertNotNull(typedRelations); - Assert.assertNotNull(typedRelations.getTypedRelations()); - } - - /** - * Test get typed relations from text. - */ - @Test - public void testGetTypedRelationsText() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.TEXT, "Leiming Qian lives in New York."); - params.put(AlchemyLanguage.MODEL_ID, "ie-en-news"); - final TypedRelations typedRelations = service.getTypedRelations(params).execute(); - Assert.assertNotNull(typedRelations); - List relations = typedRelations.getTypedRelations(); - Assert.assertNotNull(relations); - Assert.assertFalse(relations.isEmpty()); - for (TypedRelation relation : relations) { - Assert.assertNotNull(relation.getType()); - Assert.assertNotNull(relation.getSentence()); - Assert.assertNotNull(relation.getArguments()); - Assert.assertFalse(relation.getArguments().isEmpty()); - for (TypedArguments arg : relation.getArguments()) { - Assert.assertNotNull(arg.getPart()); - Assert.assertNotNull(arg.getText()); - Assert.assertNotNull(arg.getEntities()); - for (TypedEntity e : arg.getEntities()) { - Assert.assertNotNull(e.getId()); - Assert.assertNotNull(e.getText()); - Assert.assertNotNull(e.getType()); - } - } - } - } - - /** - * Test Get typed relations from URL. - */ - @Test - @Ignore - public void testGetTypedRelationsUrl() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.URL, "http://www.techcrunch.com/"); - final TypedRelations typedRelations = service.getTypedRelations(params).execute(); - Assert.assertNotNull(typedRelations); - Assert.assertNotNull(typedRelations.getTypedRelations()); - } -} diff --git a/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVisionIT.java b/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVisionIT.java deleted file mode 100644 index 978bda29249..00000000000 --- a/alchemy/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVisionIT.java +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.alchemy.v1; - -import java.io.File; -import java.io.FileInputStream; - -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import com.ibm.watson.developer_cloud.WatsonServiceTest; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageFaces; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageKeyword; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageKeywords; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageLink; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageSceneText; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageSceneTextLine; -import com.ibm.watson.developer_cloud.alchemy.v1.model.ImageSceneTextLine.Word; -import com.ibm.watson.developer_cloud.util.RetryRunner; - -import okhttp3.HttpUrl; - -/** - * The Class AlchemyVisionTest. - */ -@RunWith(RetryRunner.class) -public class AlchemyVisionIT extends WatsonServiceTest { - - private static final String IMAGE_OBAMA = "src/test/resources/alchemy/obama.jpg"; - private static final String IMAGE_COLORADO = "src/test/resources/alchemy/colorado.jpg"; - private static final String IMAGE_COLORADO_URL = "https://raw.githubusercontent.com/watson-developer-cloud/" - + "doc-tutorial-downloads/master/visual-recognition/colorado.jpg"; - private static final String VR_IMAGE = "https://visual-recognition-demo.mybluemix.net/images/samples/3.jpg"; - - /** The html example. */ - private String htmlExample; - - /** The service. */ - private AlchemyVision service; - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp() - */ - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - - String apiKey = getProperty("alchemy.alchemy"); - Assume.assumeFalse("config.properties doesn't have valid credentials.", - (apiKey == null) || apiKey.equals("API_KEY")); - - service = new AlchemyVision(); - service.setApiKey(apiKey); - service.setDefaultHeaders(getDefaultHeaders()); - htmlExample = getStringFromInputStream(new FileInputStream("src/test/resources/alchemy/example.html")); - } - - /** - * Test get image from URL. - */ - @Test - public void testGetImageFromURL() { - final ImageLink image = service.getImageLink(HttpUrl.parse("http://www.techcrunch.com/").url()).execute(); - Assert.assertNotNull(image); - } - - /** - * Test get image with HTML. - */ - @Ignore - @Test - public void testGetImageWithHTML() { - final ImageLink image = service.getImageLink(htmlExample).execute(); - Assert.assertNotNull(image); - } - - /** - * Test get ranked image scene text from image. - */ - @Ignore - @Test(timeout = 180000) - public void testGetRankedImageSceneTextFromImage() { - final File imageFile = new File(IMAGE_COLORADO); - final ImageSceneText image = service.getImageSceneText(imageFile).execute(); - - Assert.assertEquals("colorado", image.getSceneText()); - Assert.assertEquals(1, image.getSceneTextLines().size()); - - ImageSceneTextLine first = image.getSceneTextLines().get(0); - Assert.assertEquals("colorado", first.getText()); - Assert.assertEquals(25, (int) first.getRegion().getHeight()); - Assert.assertEquals(104, (int) first.getRegion().getWidth()); - Assert.assertEquals(484, (int) first.getRegion().getX()); - Assert.assertEquals(215, (int) first.getRegion().getY()); - Assert.assertNotNull(first.getConfidence()); - Assert.assertNotNull(image); - - Assert.assertEquals(1, first.getWords().size()); - Word word = first.getWords().get(0); - Assert.assertEquals("colorado", word.getText()); - Assert.assertEquals(25, (int) word.getRegion().getHeight()); - Assert.assertEquals(104, (int) word.getRegion().getWidth()); - Assert.assertEquals(484, (int) word.getRegion().getX()); - Assert.assertEquals(215, (int) word.getRegion().getY()); - Assert.assertNotNull(word.getConfidence()); - } - - /** - * Test get ranked image scene text from URL. - */ - @Ignore - @Test - public void testGetRankedImageSceneTextFromURL() { - final ImageSceneText image = service.getImageSceneText(HttpUrl.parse(IMAGE_COLORADO_URL).url()).execute(); - - Assert.assertEquals("colorado", image.getSceneText()); - Assert.assertEquals(1, image.getSceneTextLines().size()); - Assert.assertNotNull(image); - } - - /** - * Test get ranked image keywords from image. - */ - @Ignore - @Test - public void testGetRankedImageKeywordsFromImage() { - final File imageFile = new File(IMAGE_OBAMA); - final ImageKeywords image = service.getImageKeywords(imageFile, null, null).execute(); - - Assert.assertNotNull(image); - } - - /** - * Test get ranked image keywords from image with knowledge graph data included. - */ - @Ignore - @Test - public void testGetRankedImageKeywordsFromImageWithKnowledgeGraph() { - final File imageFile = new File(IMAGE_OBAMA); - final ImageKeywords image = service.getImageKeywords(imageFile, null, true).execute(); - - Assert.assertNotNull(image); - if ((image.getImageKeywords() != null) && !image.getImageKeywords().isEmpty()) { - for (ImageKeyword keyword : image.getImageKeywords()) { - Assert.assertNotNull(keyword.getHierarchy()); - } - } - } - - /** - * Test get ranked image keywords from URL. - */ - @Ignore - @Test - public void testGetRankedImageKeywordsFromURL() { - final ImageKeywords image = service.getImageKeywords(HttpUrl.parse(VR_IMAGE).url(), true, true).execute(); - - Assert.assertNotNull(image); - } - - /** - * Test recognize faces from image. - */ - @Ignore - @Test - public void testRecognizeFacesFromImage() { - final File imageFile = new File(IMAGE_OBAMA); - final ImageFaces image = service.recognizeFaces(imageFile, true).execute(); - - Assert.assertNotNull(image); - } - - /** - * Test recognize faces from URL. - */ - @Ignore - @Test - public void testRecognizeFacesFromURL() { - final ImageFaces image = service.recognizeFaces(HttpUrl.parse(VR_IMAGE).url(), false).execute(); - - Assert.assertNotNull(image); - } -} diff --git a/alchemy/src/test/resources/alchemy/colorado.jpg b/alchemy/src/test/resources/alchemy/colorado.jpg deleted file mode 100644 index 1f877c06d04..00000000000 Binary files a/alchemy/src/test/resources/alchemy/colorado.jpg and /dev/null differ diff --git a/alchemy/src/test/resources/alchemy/example.html b/alchemy/src/test/resources/alchemy/example.html deleted file mode 100644 index c70a463cc09..00000000000 --- a/alchemy/src/test/resources/alchemy/example.html +++ /dev/null @@ -1,408 +0,0 @@ - - - -Personality Insights Service Documentation | Watson Developer Cloud - - - - - - - - - - - - - - - - - -IBM Watson Developer Cloud - - -