diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..30fdb7b9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,10 @@ +# Code owners file. +# This file controls who is tagged for review for any given pull request. + +# For syntax help see: +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax + +* @googleapis/yoshi-java + +# The java-samples-reviewers team is the default owner for samples changes +samples/**/*.java @googleapis/java-samples-reviewers diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..df5ef408 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +Please run down the following list and make sure you've tried the usual "quick fixes": + + - Search the issues already opened: https://github.com/googleapis/java-retail/issues + - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform + +If you are still having issues, please include as much information as possible: + +#### Environment details + +1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). + General, Core, and Other are also allowed as types +2. OS type and version: +3. Java version: +4. retail version(s): + +#### Steps to reproduce + + 1. ? + 2. ? + +#### Code example + +```java +// example +``` + +#### Stack trace +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides + +- ? + +#### Any additional information below + + +Following these steps guarantees the quickest resolution possible. + +Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..754e30c6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this library + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +**Is your feature request related to a problem? Please describe.** +What the problem is. Example: I'm always frustrated when [...] + +**Describe the solution you'd like** +What you want to happen. + +**Describe alternatives you've considered** +Any alternative solutions or features you've considered. + +**Additional context** +Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 00000000..99586903 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,7 @@ +--- +name: Support request +about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. + +--- + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..3c57d8ef --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-retail/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Ensure the tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) + +Fixes # ☕️ diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml new file mode 100644 index 00000000..1a23ea42 --- /dev/null +++ b/.github/blunderbuss.yml @@ -0,0 +1,7 @@ +# Configuration for the Blunderbuss GitHub app. For more info see +# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss +assign_prs_by: +- labels: + - samples + to: + - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml new file mode 100644 index 00000000..20f3acc2 --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,7 @@ +externalManifests: +- type: json + file: 'synth.metadata' + jsonpath: '$.generatedFiles[*]' +- type: json + file: '.github/readme/synth.metadata/synth.metadata' + jsonpath: '$.generatedFiles[*]' diff --git a/.github/readme/synth.py b/.github/readme/synth.py new file mode 100644 index 00000000..7b48cc28 --- /dev/null +++ b/.github/readme/synth.py @@ -0,0 +1,19 @@ +# Copyright 2020 Google LLC +# +# 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. + +"""This script is used to synthesize generated the README for this library.""" + +from synthtool.languages import java + +java.custom_templates(["java_library/README.md"]) diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 00000000..dce2c845 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,2 @@ +releaseType: java-yoshi +bumpMinorPreMajor: true \ No newline at end of file diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml new file mode 100644 index 00000000..f247d5c7 --- /dev/null +++ b/.github/trusted-contribution.yml @@ -0,0 +1,2 @@ +trustedContributors: +- renovate-bot \ No newline at end of file diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml new file mode 100644 index 00000000..7513acae --- /dev/null +++ b/.github/workflows/approve-readme.yaml @@ -0,0 +1,54 @@ +on: + pull_request: +name: auto-merge-readme +jobs: + approve: + runs-on: ubuntu-latest + if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + script: | + // only approve PRs from yoshi-automation + if (context.payload.pull_request.user.login !== "yoshi-automation") { + return; + } + + // only approve PRs like "chore: release " + if (!context.payload.pull_request.title === "chore: regenerate README") { + return; + } + + // only approve PRs with README.md and synth.metadata changes + const files = new Set( + ( + await github.paginate( + github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }) + ) + ).map(file => file.filename) + ); + if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { + return; + } + + // approve README regeneration PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped PR!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach automerge label + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['automerge'] + }); diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 00000000..2b6cdbc9 --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,88 @@ +on: + pull_request: +name: auto-release +jobs: + approve: + runs-on: ubuntu-latest + if: contains(github.head_ref, 'release-v') + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + debug: true + script: | + // only approve PRs from release-please[bot] + if (context.payload.pull_request.user.login !== "release-please[bot]") { + return; + } + + // only approve PRs like "chore: release " + if ( !context.payload.pull_request.title.startsWith("chore: release") ) { + return; + } + + // only approve PRs with pom.xml and versions.txt changes + const filesPromise = github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + const changed_files = await github.paginate(filesPromise) + + if ( changed_files.length < 1 ) { + console.log( "Not proceeding since PR is empty!" ) + return; + } + + if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { + console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) + return; + } + + // trigger auto-release when + // 1) it is a SNAPSHOT release (auto-generated post regular release) + // 2) there are dependency updates only + // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) + if ( + context.payload.pull_request.body.includes("Fix") || + context.payload.pull_request.body.includes("Build") || + context.payload.pull_request.body.includes("Documentation") || + context.payload.pull_request.body.includes("BREAKING CHANGES") || + context.payload.pull_request.body.includes("Features") + ) { + console.log( "Not auto-releasing since it is not a dependency-update-only release." ); + return; + } + + const promise = github.pulls.list.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + const open_pulls = await github.paginate(promise) + + if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { + for ( const pull of open_pulls ) { + if ( pull.title.startsWith("deps: update dependency") ) { + console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); + return; + } + } + } + + // approve release PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped release!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach kokoro:force-run and automerge labels + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['kokoro:force-run', 'automerge'] + }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..68302207 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,79 @@ +on: + push: + branches: + - master + pull_request: +name: ci +jobs: + units: + runs-on: ubuntu-latest + strategy: + matrix: + java: [7, 8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: test + - name: coverage + uses: codecov/codecov-action@v1 + with: + name: actions ${{matrix.java}} + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.bat + env: + JOB_TYPE: test + dependencies: + runs-on: ubuntu-latest + strategy: + matrix: + java: [8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/dependencies.sh + linkage-monitor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/linkage-monitor.sh + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: lint + clirr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: clirr \ No newline at end of file diff --git a/.github/workflows/formatting.yaml b/.github/workflows/formatting.yaml new file mode 100644 index 00000000..6844407b --- /dev/null +++ b/.github/workflows/formatting.yaml @@ -0,0 +1,25 @@ +on: + pull_request_target: + types: [opened, synchronize] + branches: + - master +name: format +jobs: + format-code: + runs-on: ubuntu-latest + env: + ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: "mvn com.coveo:fmt-maven-plugin:format" + - uses: googleapis/code-suggester@v1 + with: + command: review + pull_number: ${{ github.event.pull_request.number }} + git_dir: '.' diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml new file mode 100644 index 00000000..c46230a7 --- /dev/null +++ b/.github/workflows/samples.yaml @@ -0,0 +1,14 @@ +on: + pull_request: +name: samples +jobs: + checkstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Run checkstyle + run: mvn -P lint --quiet --batch-mode checkstyle:check + working-directory: samples/snippets diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..cc0bc34a --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ + +.flattened-pom.xml \ No newline at end of file diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 00000000..05826ad9 --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,3 @@ +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 00000000..bdd298dc --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,118 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# 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. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java version +java -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +RETURN_CODE=0 +set +e + +case ${JOB_TYPE} in +test) + mvn test -B -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; +lint) + mvn com.coveo:fmt-maven-plugin:check + RETURN_CODE=$? + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + RETURN_CODE=$? + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + ;; +samples) + SAMPLES_DIR=samples + # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. + if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] + then + SAMPLES_DIR=samples/snapshot + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + pushd ${SAMPLES_DIR} + mvn -B \ + -Penable-samples \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; +clirr) + mvn -B -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; +*) + ;; +esac + +if [ "${REPORT_COVERAGE}" == "true" ] +then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_BUILD_COP}" == "true" ]] +then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/buildcop + ${KOKORO_GFILE_DIR}/linux_amd64/buildcop -repo=googleapis/java-retail +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 00000000..5cf7ba49 --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# 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. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + echo "processing ${xml}" + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 00000000..b8a353e5 --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "java-retail/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/build.sh" +} diff --git a/.kokoro/common.sh b/.kokoro/common.sh new file mode 100644 index 00000000..ace89f45 --- /dev/null +++ b/.kokoro/common.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# 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. + +function retry_with_backoff { + attempts_left=$1 + sleep_seconds=$2 + shift 2 + command=$@ + + + # store current flag state + flags=$- + + # allow a failures to continue + set +e + ${command} + exit_code=$? + + # restore "e" flag + if [[ ${flags} =~ e ]] + then set -e + else set +e + fi + + if [[ $exit_code == 0 ]] + then + return 0 + fi + + # failure + if [[ ${attempts_left} > 0 ]] + then + echo "failure (${exit_code}), sleeping ${sleep_seconds}..." + sleep ${sleep_seconds} + new_attempts=$((${attempts_left} - 1)) + new_sleep=$((${sleep_seconds} * 2)) + retry_with_backoff ${new_attempts} ${new_sleep} ${command} + fi + + return $exit_code +} + +## Helper functionss +function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } +function msg() { println "$*" >&2; } +function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 00000000..407016a0 --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-retail/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 00000000..495cc7ba --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/continuous/readme.cfg b/.kokoro/continuous/readme.cfg new file mode 100644 index 00000000..a9747f49 --- /dev/null +++ b/.kokoro/continuous/readme.cfg @@ -0,0 +1,55 @@ +# Copyright 2020 Google LLC +# +# 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/readme.sh" +} + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.log" + } +} + +# The github token is stored here. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "yoshi-automation-github-key" + # TODO(theacodes): remove this after secrets have globally propagated + backend_type: FASTCONFIGPUSH + } + } +} + +# Common env vars for all repositories and builds. +env_vars: { + key: "GITHUB_USER" + value: "yoshi-automation" +} +env_vars: { + key: "GITHUB_EMAIL" + value: "yoshi-automation@google.com" +} diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 00000000..c91e5a56 --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# 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. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java +java -version +echo $JOB_TYPE + +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" + +# this should run maven enforcer +retry_with_backoff 3 10 \ + mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true + +mvn -B dependency:analyze -DfailOnWarning=true + +echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" +## Run dependency list completeness check +function completenessCheck() { + # Output dep list with compile scope generated using the original pom + # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. + # This is stripped from the output as it is not present in the flattened pom. + # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. + msg "Generating dependency list using original pom..." + mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e s/\\s--\\smodule.*// >.org-list.txt + + # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) + msg "Generating dependency list using flattened pom..." + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + + # Compare two dependency lists + msg "Comparing dependency lists..." + diff .org-list.txt .new-list.txt >.diff.txt + if [[ $? == 0 ]] + then + msg "Success. No diff!" + else + msg "Diff found. See below: " + msg "You can also check .diff.txt file located in $1." + cat .diff.txt + return 1 + fi +} + +# Allow failures to continue running the script +set +e + +error_count=0 +for path in $(find -name ".flattened-pom.xml") +do + # Check flattened pom in each dir that contains it for completeness + dir=$(dirname "$path") + pushd "$dir" + completenessCheck "$dir" + error_count=$(($error_count + $?)) + popd +done + +if [[ $error_count == 0 ]] +then + msg "All checks passed." + exit 0 +else + msg "Errors found. See log statements above." + exit 1 +fi \ No newline at end of file diff --git a/.kokoro/linkage-monitor.sh b/.kokoro/linkage-monitor.sh new file mode 100755 index 00000000..759ab4e2 --- /dev/null +++ b/.kokoro/linkage-monitor.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# 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. + +set -eo pipefail +# Display commands being run. +set -x + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java version +java -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true + +# Kokoro job cloud-opensource-java/ubuntu/linkage-monitor-gcs creates this JAR +JAR=linkage-monitor-latest-all-deps.jar +curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/${JAR}" + +# Fails if there's new linkage errors compared with baseline +java -jar ${JAR} com.google.cloud:libraries-bom diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 00000000..407016a0 --- /dev/null +++ b/.kokoro/nightly/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-retail/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 00000000..0048c8ec --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,37 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/nightly/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/nightly/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg new file mode 100644 index 00000000..f5895b3c --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-retail/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 00000000..ce72000d --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-retail/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 00000000..495cc7ba --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg new file mode 100644 index 00000000..f2542931 --- /dev/null +++ b/.kokoro/nightly/samples.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 00000000..f5251425 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2020 Google LLC. +# +# 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. + +set -eo pipefail + +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +function msg { println "$*" >&2 ;} +function println { printf '%s\n' "$(now) $*" ;} + + +# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: +# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" +mkdir -p ${SECRET_LOCATION} +for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") +do + msg "Retrieving secret ${key}" + docker run --entrypoint=gcloud \ + --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ + gcr.io/google.com/cloudsdktool/cloud-sdk \ + secrets versions access latest \ + --project cloud-devrel-kokoro-resources \ + --secret ${key} > \ + "${SECRET_LOCATION}/${key}" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi +done diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg new file mode 100644 index 00000000..ec572442 --- /dev/null +++ b/.kokoro/presubmit/clirr.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "clirr" +} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 00000000..1cd188d0 --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-retail/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg new file mode 100644 index 00000000..d9b61ace --- /dev/null +++ b/.kokoro/presubmit/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 00000000..dded67a9 --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/presubmit/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/presubmit/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg new file mode 100644 index 00000000..f5895b3c --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-retail/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 00000000..ce72000d --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-retail/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 00000000..495cc7ba --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 00000000..089e5b56 --- /dev/null +++ b/.kokoro/presubmit/linkage-monitor.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg new file mode 100644 index 00000000..01e09600 --- /dev/null +++ b/.kokoro/presubmit/samples.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh new file mode 100755 index 00000000..1180d8e1 --- /dev/null +++ b/.kokoro/readme.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# 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. + +set -eo pipefail + +cd ${KOKORO_ARTIFACTS_DIR}/github/java-retail + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Kokoro exposes this as a file, but the scripts expect just a plain variable. +export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) + +# Setup git credentials +echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials +git config --global credential.helper 'store --file ~/.git-credentials' + +python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool + +set +e +python3.6 -m autosynth.synth \ + --repository=googleapis/java-retail \ + --synth-file-name=.github/readme/synth.py \ + --metadata-path=.github/readme/synth.metadata \ + --pr-title="chore: regenerate README" \ + --branch-suffix="readme" + +# autosynth returns 28 to signal there are no changes +RETURN_CODE=$? +if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] +then + exit ${RETURN_CODE} +fi diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 00000000..89c6e490 --- /dev/null +++ b/.kokoro/release/bump_snapshot.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-retail/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/release/bump_snapshot.sh" +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 00000000..59b0e3ac --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-retail/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 00000000..6e3f6599 --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg new file mode 100644 index 00000000..deec4bd4 --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/release/drop.sh" +} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 00000000..5c4551ef --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 00000000..8d1f29d1 --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/release/promote.sh" +} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 00000000..1fa95fa5 --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 00000000..02b8306a --- /dev/null +++ b/.kokoro/release/publish_javadoc.cfg @@ -0,0 +1,29 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" + +env_vars: { + key: "STAGING_BUCKET" + value: "docs-staging" +} + +env_vars: { + key: "STAGING_BUCKET_V2" + value: "docs-staging-v2" + # Production will be at: docs-staging-v2 +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/release/publish_javadoc.sh" +} + + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh new file mode 100755 index 00000000..1a2416c5 --- /dev/null +++ b/.kokoro/release/publish_javadoc.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# Copyright 2019 Google Inc. +# +# 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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET}" ]]; then + echo "Need to set STAGING_BUCKET environment variable" + exit 1 +fi + +if [[ -z "${STAGING_BUCKET_V2}" ]]; then + echo "Need to set STAGING_BUCKET_V2 environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-cloud-retail +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# build the docs +mvn site -B -q + +pushd target/site/apidocs + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload docs +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET} + +popd + +# V2 due to problems w/ the released javadoc plugin doclava, Java 8 is required. Beware of accidental updates. + +mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/" + +pushd target/devsite/reference + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload docs +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET_V2} diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 00000000..4d7f084d --- /dev/null +++ b/.kokoro/release/snapshot.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/release/snapshot.sh" +} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh new file mode 100755 index 00000000..098168a7 --- /dev/null +++ b/.kokoro/release/snapshot.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# 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. + +set -eo pipefail + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +# ensure we're trying to push a snapshot (no-result returns non-zero exit code) +grep SNAPSHOT versions.txt + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean install deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 00000000..62260962 --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-retail/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-retail/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-retail" + } +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" +} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100755 index 00000000..16126d2e --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +source $(dirname "$0")/../common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +# attempt to stage 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn clean install deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} + +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml +fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 00000000..9da0f839 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT + +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 00000000..e52773a7 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,15 @@ +{ + "name": "retail", + "name_pretty": "Cloud Retail", + "product_documentation": "https://cloud.google.com/solutions/retail", + "api_description": "Retail solutions API.", + "client_documentation": "https://googleapis.dev/java/google-cloud-retail/latest/index.html", + "release_level": "beta", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-retail", + "repo_short": "java-retail", + "distribution_name": "com.google.cloud:google-cloud-retail", + "api_id": "retail.googleapis.com", + "requires_billing": true +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..2add2547 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..f2dbdee0 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,139 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Building the project + +To build, package, and run all unit tests run the command + +``` +mvn clean verify +``` + +### Running Integration tests + +To include integration tests when building the project, you need access to +a GCP Project with a valid service account. + +For instructions on how to generate a service account and corresponding +credentials JSON see: [Creating a Service Account][1]. + +Then run the following to build, package, run all unit tests and run all +integration tests. + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-integration-tests clean verify +``` + +## Code Samples + +Code Samples must be bundled in separate Maven modules, and guarded by a +Maven profile with the name `enable-samples`. + +The samples must be separate from the primary project for a few reasons: +1. Primary projects have a minimum Java version of Java 7 whereas samples have + a minimum Java version of Java 8. Due to this we need the ability to + selectively exclude samples from a build run. +2. Many code samples depend on external GCP services and need + credentials to access the service. +3. Code samples are not released as Maven artifacts and must be excluded from + release builds. + +### Building + +```bash +mvn -Penable-samples clean verify +``` + +Some samples require access to GCP services and require a service account: + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-samples clean verify +``` + +### Profile Config + +1. To add samples in a profile to your Maven project, add the following to your +`pom.xml` + + ```xml + + [...] + + + enable-samples + + sample + + + + [...] + + ``` + +2. [Activate](#profile-activation) the profile. +3. Define your samples in a normal Maven project in the `samples/` directory. + +### Code Formatting + +Code in this repo is formatted with +[google-java-format](https://github.com/google/google-java-format). +To run formatting on your project, you can run: +``` +mvn com.coveo:fmt-maven-plugin:format +``` + +### Profile Activation + +To include code samples when building and testing the project, enable the +`enable-samples` Maven profile. + +#### Command line + +To activate the Maven profile on the command line add `-Penable-samples` to your +Maven command. + +#### Maven `settings.xml` + +To activate the Maven profile in your `~/.m2/settings.xml` add an entry of +`enable-samples` following the instructions in [Active Profiles][2]. + +This method has the benefit of applying to all projects you build (and is +respected by IntelliJ IDEA) and is recommended if you are going to be +contributing samples to several projects. + +#### IntelliJ IDEA + +To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in +[Activate Maven profiles][3] to activate `enable-samples`. + +[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account +[2]: https://maven.apache.org/settings.html#Active_Profiles +[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 00000000..5724ea94 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/google-cloud-retail-bom/pom.xml b/google-cloud-retail-bom/pom.xml new file mode 100644 index 00000000..122346f1 --- /dev/null +++ b/google-cloud-retail-bom/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + com.google.cloud + google-cloud-retail-bom + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.9.2 + + + Google Cloud Retail BOM + https://github.com/googleapis/java-retail + + BOM for Cloud Retail + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-retail.git + scm:git:git@github.com:googleapis/java-retail.git + https://github.com/googleapis/java-retail + + + + true + + + + + sonatype-nexus-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + + com.google.cloud + google-cloud-retail + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-retail-v2 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-retail-v2 + 0.0.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + \ No newline at end of file diff --git a/google-cloud-retail/pom.xml b/google-cloud-retail/pom.xml new file mode 100644 index 00000000..17a217f2 --- /dev/null +++ b/google-cloud-retail/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + com.google.cloud + google-cloud-retail + 0.0.1-SNAPSHOT + jar + Google Cloud Retail + https://github.com/googleapis/java-retail + Retail solutions API. + + com.google.cloud + google-cloud-retail-parent + 0.0.1-SNAPSHOT + + + google-cloud-retail + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-retail-v2 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + 4.13 + + + + com.google.api.grpc + grpc-google-cloud-retail-v2 + test + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java new file mode 100644 index 00000000..ebadcae5 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java @@ -0,0 +1,363 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.stub.CatalogServiceStub; +import com.google.cloud.retail.v2.stub.CatalogServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service for managing catalog configuration. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

Note: close() needs to be called on the CatalogServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of CatalogServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * CatalogServiceSettings catalogServiceSettings =
+ *     CatalogServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * CatalogServiceSettings catalogServiceSettings =
+ *     CatalogServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator") +public class CatalogServiceClient implements BackgroundResource { + private final CatalogServiceSettings settings; + private final CatalogServiceStub stub; + + /** Constructs an instance of CatalogServiceClient with default settings. */ + public static final CatalogServiceClient create() throws IOException { + return create(CatalogServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of CatalogServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final CatalogServiceClient create(CatalogServiceSettings settings) + throws IOException { + return new CatalogServiceClient(settings); + } + + /** + * Constructs an instance of CatalogServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(CatalogServiceSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final CatalogServiceClient create(CatalogServiceStub stub) { + return new CatalogServiceClient(stub); + } + + /** + * Constructs an instance of CatalogServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected CatalogServiceClient(CatalogServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((CatalogServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected CatalogServiceClient(CatalogServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final CatalogServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public CatalogServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. + * + * @param parent Required. The account resource name with an associated location. + *

If the caller does not have permission to list + * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or + * not this location exists, a PERMISSION_DENIED error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCatalogsPagedResponse listCatalogs(LocationName parent) { + ListCatalogsRequest request = + ListCatalogsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listCatalogs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. + * + * @param parent Required. The account resource name with an associated location. + *

If the caller does not have permission to list + * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or + * not this location exists, a PERMISSION_DENIED error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCatalogsPagedResponse listCatalogs(String parent) { + ListCatalogsRequest request = ListCatalogsRequest.newBuilder().setParent(parent).build(); + return listCatalogs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request) { + return listCatalogsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. + * + *

Sample code: + */ + public final UnaryCallable + listCatalogsPagedCallable() { + return stub.listCatalogsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. + * + *

Sample code: + */ + public final UnaryCallable listCatalogsCallable() { + return stub.listCatalogsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Catalog][google.cloud.retail.v2.Catalog]s. + * + * @param catalog Required. The [Catalog][google.cloud.retail.v2.Catalog] to update. + *

If the caller does not have permission to update the + * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist, a NOT_FOUND + * error is returned. + * @param updateMask Indicates which fields in the provided + * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only update the + * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config] field, + * which is also the only currently supported field to update. + *

If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Catalog updateCatalog(Catalog catalog, FieldMask updateMask) { + UpdateCatalogRequest request = + UpdateCatalogRequest.newBuilder().setCatalog(catalog).setUpdateMask(updateMask).build(); + return updateCatalog(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Catalog][google.cloud.retail.v2.Catalog]s. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Catalog updateCatalog(UpdateCatalogRequest request) { + return updateCatalogCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Catalog][google.cloud.retail.v2.Catalog]s. + * + *

Sample code: + */ + public final UnaryCallable updateCatalogCallable() { + return stub.updateCatalogCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListCatalogsPagedResponse + extends AbstractPagedListResponse< + ListCatalogsRequest, + ListCatalogsResponse, + Catalog, + ListCatalogsPage, + ListCatalogsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListCatalogsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListCatalogsPagedResponse apply(ListCatalogsPage input) { + return new ListCatalogsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListCatalogsPagedResponse(ListCatalogsPage page) { + super(page, ListCatalogsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListCatalogsPage + extends AbstractPage { + + private ListCatalogsPage( + PageContext context, + ListCatalogsResponse response) { + super(context, response); + } + + private static ListCatalogsPage createEmptyPage() { + return new ListCatalogsPage(null, null); + } + + @Override + protected ListCatalogsPage createPage( + PageContext context, + ListCatalogsResponse response) { + return new ListCatalogsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListCatalogsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListCatalogsRequest, + ListCatalogsResponse, + Catalog, + ListCatalogsPage, + ListCatalogsFixedSizeCollection> { + + private ListCatalogsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListCatalogsFixedSizeCollection createEmptyCollection() { + return new ListCatalogsFixedSizeCollection(null, 0); + } + + @Override + protected ListCatalogsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListCatalogsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceSettings.java new file mode 100644 index 00000000..926050d9 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceSettings.java @@ -0,0 +1,198 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.CatalogServiceClient.ListCatalogsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.stub.CatalogServiceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link CatalogServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of updateCatalog to 30 seconds: + * + *

{@code
+ * CatalogServiceSettings.Builder catalogServiceSettingsBuilder =
+ *     CatalogServiceSettings.newBuilder();
+ * catalogServiceSettingsBuilder
+ *     .updateCatalogSettings()
+ *     .setRetrySettings(
+ *         catalogServiceSettingsBuilder
+ *             .updateCatalogSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * CatalogServiceSettings catalogServiceSettings = catalogServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class CatalogServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to listCatalogs. */ + public PagedCallSettings + listCatalogsSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).listCatalogsSettings(); + } + + /** Returns the object with the settings used for calls to updateCatalog. */ + public UnaryCallSettings updateCatalogSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).updateCatalogSettings(); + } + + public static final CatalogServiceSettings create(CatalogServiceStubSettings stub) + throws IOException { + return new CatalogServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return CatalogServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return CatalogServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return CatalogServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return CatalogServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return CatalogServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return CatalogServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CatalogServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected CatalogServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for CatalogServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(CatalogServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(CatalogServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(CatalogServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(CatalogServiceStubSettings.newBuilder()); + } + + public CatalogServiceStubSettings.Builder getStubSettingsBuilder() { + return ((CatalogServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to listCatalogs. */ + public PagedCallSettings.Builder< + ListCatalogsRequest, ListCatalogsResponse, ListCatalogsPagedResponse> + listCatalogsSettings() { + return getStubSettingsBuilder().listCatalogsSettings(); + } + + /** Returns the builder for the settings used for calls to updateCatalog. */ + public UnaryCallSettings.Builder updateCatalogSettings() { + return getStubSettingsBuilder().updateCatalogSettings(); + } + + @Override + public CatalogServiceSettings build() throws IOException { + return new CatalogServiceSettings(this); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceClient.java new file mode 100644 index 00000000..f6785d04 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceClient.java @@ -0,0 +1,188 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.stub.PredictionServiceStub; +import com.google.cloud.retail.v2.stub.PredictionServiceStubSettings; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service for making recommendation prediction. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

Note: close() needs to be called on the PredictionServiceClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of PredictionServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * PredictionServiceSettings predictionServiceSettings =
+ *     PredictionServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * PredictionServiceClient predictionServiceClient =
+ *     PredictionServiceClient.create(predictionServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * PredictionServiceSettings predictionServiceSettings =
+ *     PredictionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * PredictionServiceClient predictionServiceClient =
+ *     PredictionServiceClient.create(predictionServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator") +public class PredictionServiceClient implements BackgroundResource { + private final PredictionServiceSettings settings; + private final PredictionServiceStub stub; + + /** Constructs an instance of PredictionServiceClient with default settings. */ + public static final PredictionServiceClient create() throws IOException { + return create(PredictionServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of PredictionServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final PredictionServiceClient create(PredictionServiceSettings settings) + throws IOException { + return new PredictionServiceClient(settings); + } + + /** + * Constructs an instance of PredictionServiceClient, using the given stub for making calls. This + * is for advanced usage - prefer using create(PredictionServiceSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final PredictionServiceClient create(PredictionServiceStub stub) { + return new PredictionServiceClient(stub); + } + + /** + * Constructs an instance of PredictionServiceClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected PredictionServiceClient(PredictionServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((PredictionServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected PredictionServiceClient(PredictionServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final PredictionServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public PredictionServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Makes a recommendation prediction. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PredictResponse predict(PredictRequest request) { + return predictCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Makes a recommendation prediction. + * + *

Sample code: + */ + public final UnaryCallable predictCallable() { + return stub.predictCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceSettings.java new file mode 100644 index 00000000..9602cd5b --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceSettings.java @@ -0,0 +1,182 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.stub.PredictionServiceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link PredictionServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of predict to 30 seconds: + * + *

{@code
+ * PredictionServiceSettings.Builder predictionServiceSettingsBuilder =
+ *     PredictionServiceSettings.newBuilder();
+ * predictionServiceSettingsBuilder
+ *     .predictSettings()
+ *     .setRetrySettings(
+ *         predictionServiceSettingsBuilder
+ *             .predictSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * PredictionServiceSettings predictionServiceSettings = predictionServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class PredictionServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to predict. */ + public UnaryCallSettings predictSettings() { + return ((PredictionServiceStubSettings) getStubSettings()).predictSettings(); + } + + public static final PredictionServiceSettings create(PredictionServiceStubSettings stub) + throws IOException { + return new PredictionServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return PredictionServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return PredictionServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return PredictionServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return PredictionServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return PredictionServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return PredictionServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return PredictionServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected PredictionServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for PredictionServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(PredictionServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(PredictionServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(PredictionServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(PredictionServiceStubSettings.newBuilder()); + } + + public PredictionServiceStubSettings.Builder getStubSettingsBuilder() { + return ((PredictionServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to predict. */ + public UnaryCallSettings.Builder predictSettings() { + return getStubSettingsBuilder().predictSettings(); + } + + @Override + public PredictionServiceSettings build() throws IOException { + return new PredictionServiceSettings(this); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java new file mode 100644 index 00000000..973d9a1e --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java @@ -0,0 +1,474 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.stub.ProductServiceStub; +import com.google.cloud.retail.v2.stub.ProductServiceStubSettings; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service for ingesting [Product][google.cloud.retail.v2.Product] information + * of the customer's website. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

Note: close() needs to be called on the ProductServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ProductServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * ProductServiceSettings productServiceSettings =
+ *     ProductServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * ProductServiceSettings productServiceSettings =
+ *     ProductServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator") +public class ProductServiceClient implements BackgroundResource { + private final ProductServiceSettings settings; + private final ProductServiceStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of ProductServiceClient with default settings. */ + public static final ProductServiceClient create() throws IOException { + return create(ProductServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ProductServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ProductServiceClient create(ProductServiceSettings settings) + throws IOException { + return new ProductServiceClient(settings); + } + + /** + * Constructs an instance of ProductServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(ProductServiceSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final ProductServiceClient create(ProductServiceStub stub) { + return new ProductServiceClient(stub); + } + + /** + * Constructs an instance of ProductServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected ProductServiceClient(ProductServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ProductServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected ProductServiceClient(ProductServiceStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final ProductServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ProductServiceStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Product][google.cloud.retail.v2.Product]. + * + * @param parent Required. The parent catalog resource name, such as + * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch". + * @param product Required. The [Product][google.cloud.retail.v2.Product] to create. + * @param productId Required. The ID to use for the [Product][google.cloud.retail.v2.Product], + * which will become the final component of the + * [Product.name][google.cloud.retail.v2.Product.name]. + *

If the caller does not have permission to create the + * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

This field must be unique among all [Product][google.cloud.retail.v2.Product]s with the + * same [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an + * ALREADY_EXISTS error is returned. + *

This field must be a UTF-8 encoded string with a length limit of 128 characters. + * Otherwise, an INVALID_ARGUMENT error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product createProduct(BranchName parent, Product product, String productId) { + CreateProductRequest request = + CreateProductRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setProduct(product) + .setProductId(productId) + .build(); + return createProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Product][google.cloud.retail.v2.Product]. + * + * @param parent Required. The parent catalog resource name, such as + * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch". + * @param product Required. The [Product][google.cloud.retail.v2.Product] to create. + * @param productId Required. The ID to use for the [Product][google.cloud.retail.v2.Product], + * which will become the final component of the + * [Product.name][google.cloud.retail.v2.Product.name]. + *

If the caller does not have permission to create the + * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

This field must be unique among all [Product][google.cloud.retail.v2.Product]s with the + * same [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an + * ALREADY_EXISTS error is returned. + *

This field must be a UTF-8 encoded string with a length limit of 128 characters. + * Otherwise, an INVALID_ARGUMENT error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product createProduct(String parent, Product product, String productId) { + CreateProductRequest request = + CreateProductRequest.newBuilder() + .setParent(parent) + .setProduct(product) + .setProductId(productId) + .build(); + return createProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Product][google.cloud.retail.v2.Product]. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product createProduct(CreateProductRequest request) { + return createProductCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Product][google.cloud.retail.v2.Product]. + * + *

Sample code: + */ + public final UnaryCallable createProductCallable() { + return stub.createProductCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [Product][google.cloud.retail.v2.Product]. + * + * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as + * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + *

If the caller does not have permission to access the + * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

If the requested [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND + * error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product getProduct(ProductName name) { + GetProductRequest request = + GetProductRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [Product][google.cloud.retail.v2.Product]. + * + * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as + * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + *

If the caller does not have permission to access the + * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

If the requested [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND + * error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product getProduct(String name) { + GetProductRequest request = GetProductRequest.newBuilder().setName(name).build(); + return getProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [Product][google.cloud.retail.v2.Product]. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product getProduct(GetProductRequest request) { + return getProductCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [Product][google.cloud.retail.v2.Product]. + * + *

Sample code: + */ + public final UnaryCallable getProductCallable() { + return stub.getProductCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a [Product][google.cloud.retail.v2.Product]. + * + * @param product Required. The product to update/create. + *

If the caller does not have permission to update the + * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

If the [Product][google.cloud.retail.v2.Product] to update does not exist, a NOT_FOUND + * error is returned. + * @param updateMask Indicates which fields in the provided + * [Product][google.cloud.retail.v2.Product] to update. The immutable and output only fields + * are NOT supported. If not set, all supported fields (the fields that are neither immutable + * nor output only) are updated. + *

If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product updateProduct(Product product, FieldMask updateMask) { + UpdateProductRequest request = + UpdateProductRequest.newBuilder().setProduct(product).setUpdateMask(updateMask).build(); + return updateProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a [Product][google.cloud.retail.v2.Product]. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product updateProduct(UpdateProductRequest request) { + return updateProductCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a [Product][google.cloud.retail.v2.Product]. + * + *

Sample code: + */ + public final UnaryCallable updateProductCallable() { + return stub.updateProductCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a [Product][google.cloud.retail.v2.Product]. + * + * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as + * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + *

If the caller does not have permission to delete the + * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

If the [Product][google.cloud.retail.v2.Product] to delete does not exist, a NOT_FOUND + * error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteProduct(ProductName name) { + DeleteProductRequest request = + DeleteProductRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a [Product][google.cloud.retail.v2.Product]. + * + * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as + * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + *

If the caller does not have permission to delete the + * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a + * PERMISSION_DENIED error is returned. + *

If the [Product][google.cloud.retail.v2.Product] to delete does not exist, a NOT_FOUND + * error is returned. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteProduct(String name) { + DeleteProductRequest request = DeleteProductRequest.newBuilder().setName(name).build(); + deleteProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a [Product][google.cloud.retail.v2.Product]. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteProduct(DeleteProductRequest request) { + deleteProductCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a [Product][google.cloud.retail.v2.Product]. + * + *

Sample code: + */ + public final UnaryCallable deleteProductCallable() { + return stub.deleteProductCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. + * + *

Request processing may be synchronous. No partial updating is supported. Non-existing items + * are created. + * + *

Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to + * be successfully updated. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture importProductsAsync( + ImportProductsRequest request) { + return importProductsOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. + * + *

Request processing may be synchronous. No partial updating is supported. Non-existing items + * are created. + * + *

Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to + * be successfully updated. + * + *

Sample code: + */ + public final OperationCallable + importProductsOperationCallable() { + return stub.importProductsOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. + * + *

Request processing may be synchronous. No partial updating is supported. Non-existing items + * are created. + * + *

Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to + * be successfully updated. + * + *

Sample code: + */ + public final UnaryCallable importProductsCallable() { + return stub.importProductsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceSettings.java new file mode 100644 index 00000000..d7a8d387 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceSettings.java @@ -0,0 +1,238 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.stub.ProductServiceStubSettings; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ProductServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createProduct to 30 seconds: + * + *

{@code
+ * ProductServiceSettings.Builder productServiceSettingsBuilder =
+ *     ProductServiceSettings.newBuilder();
+ * productServiceSettingsBuilder
+ *     .createProductSettings()
+ *     .setRetrySettings(
+ *         productServiceSettingsBuilder
+ *             .createProductSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ProductServiceSettings productServiceSettings = productServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ProductServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createProduct. */ + public UnaryCallSettings createProductSettings() { + return ((ProductServiceStubSettings) getStubSettings()).createProductSettings(); + } + + /** Returns the object with the settings used for calls to getProduct. */ + public UnaryCallSettings getProductSettings() { + return ((ProductServiceStubSettings) getStubSettings()).getProductSettings(); + } + + /** Returns the object with the settings used for calls to updateProduct. */ + public UnaryCallSettings updateProductSettings() { + return ((ProductServiceStubSettings) getStubSettings()).updateProductSettings(); + } + + /** Returns the object with the settings used for calls to deleteProduct. */ + public UnaryCallSettings deleteProductSettings() { + return ((ProductServiceStubSettings) getStubSettings()).deleteProductSettings(); + } + + /** Returns the object with the settings used for calls to importProducts. */ + public UnaryCallSettings importProductsSettings() { + return ((ProductServiceStubSettings) getStubSettings()).importProductsSettings(); + } + + /** Returns the object with the settings used for calls to importProducts. */ + public OperationCallSettings + importProductsOperationSettings() { + return ((ProductServiceStubSettings) getStubSettings()).importProductsOperationSettings(); + } + + public static final ProductServiceSettings create(ProductServiceStubSettings stub) + throws IOException { + return new ProductServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ProductServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ProductServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ProductServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ProductServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return ProductServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ProductServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ProductServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ProductServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ProductServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(ProductServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(ProductServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ProductServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(ProductServiceStubSettings.newBuilder()); + } + + public ProductServiceStubSettings.Builder getStubSettingsBuilder() { + return ((ProductServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createProduct. */ + public UnaryCallSettings.Builder createProductSettings() { + return getStubSettingsBuilder().createProductSettings(); + } + + /** Returns the builder for the settings used for calls to getProduct. */ + public UnaryCallSettings.Builder getProductSettings() { + return getStubSettingsBuilder().getProductSettings(); + } + + /** Returns the builder for the settings used for calls to updateProduct. */ + public UnaryCallSettings.Builder updateProductSettings() { + return getStubSettingsBuilder().updateProductSettings(); + } + + /** Returns the builder for the settings used for calls to deleteProduct. */ + public UnaryCallSettings.Builder deleteProductSettings() { + return getStubSettingsBuilder().deleteProductSettings(); + } + + /** Returns the builder for the settings used for calls to importProducts. */ + public UnaryCallSettings.Builder importProductsSettings() { + return getStubSettingsBuilder().importProductsSettings(); + } + + /** Returns the builder for the settings used for calls to importProducts. */ + public OperationCallSettings.Builder< + ImportProductsRequest, ImportProductsResponse, ImportMetadata> + importProductsOperationSettings() { + return getStubSettingsBuilder().importProductsOperationSettings(); + } + + @Override + public ProductServiceSettings build() throws IOException { + return new ProductServiceSettings(this); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java new file mode 100644 index 00000000..31640f58 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java @@ -0,0 +1,366 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.HttpBody; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.stub.UserEventServiceStub; +import com.google.cloud.retail.v2.stub.UserEventServiceStubSettings; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service for ingesting end user actions on the customer website. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

Note: close() needs to be called on the UserEventServiceClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of UserEventServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * UserEventServiceSettings userEventServiceSettings =
+ *     UserEventServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * UserEventServiceClient userEventServiceClient =
+ *     UserEventServiceClient.create(userEventServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * UserEventServiceSettings userEventServiceSettings =
+ *     UserEventServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * UserEventServiceClient userEventServiceClient =
+ *     UserEventServiceClient.create(userEventServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator") +public class UserEventServiceClient implements BackgroundResource { + private final UserEventServiceSettings settings; + private final UserEventServiceStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of UserEventServiceClient with default settings. */ + public static final UserEventServiceClient create() throws IOException { + return create(UserEventServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of UserEventServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final UserEventServiceClient create(UserEventServiceSettings settings) + throws IOException { + return new UserEventServiceClient(settings); + } + + /** + * Constructs an instance of UserEventServiceClient, using the given stub for making calls. This + * is for advanced usage - prefer using create(UserEventServiceSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final UserEventServiceClient create(UserEventServiceStub stub) { + return new UserEventServiceClient(stub); + } + + /** + * Constructs an instance of UserEventServiceClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected UserEventServiceClient(UserEventServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((UserEventServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected UserEventServiceClient(UserEventServiceStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final UserEventServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public UserEventServiceStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Writes a single user event. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final UserEvent writeUserEvent(WriteUserEventRequest request) { + return writeUserEventCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Writes a single user event. + * + *

Sample code: + */ + public final UnaryCallable writeUserEventCallable() { + return stub.writeUserEventCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Writes a single user event from the browser. This uses a GET request to due to browser + * restriction of POST-ing to a 3rd party domain. + * + *

This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users + * should not call this method directly. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final HttpBody collectUserEvent(CollectUserEventRequest request) { + return collectUserEventCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Writes a single user event from the browser. This uses a GET request to due to browser + * restriction of POST-ing to a 3rd party domain. + * + *

This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users + * should not call this method directly. + * + *

Sample code: + */ + public final UnaryCallable collectUserEventCallable() { + return stub.collectUserEventCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes permanently all user events specified by the filter provided. Depending on the number + * of events specified by the filter, this operation could take hours or days to complete. To test + * a filter, use the list command first. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture purgeUserEventsAsync( + PurgeUserEventsRequest request) { + return purgeUserEventsOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes permanently all user events specified by the filter provided. Depending on the number + * of events specified by the filter, this operation could take hours or days to complete. To test + * a filter, use the list command first. + * + *

Sample code: + */ + public final OperationCallable + purgeUserEventsOperationCallable() { + return stub.purgeUserEventsOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes permanently all user events specified by the filter provided. Depending on the number + * of events specified by the filter, this operation could take hours or days to complete. To test + * a filter, use the list command first. + * + *

Sample code: + */ + public final UnaryCallable purgeUserEventsCallable() { + return stub.purgeUserEventsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Bulk import of User events. Request processing might be synchronous. Events that already exist + * are skipped. Use this method for backfilling historical user events. + * + *

Operation.response is of type ImportResponse. Note that it is possible for a subset of the + * items to be successfully inserted. Operation.metadata is of type ImportMetadata. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture importUserEventsAsync( + ImportUserEventsRequest request) { + return importUserEventsOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Bulk import of User events. Request processing might be synchronous. Events that already exist + * are skipped. Use this method for backfilling historical user events. + * + *

Operation.response is of type ImportResponse. Note that it is possible for a subset of the + * items to be successfully inserted. Operation.metadata is of type ImportMetadata. + * + *

Sample code: + */ + public final OperationCallable + importUserEventsOperationCallable() { + return stub.importUserEventsOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Bulk import of User events. Request processing might be synchronous. Events that already exist + * are skipped. Use this method for backfilling historical user events. + * + *

Operation.response is of type ImportResponse. Note that it is possible for a subset of the + * items to be successfully inserted. Operation.metadata is of type ImportMetadata. + * + *

Sample code: + */ + public final UnaryCallable importUserEventsCallable() { + return stub.importUserEventsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers a user event rejoin operation with latest product catalog. Events will not be + * annotated with detailed product information if product is missing from the catalog at the time + * the user event is ingested, and these events are stored as unjoined events with a limited usage + * on training and serving. This API can be used to trigger a 'join' operation on specified events + * with latest version of product catalog. It can also be used to correct events joined with wrong + * product catalog. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture + rejoinUserEventsAsync(RejoinUserEventsRequest request) { + return rejoinUserEventsOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers a user event rejoin operation with latest product catalog. Events will not be + * annotated with detailed product information if product is missing from the catalog at the time + * the user event is ingested, and these events are stored as unjoined events with a limited usage + * on training and serving. This API can be used to trigger a 'join' operation on specified events + * with latest version of product catalog. It can also be used to correct events joined with wrong + * product catalog. + * + *

Sample code: + */ + public final OperationCallable< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationCallable() { + return stub.rejoinUserEventsOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers a user event rejoin operation with latest product catalog. Events will not be + * annotated with detailed product information if product is missing from the catalog at the time + * the user event is ingested, and these events are stored as unjoined events with a limited usage + * on training and serving. This API can be used to trigger a 'join' operation on specified events + * with latest version of product catalog. It can also be used to correct events joined with wrong + * product catalog. + * + *

Sample code: + */ + public final UnaryCallable rejoinUserEventsCallable() { + return stub.rejoinUserEventsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceSettings.java new file mode 100644 index 00000000..0851516a --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceSettings.java @@ -0,0 +1,267 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.HttpBody; +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.stub.UserEventServiceStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link UserEventServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of writeUserEvent to 30 seconds: + * + *

{@code
+ * UserEventServiceSettings.Builder userEventServiceSettingsBuilder =
+ *     UserEventServiceSettings.newBuilder();
+ * userEventServiceSettingsBuilder
+ *     .writeUserEventSettings()
+ *     .setRetrySettings(
+ *         userEventServiceSettingsBuilder
+ *             .writeUserEventSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * UserEventServiceSettings userEventServiceSettings = userEventServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class UserEventServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to writeUserEvent. */ + public UnaryCallSettings writeUserEventSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).writeUserEventSettings(); + } + + /** Returns the object with the settings used for calls to collectUserEvent. */ + public UnaryCallSettings collectUserEventSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).collectUserEventSettings(); + } + + /** Returns the object with the settings used for calls to purgeUserEvents. */ + public UnaryCallSettings purgeUserEventsSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).purgeUserEventsSettings(); + } + + /** Returns the object with the settings used for calls to purgeUserEvents. */ + public OperationCallSettings + purgeUserEventsOperationSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).purgeUserEventsOperationSettings(); + } + + /** Returns the object with the settings used for calls to importUserEvents. */ + public UnaryCallSettings importUserEventsSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).importUserEventsSettings(); + } + + /** Returns the object with the settings used for calls to importUserEvents. */ + public OperationCallSettings + importUserEventsOperationSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).importUserEventsOperationSettings(); + } + + /** Returns the object with the settings used for calls to rejoinUserEvents. */ + public UnaryCallSettings rejoinUserEventsSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).rejoinUserEventsSettings(); + } + + /** Returns the object with the settings used for calls to rejoinUserEvents. */ + public OperationCallSettings< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationSettings() { + return ((UserEventServiceStubSettings) getStubSettings()).rejoinUserEventsOperationSettings(); + } + + public static final UserEventServiceSettings create(UserEventServiceStubSettings stub) + throws IOException { + return new UserEventServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return UserEventServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return UserEventServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return UserEventServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return UserEventServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return UserEventServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return UserEventServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return UserEventServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected UserEventServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for UserEventServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(UserEventServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(UserEventServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(UserEventServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(UserEventServiceStubSettings.newBuilder()); + } + + public UserEventServiceStubSettings.Builder getStubSettingsBuilder() { + return ((UserEventServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to writeUserEvent. */ + public UnaryCallSettings.Builder writeUserEventSettings() { + return getStubSettingsBuilder().writeUserEventSettings(); + } + + /** Returns the builder for the settings used for calls to collectUserEvent. */ + public UnaryCallSettings.Builder collectUserEventSettings() { + return getStubSettingsBuilder().collectUserEventSettings(); + } + + /** Returns the builder for the settings used for calls to purgeUserEvents. */ + public UnaryCallSettings.Builder purgeUserEventsSettings() { + return getStubSettingsBuilder().purgeUserEventsSettings(); + } + + /** Returns the builder for the settings used for calls to purgeUserEvents. */ + public OperationCallSettings.Builder< + PurgeUserEventsRequest, PurgeUserEventsResponse, PurgeMetadata> + purgeUserEventsOperationSettings() { + return getStubSettingsBuilder().purgeUserEventsOperationSettings(); + } + + /** Returns the builder for the settings used for calls to importUserEvents. */ + public UnaryCallSettings.Builder + importUserEventsSettings() { + return getStubSettingsBuilder().importUserEventsSettings(); + } + + /** Returns the builder for the settings used for calls to importUserEvents. */ + public OperationCallSettings.Builder< + ImportUserEventsRequest, ImportUserEventsResponse, ImportMetadata> + importUserEventsOperationSettings() { + return getStubSettingsBuilder().importUserEventsOperationSettings(); + } + + /** Returns the builder for the settings used for calls to rejoinUserEvents. */ + public UnaryCallSettings.Builder + rejoinUserEventsSettings() { + return getStubSettingsBuilder().rejoinUserEventsSettings(); + } + + /** Returns the builder for the settings used for calls to rejoinUserEvents. */ + public OperationCallSettings.Builder< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationSettings() { + return getStubSettingsBuilder().rejoinUserEventsOperationSettings(); + } + + @Override + public UserEventServiceSettings build() throws IOException { + return new UserEventServiceSettings(this); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java new file mode 100644 index 00000000..a0001ac1 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java @@ -0,0 +1,48 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ + +/** + * The interfaces provided are listed below, along with usage samples. + * + *

======================= CatalogServiceClient ======================= + * + *

Service Description: Service for managing catalog configuration. + * + *

Sample for CatalogServiceClient: + * + *

======================= PredictionServiceClient ======================= + * + *

Service Description: Service for making recommendation prediction. + * + *

Sample for PredictionServiceClient: + * + *

======================= ProductServiceClient ======================= + * + *

Service Description: Service for ingesting [Product][google.cloud.retail.v2.Product] + * information of the customer's website. + * + *

Sample for ProductServiceClient: + * + *

======================= UserEventServiceClient ======================= + * + *

Service Description: Service for ingesting end user actions on the customer website. + * + *

Sample for UserEventServiceClient: + */ +@Generated("by gapic-generator-java") +package com.google.cloud.retail.v2; + +import javax.annotation.Generated; diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStub.java new file mode 100644 index 00000000..40b40cde --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStub.java @@ -0,0 +1,52 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.CatalogServiceClient.ListCatalogsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.Catalog; +import com.google.cloud.retail.v2.ListCatalogsRequest; +import com.google.cloud.retail.v2.ListCatalogsResponse; +import com.google.cloud.retail.v2.UpdateCatalogRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the CatalogService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +public abstract class CatalogServiceStub implements BackgroundResource { + + public UnaryCallable listCatalogsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listCatalogsPagedCallable()"); + } + + public UnaryCallable listCatalogsCallable() { + throw new UnsupportedOperationException("Not implemented: listCatalogsCallable()"); + } + + public UnaryCallable updateCatalogCallable() { + throw new UnsupportedOperationException("Not implemented: updateCatalogCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStubSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStubSettings.java new file mode 100644 index 00000000..ccf8608f --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStubSettings.java @@ -0,0 +1,362 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.CatalogServiceClient.ListCatalogsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.Catalog; +import com.google.cloud.retail.v2.ListCatalogsRequest; +import com.google.cloud.retail.v2.ListCatalogsResponse; +import com.google.cloud.retail.v2.UpdateCatalogRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link CatalogServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of updateCatalog to 30 seconds: + * + *

{@code
+ * CatalogServiceStubSettings.Builder catalogServiceSettingsBuilder =
+ *     CatalogServiceStubSettings.newBuilder();
+ * catalogServiceSettingsBuilder
+ *     .updateCatalogSettings()
+ *     .setRetrySettings(
+ *         catalogServiceSettingsBuilder
+ *             .updateCatalogSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * CatalogServiceStubSettings catalogServiceSettings = catalogServiceSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class CatalogServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final PagedCallSettings< + ListCatalogsRequest, ListCatalogsResponse, ListCatalogsPagedResponse> + listCatalogsSettings; + private final UnaryCallSettings updateCatalogSettings; + + private static final PagedListDescriptor + LIST_CATALOGS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListCatalogsRequest injectToken(ListCatalogsRequest payload, String token) { + return ListCatalogsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListCatalogsRequest injectPageSize(ListCatalogsRequest payload, int pageSize) { + return ListCatalogsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListCatalogsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListCatalogsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListCatalogsResponse payload) { + return payload.getCatalogsList() == null + ? ImmutableList.of() + : payload.getCatalogsList(); + } + }; + + private static final PagedListResponseFactory< + ListCatalogsRequest, ListCatalogsResponse, ListCatalogsPagedResponse> + LIST_CATALOGS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListCatalogsRequest, ListCatalogsResponse, ListCatalogsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListCatalogsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_CATALOGS_PAGE_STR_DESC, request, context); + return ListCatalogsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to listCatalogs. */ + public PagedCallSettings + listCatalogsSettings() { + return listCatalogsSettings; + } + + /** Returns the object with the settings used for calls to updateCatalog. */ + public UnaryCallSettings updateCatalogSettings() { + return updateCatalogSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public CatalogServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcCatalogServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "retail.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(CatalogServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected CatalogServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listCatalogsSettings = settingsBuilder.listCatalogsSettings().build(); + updateCatalogSettings = settingsBuilder.updateCatalogSettings().build(); + } + + /** Builder for CatalogServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final PagedCallSettings.Builder< + ListCatalogsRequest, ListCatalogsResponse, ListCatalogsPagedResponse> + listCatalogsSettings; + private final UnaryCallSettings.Builder updateCatalogSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listCatalogsSettings = PagedCallSettings.newBuilder(LIST_CATALOGS_PAGE_STR_FACT); + updateCatalogSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listCatalogsSettings, updateCatalogSettings); + initDefaults(this); + } + + protected Builder(CatalogServiceStubSettings settings) { + super(settings); + + listCatalogsSettings = settings.listCatalogsSettings.toBuilder(); + updateCatalogSettings = settings.updateCatalogSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listCatalogsSettings, updateCatalogSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .listCatalogsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateCatalogSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + return builder; + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to listCatalogs. */ + public PagedCallSettings.Builder< + ListCatalogsRequest, ListCatalogsResponse, ListCatalogsPagedResponse> + listCatalogsSettings() { + return listCatalogsSettings; + } + + /** Returns the builder for the settings used for calls to updateCatalog. */ + public UnaryCallSettings.Builder updateCatalogSettings() { + return updateCatalogSettings; + } + + @Override + public CatalogServiceStubSettings build() throws IOException { + return new CatalogServiceStubSettings(this); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceCallableFactory.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceCallableFactory.java new file mode 100644 index 00000000..7a50e14c --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the CatalogService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +public class GrpcCatalogServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceStub.java new file mode 100644 index 00000000..a65f5b8e --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceStub.java @@ -0,0 +1,204 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.CatalogServiceClient.ListCatalogsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.Catalog; +import com.google.cloud.retail.v2.ListCatalogsRequest; +import com.google.cloud.retail.v2.ListCatalogsResponse; +import com.google.cloud.retail.v2.UpdateCatalogRequest; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the CatalogService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcCatalogServiceStub extends CatalogServiceStub { + private static final MethodDescriptor + listCatalogsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/ListCatalogs") + .setRequestMarshaller(ProtoUtils.marshaller(ListCatalogsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListCatalogsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateCatalogMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/UpdateCatalog") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateCatalogRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Catalog.getDefaultInstance())) + .build(); + + private final UnaryCallable listCatalogsCallable; + private final UnaryCallable + listCatalogsPagedCallable; + private final UnaryCallable updateCatalogCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcCatalogServiceStub create(CatalogServiceStubSettings settings) + throws IOException { + return new GrpcCatalogServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcCatalogServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcCatalogServiceStub( + CatalogServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcCatalogServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcCatalogServiceStub( + CatalogServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcCatalogServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcCatalogServiceStub(CatalogServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcCatalogServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcCatalogServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcCatalogServiceStub( + CatalogServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings listCatalogsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listCatalogsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListCatalogsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateCatalogTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateCatalogMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateCatalogRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("catalog.name", String.valueOf(request.getCatalog().getName())); + return params.build(); + } + }) + .build(); + + this.listCatalogsCallable = + callableFactory.createUnaryCallable( + listCatalogsTransportSettings, settings.listCatalogsSettings(), clientContext); + this.listCatalogsPagedCallable = + callableFactory.createPagedCallable( + listCatalogsTransportSettings, settings.listCatalogsSettings(), clientContext); + this.updateCatalogCallable = + callableFactory.createUnaryCallable( + updateCatalogTransportSettings, settings.updateCatalogSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + public UnaryCallable listCatalogsCallable() { + return listCatalogsCallable; + } + + public UnaryCallable listCatalogsPagedCallable() { + return listCatalogsPagedCallable; + } + + public UnaryCallable updateCatalogCallable() { + return updateCatalogCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcPredictionServiceCallableFactory.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcPredictionServiceCallableFactory.java new file mode 100644 index 00000000..64bc4b28 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcPredictionServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the PredictionService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +public class GrpcPredictionServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcPredictionServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcPredictionServiceStub.java new file mode 100644 index 00000000..2151fcde --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcPredictionServiceStub.java @@ -0,0 +1,158 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.PredictRequest; +import com.google.cloud.retail.v2.PredictResponse; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the PredictionService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcPredictionServiceStub extends PredictionServiceStub { + private static final MethodDescriptor predictMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.PredictionService/Predict") + .setRequestMarshaller(ProtoUtils.marshaller(PredictRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(PredictResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable predictCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcPredictionServiceStub create(PredictionServiceStubSettings settings) + throws IOException { + return new GrpcPredictionServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcPredictionServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcPredictionServiceStub( + PredictionServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcPredictionServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcPredictionServiceStub( + PredictionServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcPredictionServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcPredictionServiceStub( + PredictionServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcPredictionServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcPredictionServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcPredictionServiceStub( + PredictionServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings predictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(predictMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(PredictRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("placement", String.valueOf(request.getPlacement())); + return params.build(); + } + }) + .build(); + + this.predictCallable = + callableFactory.createUnaryCallable( + predictTransportSettings, settings.predictSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + public UnaryCallable predictCallable() { + return predictCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcProductServiceCallableFactory.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcProductServiceCallableFactory.java new file mode 100644 index 00000000..f038a6b9 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcProductServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the ProductService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +public class GrpcProductServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcProductServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcProductServiceStub.java new file mode 100644 index 00000000..e69b561c --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcProductServiceStub.java @@ -0,0 +1,302 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.CreateProductRequest; +import com.google.cloud.retail.v2.DeleteProductRequest; +import com.google.cloud.retail.v2.GetProductRequest; +import com.google.cloud.retail.v2.ImportMetadata; +import com.google.cloud.retail.v2.ImportProductsRequest; +import com.google.cloud.retail.v2.ImportProductsResponse; +import com.google.cloud.retail.v2.Product; +import com.google.cloud.retail.v2.UpdateProductRequest; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the ProductService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcProductServiceStub extends ProductServiceStub { + private static final MethodDescriptor + createProductMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ProductService/CreateProduct") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateProductRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Product.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getProductMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ProductService/GetProduct") + .setRequestMarshaller(ProtoUtils.marshaller(GetProductRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Product.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateProductMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ProductService/UpdateProduct") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateProductRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Product.getDefaultInstance())) + .build(); + + private static final MethodDescriptor deleteProductMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ProductService/DeleteProduct") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteProductRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + importProductsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ProductService/ImportProducts") + .setRequestMarshaller( + ProtoUtils.marshaller(ImportProductsRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final UnaryCallable createProductCallable; + private final UnaryCallable getProductCallable; + private final UnaryCallable updateProductCallable; + private final UnaryCallable deleteProductCallable; + private final UnaryCallable importProductsCallable; + private final OperationCallable + importProductsOperationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcProductServiceStub create(ProductServiceStubSettings settings) + throws IOException { + return new GrpcProductServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcProductServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcProductServiceStub( + ProductServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcProductServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcProductServiceStub( + ProductServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcProductServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcProductServiceStub(ProductServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcProductServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcProductServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcProductServiceStub( + ProductServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createProductTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createProductMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateProductRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getProductTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getProductMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetProductRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateProductTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateProductMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateProductRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("product.name", String.valueOf(request.getProduct().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteProductTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteProductMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteProductRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings importProductsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(importProductsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ImportProductsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + + this.createProductCallable = + callableFactory.createUnaryCallable( + createProductTransportSettings, settings.createProductSettings(), clientContext); + this.getProductCallable = + callableFactory.createUnaryCallable( + getProductTransportSettings, settings.getProductSettings(), clientContext); + this.updateProductCallable = + callableFactory.createUnaryCallable( + updateProductTransportSettings, settings.updateProductSettings(), clientContext); + this.deleteProductCallable = + callableFactory.createUnaryCallable( + deleteProductTransportSettings, settings.deleteProductSettings(), clientContext); + this.importProductsCallable = + callableFactory.createUnaryCallable( + importProductsTransportSettings, settings.importProductsSettings(), clientContext); + this.importProductsOperationCallable = + callableFactory.createOperationCallable( + importProductsTransportSettings, + settings.importProductsOperationSettings(), + clientContext, + operationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + public UnaryCallable createProductCallable() { + return createProductCallable; + } + + public UnaryCallable getProductCallable() { + return getProductCallable; + } + + public UnaryCallable updateProductCallable() { + return updateProductCallable; + } + + public UnaryCallable deleteProductCallable() { + return deleteProductCallable; + } + + public UnaryCallable importProductsCallable() { + return importProductsCallable; + } + + public OperationCallable + importProductsOperationCallable() { + return importProductsOperationCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcUserEventServiceCallableFactory.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcUserEventServiceCallableFactory.java new file mode 100644 index 00000000..26349af1 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcUserEventServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the UserEventService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +public class GrpcUserEventServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcUserEventServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcUserEventServiceStub.java new file mode 100644 index 00000000..b73298d2 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcUserEventServiceStub.java @@ -0,0 +1,338 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.HttpBody; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.CollectUserEventRequest; +import com.google.cloud.retail.v2.ImportMetadata; +import com.google.cloud.retail.v2.ImportUserEventsRequest; +import com.google.cloud.retail.v2.ImportUserEventsResponse; +import com.google.cloud.retail.v2.PurgeMetadata; +import com.google.cloud.retail.v2.PurgeUserEventsRequest; +import com.google.cloud.retail.v2.PurgeUserEventsResponse; +import com.google.cloud.retail.v2.RejoinUserEventsMetadata; +import com.google.cloud.retail.v2.RejoinUserEventsRequest; +import com.google.cloud.retail.v2.RejoinUserEventsResponse; +import com.google.cloud.retail.v2.UserEvent; +import com.google.cloud.retail.v2.WriteUserEventRequest; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the UserEventService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcUserEventServiceStub extends UserEventServiceStub { + private static final MethodDescriptor + writeUserEventMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.UserEventService/WriteUserEvent") + .setRequestMarshaller( + ProtoUtils.marshaller(WriteUserEventRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(UserEvent.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + collectUserEventMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.UserEventService/CollectUserEvent") + .setRequestMarshaller( + ProtoUtils.marshaller(CollectUserEventRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + purgeUserEventsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.UserEventService/PurgeUserEvents") + .setRequestMarshaller( + ProtoUtils.marshaller(PurgeUserEventsRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + importUserEventsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.UserEventService/ImportUserEvents") + .setRequestMarshaller( + ProtoUtils.marshaller(ImportUserEventsRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + rejoinUserEventsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.UserEventService/RejoinUserEvents") + .setRequestMarshaller( + ProtoUtils.marshaller(RejoinUserEventsRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final UnaryCallable writeUserEventCallable; + private final UnaryCallable collectUserEventCallable; + private final UnaryCallable purgeUserEventsCallable; + private final OperationCallable + purgeUserEventsOperationCallable; + private final UnaryCallable importUserEventsCallable; + private final OperationCallable + importUserEventsOperationCallable; + private final UnaryCallable rejoinUserEventsCallable; + private final OperationCallable< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcUserEventServiceStub create(UserEventServiceStubSettings settings) + throws IOException { + return new GrpcUserEventServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcUserEventServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcUserEventServiceStub( + UserEventServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcUserEventServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcUserEventServiceStub( + UserEventServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcUserEventServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcUserEventServiceStub( + UserEventServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcUserEventServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcUserEventServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcUserEventServiceStub( + UserEventServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings writeUserEventTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(writeUserEventMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(WriteUserEventRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings collectUserEventTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(collectUserEventMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CollectUserEventRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings purgeUserEventsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(purgeUserEventsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(PurgeUserEventsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings importUserEventsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(importUserEventsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ImportUserEventsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings rejoinUserEventsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(rejoinUserEventsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(RejoinUserEventsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + + this.writeUserEventCallable = + callableFactory.createUnaryCallable( + writeUserEventTransportSettings, settings.writeUserEventSettings(), clientContext); + this.collectUserEventCallable = + callableFactory.createUnaryCallable( + collectUserEventTransportSettings, settings.collectUserEventSettings(), clientContext); + this.purgeUserEventsCallable = + callableFactory.createUnaryCallable( + purgeUserEventsTransportSettings, settings.purgeUserEventsSettings(), clientContext); + this.purgeUserEventsOperationCallable = + callableFactory.createOperationCallable( + purgeUserEventsTransportSettings, + settings.purgeUserEventsOperationSettings(), + clientContext, + operationsStub); + this.importUserEventsCallable = + callableFactory.createUnaryCallable( + importUserEventsTransportSettings, settings.importUserEventsSettings(), clientContext); + this.importUserEventsOperationCallable = + callableFactory.createOperationCallable( + importUserEventsTransportSettings, + settings.importUserEventsOperationSettings(), + clientContext, + operationsStub); + this.rejoinUserEventsCallable = + callableFactory.createUnaryCallable( + rejoinUserEventsTransportSettings, settings.rejoinUserEventsSettings(), clientContext); + this.rejoinUserEventsOperationCallable = + callableFactory.createOperationCallable( + rejoinUserEventsTransportSettings, + settings.rejoinUserEventsOperationSettings(), + clientContext, + operationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + public UnaryCallable writeUserEventCallable() { + return writeUserEventCallable; + } + + public UnaryCallable collectUserEventCallable() { + return collectUserEventCallable; + } + + public UnaryCallable purgeUserEventsCallable() { + return purgeUserEventsCallable; + } + + public OperationCallable + purgeUserEventsOperationCallable() { + return purgeUserEventsOperationCallable; + } + + public UnaryCallable importUserEventsCallable() { + return importUserEventsCallable; + } + + public OperationCallable + importUserEventsOperationCallable() { + return importUserEventsOperationCallable; + } + + public UnaryCallable rejoinUserEventsCallable() { + return rejoinUserEventsCallable; + } + + public OperationCallable< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationCallable() { + return rejoinUserEventsOperationCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/PredictionServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/PredictionServiceStub.java new file mode 100644 index 00000000..2b93883c --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/PredictionServiceStub.java @@ -0,0 +1,40 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.PredictRequest; +import com.google.cloud.retail.v2.PredictResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the PredictionService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +public abstract class PredictionServiceStub implements BackgroundResource { + + public UnaryCallable predictCallable() { + throw new UnsupportedOperationException("Not implemented: predictCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/PredictionServiceStubSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/PredictionServiceStubSettings.java new file mode 100644 index 00000000..afa05b51 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/PredictionServiceStubSettings.java @@ -0,0 +1,270 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.PredictRequest; +import com.google.cloud.retail.v2.PredictResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link PredictionServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of predict to 30 seconds: + * + *

{@code
+ * PredictionServiceStubSettings.Builder predictionServiceSettingsBuilder =
+ *     PredictionServiceStubSettings.newBuilder();
+ * predictionServiceSettingsBuilder
+ *     .predictSettings()
+ *     .setRetrySettings(
+ *         predictionServiceSettingsBuilder
+ *             .predictSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * PredictionServiceStubSettings predictionServiceSettings =
+ *     predictionServiceSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class PredictionServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings predictSettings; + + /** Returns the object with the settings used for calls to predict. */ + public UnaryCallSettings predictSettings() { + return predictSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public PredictionServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcPredictionServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "retail.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(PredictionServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected PredictionServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + predictSettings = settingsBuilder.predictSettings().build(); + } + + /** Builder for PredictionServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder predictSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + predictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(predictSettings); + initDefaults(this); + } + + protected Builder(PredictionServiceStubSettings settings) { + super(settings); + + predictSettings = settings.predictSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(predictSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .predictSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + return builder; + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to predict. */ + public UnaryCallSettings.Builder predictSettings() { + return predictSettings; + } + + @Override + public PredictionServiceStubSettings build() throws IOException { + return new PredictionServiceStubSettings(this); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ProductServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ProductServiceStub.java new file mode 100644 index 00000000..f0f04c19 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ProductServiceStub.java @@ -0,0 +1,75 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.CreateProductRequest; +import com.google.cloud.retail.v2.DeleteProductRequest; +import com.google.cloud.retail.v2.GetProductRequest; +import com.google.cloud.retail.v2.ImportMetadata; +import com.google.cloud.retail.v2.ImportProductsRequest; +import com.google.cloud.retail.v2.ImportProductsResponse; +import com.google.cloud.retail.v2.Product; +import com.google.cloud.retail.v2.UpdateProductRequest; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the ProductService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +public abstract class ProductServiceStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + public UnaryCallable createProductCallable() { + throw new UnsupportedOperationException("Not implemented: createProductCallable()"); + } + + public UnaryCallable getProductCallable() { + throw new UnsupportedOperationException("Not implemented: getProductCallable()"); + } + + public UnaryCallable updateProductCallable() { + throw new UnsupportedOperationException("Not implemented: updateProductCallable()"); + } + + public UnaryCallable deleteProductCallable() { + throw new UnsupportedOperationException("Not implemented: deleteProductCallable()"); + } + + public OperationCallable + importProductsOperationCallable() { + throw new UnsupportedOperationException("Not implemented: importProductsOperationCallable()"); + } + + public UnaryCallable importProductsCallable() { + throw new UnsupportedOperationException("Not implemented: importProductsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ProductServiceStubSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ProductServiceStubSettings.java new file mode 100644 index 00000000..2e6865f2 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ProductServiceStubSettings.java @@ -0,0 +1,419 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.CreateProductRequest; +import com.google.cloud.retail.v2.DeleteProductRequest; +import com.google.cloud.retail.v2.GetProductRequest; +import com.google.cloud.retail.v2.ImportMetadata; +import com.google.cloud.retail.v2.ImportProductsRequest; +import com.google.cloud.retail.v2.ImportProductsResponse; +import com.google.cloud.retail.v2.Product; +import com.google.cloud.retail.v2.UpdateProductRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ProductServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createProduct to 30 seconds: + * + *

{@code
+ * ProductServiceStubSettings.Builder productServiceSettingsBuilder =
+ *     ProductServiceStubSettings.newBuilder();
+ * productServiceSettingsBuilder
+ *     .createProductSettings()
+ *     .setRetrySettings(
+ *         productServiceSettingsBuilder
+ *             .createProductSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ProductServiceStubSettings productServiceSettings = productServiceSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class ProductServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings createProductSettings; + private final UnaryCallSettings getProductSettings; + private final UnaryCallSettings updateProductSettings; + private final UnaryCallSettings deleteProductSettings; + private final UnaryCallSettings importProductsSettings; + private final OperationCallSettings + importProductsOperationSettings; + + /** Returns the object with the settings used for calls to createProduct. */ + public UnaryCallSettings createProductSettings() { + return createProductSettings; + } + + /** Returns the object with the settings used for calls to getProduct. */ + public UnaryCallSettings getProductSettings() { + return getProductSettings; + } + + /** Returns the object with the settings used for calls to updateProduct. */ + public UnaryCallSettings updateProductSettings() { + return updateProductSettings; + } + + /** Returns the object with the settings used for calls to deleteProduct. */ + public UnaryCallSettings deleteProductSettings() { + return deleteProductSettings; + } + + /** Returns the object with the settings used for calls to importProducts. */ + public UnaryCallSettings importProductsSettings() { + return importProductsSettings; + } + + /** Returns the object with the settings used for calls to importProducts. */ + public OperationCallSettings + importProductsOperationSettings() { + return importProductsOperationSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ProductServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcProductServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "retail.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ProductServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ProductServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createProductSettings = settingsBuilder.createProductSettings().build(); + getProductSettings = settingsBuilder.getProductSettings().build(); + updateProductSettings = settingsBuilder.updateProductSettings().build(); + deleteProductSettings = settingsBuilder.deleteProductSettings().build(); + importProductsSettings = settingsBuilder.importProductsSettings().build(); + importProductsOperationSettings = settingsBuilder.importProductsOperationSettings().build(); + } + + /** Builder for ProductServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder createProductSettings; + private final UnaryCallSettings.Builder getProductSettings; + private final UnaryCallSettings.Builder updateProductSettings; + private final UnaryCallSettings.Builder deleteProductSettings; + private final UnaryCallSettings.Builder + importProductsSettings; + private final OperationCallSettings.Builder< + ImportProductsRequest, ImportProductsResponse, ImportMetadata> + importProductsOperationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + importProductsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + importProductsOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createProductSettings, + getProductSettings, + updateProductSettings, + deleteProductSettings, + importProductsSettings); + initDefaults(this); + } + + protected Builder(ProductServiceStubSettings settings) { + super(settings); + + createProductSettings = settings.createProductSettings.toBuilder(); + getProductSettings = settings.getProductSettings.toBuilder(); + updateProductSettings = settings.updateProductSettings.toBuilder(); + deleteProductSettings = settings.deleteProductSettings.toBuilder(); + importProductsSettings = settings.importProductsSettings.toBuilder(); + importProductsOperationSettings = settings.importProductsOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createProductSettings, + getProductSettings, + updateProductSettings, + deleteProductSettings, + importProductsSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createProductSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getProductSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateProductSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .deleteProductSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .importProductsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .importProductsOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(ImportProductsResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(ImportMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createProduct. */ + public UnaryCallSettings.Builder createProductSettings() { + return createProductSettings; + } + + /** Returns the builder for the settings used for calls to getProduct. */ + public UnaryCallSettings.Builder getProductSettings() { + return getProductSettings; + } + + /** Returns the builder for the settings used for calls to updateProduct. */ + public UnaryCallSettings.Builder updateProductSettings() { + return updateProductSettings; + } + + /** Returns the builder for the settings used for calls to deleteProduct. */ + public UnaryCallSettings.Builder deleteProductSettings() { + return deleteProductSettings; + } + + /** Returns the builder for the settings used for calls to importProducts. */ + public UnaryCallSettings.Builder importProductsSettings() { + return importProductsSettings; + } + + /** Returns the builder for the settings used for calls to importProducts. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + ImportProductsRequest, ImportProductsResponse, ImportMetadata> + importProductsOperationSettings() { + return importProductsOperationSettings; + } + + @Override + public ProductServiceStubSettings build() throws IOException { + return new ProductServiceStubSettings(this); + } + } +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/UserEventServiceStub.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/UserEventServiceStub.java new file mode 100644 index 00000000..7bbd8348 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/UserEventServiceStub.java @@ -0,0 +1,90 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.HttpBody; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.CollectUserEventRequest; +import com.google.cloud.retail.v2.ImportMetadata; +import com.google.cloud.retail.v2.ImportUserEventsRequest; +import com.google.cloud.retail.v2.ImportUserEventsResponse; +import com.google.cloud.retail.v2.PurgeMetadata; +import com.google.cloud.retail.v2.PurgeUserEventsRequest; +import com.google.cloud.retail.v2.PurgeUserEventsResponse; +import com.google.cloud.retail.v2.RejoinUserEventsMetadata; +import com.google.cloud.retail.v2.RejoinUserEventsRequest; +import com.google.cloud.retail.v2.RejoinUserEventsResponse; +import com.google.cloud.retail.v2.UserEvent; +import com.google.cloud.retail.v2.WriteUserEventRequest; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the UserEventService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +public abstract class UserEventServiceStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + public UnaryCallable writeUserEventCallable() { + throw new UnsupportedOperationException("Not implemented: writeUserEventCallable()"); + } + + public UnaryCallable collectUserEventCallable() { + throw new UnsupportedOperationException("Not implemented: collectUserEventCallable()"); + } + + public OperationCallable + purgeUserEventsOperationCallable() { + throw new UnsupportedOperationException("Not implemented: purgeUserEventsOperationCallable()"); + } + + public UnaryCallable purgeUserEventsCallable() { + throw new UnsupportedOperationException("Not implemented: purgeUserEventsCallable()"); + } + + public OperationCallable + importUserEventsOperationCallable() { + throw new UnsupportedOperationException("Not implemented: importUserEventsOperationCallable()"); + } + + public UnaryCallable importUserEventsCallable() { + throw new UnsupportedOperationException("Not implemented: importUserEventsCallable()"); + } + + public OperationCallable< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationCallable() { + throw new UnsupportedOperationException("Not implemented: rejoinUserEventsOperationCallable()"); + } + + public UnaryCallable rejoinUserEventsCallable() { + throw new UnsupportedOperationException("Not implemented: rejoinUserEventsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/UserEventServiceStubSettings.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/UserEventServiceStubSettings.java new file mode 100644 index 00000000..71217d41 --- /dev/null +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/UserEventServiceStubSettings.java @@ -0,0 +1,527 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2.stub; + +import com.google.api.HttpBody; +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.CollectUserEventRequest; +import com.google.cloud.retail.v2.ImportMetadata; +import com.google.cloud.retail.v2.ImportUserEventsRequest; +import com.google.cloud.retail.v2.ImportUserEventsResponse; +import com.google.cloud.retail.v2.PurgeMetadata; +import com.google.cloud.retail.v2.PurgeUserEventsRequest; +import com.google.cloud.retail.v2.PurgeUserEventsResponse; +import com.google.cloud.retail.v2.RejoinUserEventsMetadata; +import com.google.cloud.retail.v2.RejoinUserEventsRequest; +import com.google.cloud.retail.v2.RejoinUserEventsResponse; +import com.google.cloud.retail.v2.UserEvent; +import com.google.cloud.retail.v2.WriteUserEventRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link UserEventServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of writeUserEvent to 30 seconds: + * + *

{@code
+ * UserEventServiceStubSettings.Builder userEventServiceSettingsBuilder =
+ *     UserEventServiceStubSettings.newBuilder();
+ * userEventServiceSettingsBuilder
+ *     .writeUserEventSettings()
+ *     .setRetrySettings(
+ *         userEventServiceSettingsBuilder
+ *             .writeUserEventSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * UserEventServiceStubSettings userEventServiceSettings = userEventServiceSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class UserEventServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings writeUserEventSettings; + private final UnaryCallSettings collectUserEventSettings; + private final UnaryCallSettings purgeUserEventsSettings; + private final OperationCallSettings< + PurgeUserEventsRequest, PurgeUserEventsResponse, PurgeMetadata> + purgeUserEventsOperationSettings; + private final UnaryCallSettings importUserEventsSettings; + private final OperationCallSettings< + ImportUserEventsRequest, ImportUserEventsResponse, ImportMetadata> + importUserEventsOperationSettings; + private final UnaryCallSettings rejoinUserEventsSettings; + private final OperationCallSettings< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationSettings; + + /** Returns the object with the settings used for calls to writeUserEvent. */ + public UnaryCallSettings writeUserEventSettings() { + return writeUserEventSettings; + } + + /** Returns the object with the settings used for calls to collectUserEvent. */ + public UnaryCallSettings collectUserEventSettings() { + return collectUserEventSettings; + } + + /** Returns the object with the settings used for calls to purgeUserEvents. */ + public UnaryCallSettings purgeUserEventsSettings() { + return purgeUserEventsSettings; + } + + /** Returns the object with the settings used for calls to purgeUserEvents. */ + public OperationCallSettings + purgeUserEventsOperationSettings() { + return purgeUserEventsOperationSettings; + } + + /** Returns the object with the settings used for calls to importUserEvents. */ + public UnaryCallSettings importUserEventsSettings() { + return importUserEventsSettings; + } + + /** Returns the object with the settings used for calls to importUserEvents. */ + public OperationCallSettings + importUserEventsOperationSettings() { + return importUserEventsOperationSettings; + } + + /** Returns the object with the settings used for calls to rejoinUserEvents. */ + public UnaryCallSettings rejoinUserEventsSettings() { + return rejoinUserEventsSettings; + } + + /** Returns the object with the settings used for calls to rejoinUserEvents. */ + public OperationCallSettings< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationSettings() { + return rejoinUserEventsOperationSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public UserEventServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcUserEventServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "retail.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(UserEventServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected UserEventServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + writeUserEventSettings = settingsBuilder.writeUserEventSettings().build(); + collectUserEventSettings = settingsBuilder.collectUserEventSettings().build(); + purgeUserEventsSettings = settingsBuilder.purgeUserEventsSettings().build(); + purgeUserEventsOperationSettings = settingsBuilder.purgeUserEventsOperationSettings().build(); + importUserEventsSettings = settingsBuilder.importUserEventsSettings().build(); + importUserEventsOperationSettings = settingsBuilder.importUserEventsOperationSettings().build(); + rejoinUserEventsSettings = settingsBuilder.rejoinUserEventsSettings().build(); + rejoinUserEventsOperationSettings = settingsBuilder.rejoinUserEventsOperationSettings().build(); + } + + /** Builder for UserEventServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + writeUserEventSettings; + private final UnaryCallSettings.Builder + collectUserEventSettings; + private final UnaryCallSettings.Builder + purgeUserEventsSettings; + private final OperationCallSettings.Builder< + PurgeUserEventsRequest, PurgeUserEventsResponse, PurgeMetadata> + purgeUserEventsOperationSettings; + private final UnaryCallSettings.Builder + importUserEventsSettings; + private final OperationCallSettings.Builder< + ImportUserEventsRequest, ImportUserEventsResponse, ImportMetadata> + importUserEventsOperationSettings; + private final UnaryCallSettings.Builder + rejoinUserEventsSettings; + private final OperationCallSettings.Builder< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + writeUserEventSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + collectUserEventSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + purgeUserEventsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + purgeUserEventsOperationSettings = OperationCallSettings.newBuilder(); + importUserEventsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + importUserEventsOperationSettings = OperationCallSettings.newBuilder(); + rejoinUserEventsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + rejoinUserEventsOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + writeUserEventSettings, + collectUserEventSettings, + purgeUserEventsSettings, + importUserEventsSettings, + rejoinUserEventsSettings); + initDefaults(this); + } + + protected Builder(UserEventServiceStubSettings settings) { + super(settings); + + writeUserEventSettings = settings.writeUserEventSettings.toBuilder(); + collectUserEventSettings = settings.collectUserEventSettings.toBuilder(); + purgeUserEventsSettings = settings.purgeUserEventsSettings.toBuilder(); + purgeUserEventsOperationSettings = settings.purgeUserEventsOperationSettings.toBuilder(); + importUserEventsSettings = settings.importUserEventsSettings.toBuilder(); + importUserEventsOperationSettings = settings.importUserEventsOperationSettings.toBuilder(); + rejoinUserEventsSettings = settings.rejoinUserEventsSettings.toBuilder(); + rejoinUserEventsOperationSettings = settings.rejoinUserEventsOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + writeUserEventSettings, + collectUserEventSettings, + purgeUserEventsSettings, + importUserEventsSettings, + rejoinUserEventsSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .writeUserEventSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .collectUserEventSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .purgeUserEventsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .importUserEventsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .rejoinUserEventsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .purgeUserEventsOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(PurgeUserEventsResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(PurgeMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .importUserEventsOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(ImportUserEventsResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(ImportMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .rejoinUserEventsOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(RejoinUserEventsResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(RejoinUserEventsMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to writeUserEvent. */ + public UnaryCallSettings.Builder writeUserEventSettings() { + return writeUserEventSettings; + } + + /** Returns the builder for the settings used for calls to collectUserEvent. */ + public UnaryCallSettings.Builder collectUserEventSettings() { + return collectUserEventSettings; + } + + /** Returns the builder for the settings used for calls to purgeUserEvents. */ + public UnaryCallSettings.Builder purgeUserEventsSettings() { + return purgeUserEventsSettings; + } + + /** Returns the builder for the settings used for calls to purgeUserEvents. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + PurgeUserEventsRequest, PurgeUserEventsResponse, PurgeMetadata> + purgeUserEventsOperationSettings() { + return purgeUserEventsOperationSettings; + } + + /** Returns the builder for the settings used for calls to importUserEvents. */ + public UnaryCallSettings.Builder + importUserEventsSettings() { + return importUserEventsSettings; + } + + /** Returns the builder for the settings used for calls to importUserEvents. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + ImportUserEventsRequest, ImportUserEventsResponse, ImportMetadata> + importUserEventsOperationSettings() { + return importUserEventsOperationSettings; + } + + /** Returns the builder for the settings used for calls to rejoinUserEvents. */ + public UnaryCallSettings.Builder + rejoinUserEventsSettings() { + return rejoinUserEventsSettings; + } + + /** Returns the builder for the settings used for calls to rejoinUserEvents. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> + rejoinUserEventsOperationSettings() { + return rejoinUserEventsOperationSettings; + } + + @Override + public UserEventServiceStubSettings build() throws IOException { + return new UserEventServiceStubSettings(this); + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientTest.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientTest.java new file mode 100644 index 00000000..ce5d1be6 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientTest.java @@ -0,0 +1,212 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.CatalogServiceClient.ListCatalogsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.FieldMask; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class CatalogServiceClientTest { + private static MockCatalogService mockCatalogService; + private static MockServiceHelper mockServiceHelper; + private CatalogServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockCatalogService = new MockCatalogService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockCatalogService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + CatalogServiceSettings settings = + CatalogServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CatalogServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void listCatalogsTest() throws Exception { + Catalog responsesElement = Catalog.newBuilder().build(); + ListCatalogsResponse expectedResponse = + ListCatalogsResponse.newBuilder() + .setNextPageToken("") + .addAllCatalogs(Arrays.asList(responsesElement)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCatalogsPagedResponse pagedListResponse = client.listCatalogs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCatalogsList().get(0), resources.get(0)); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListCatalogsRequest actualRequest = ((ListCatalogsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listCatalogsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listCatalogs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCatalogsTest2() throws Exception { + Catalog responsesElement = Catalog.newBuilder().build(); + ListCatalogsResponse expectedResponse = + ListCatalogsResponse.newBuilder() + .setNextPageToken("") + .addAllCatalogs(Arrays.asList(responsesElement)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListCatalogsPagedResponse pagedListResponse = client.listCatalogs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCatalogsList().get(0), resources.get(0)); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListCatalogsRequest actualRequest = ((ListCatalogsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listCatalogsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listCatalogs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCatalogTest() throws Exception { + Catalog expectedResponse = + Catalog.newBuilder() + .setName("name3373707") + .setDisplayName("displayName1714148973") + .setProductLevelConfig(ProductLevelConfig.newBuilder().build()) + .build(); + mockCatalogService.addResponse(expectedResponse); + + Catalog catalog = Catalog.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Catalog actualResponse = client.updateCatalog(catalog, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateCatalogRequest actualRequest = ((UpdateCatalogRequest) actualRequests.get(0)); + + Assert.assertEquals(catalog, actualRequest.getCatalog()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateCatalogExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + Catalog catalog = Catalog.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCatalog(catalog, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogService.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogService.java new file mode 100644 index 00000000..9ec863cb --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockCatalogService implements MockGrpcService { + private final MockCatalogServiceImpl serviceImpl; + + public MockCatalogService() { + serviceImpl = new MockCatalogServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogServiceImpl.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogServiceImpl.java new file mode 100644 index 00000000..f9f421b9 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogServiceImpl.java @@ -0,0 +1,90 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.retail.v2.CatalogServiceGrpc.CatalogServiceImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockCatalogServiceImpl extends CatalogServiceImplBase { + private List requests; + private Queue responses; + + public MockCatalogServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void listCatalogs( + ListCatalogsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListCatalogsResponse) { + requests.add(request); + responseObserver.onNext(((ListCatalogsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateCatalog( + UpdateCatalogRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Catalog) { + requests.add(request); + responseObserver.onNext(((Catalog) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockPredictionService.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockPredictionService.java new file mode 100644 index 00000000..ad00ed7a --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockPredictionService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockPredictionService implements MockGrpcService { + private final MockPredictionServiceImpl serviceImpl; + + public MockPredictionService() { + serviceImpl = new MockPredictionServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockPredictionServiceImpl.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockPredictionServiceImpl.java new file mode 100644 index 00000000..6c627fe8 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockPredictionServiceImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.retail.v2.PredictionServiceGrpc.PredictionServiceImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockPredictionServiceImpl extends PredictionServiceImplBase { + private List requests; + private Queue responses; + + public MockPredictionServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void predict(PredictRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof PredictResponse) { + requests.add(request); + responseObserver.onNext(((PredictResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockProductService.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockProductService.java new file mode 100644 index 00000000..123af448 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockProductService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockProductService implements MockGrpcService { + private final MockProductServiceImpl serviceImpl; + + public MockProductService() { + serviceImpl = new MockProductServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockProductServiceImpl.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockProductServiceImpl.java new file mode 100644 index 00000000..54025bba --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockProductServiceImpl.java @@ -0,0 +1,135 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.retail.v2.ProductServiceGrpc.ProductServiceImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockProductServiceImpl extends ProductServiceImplBase { + private List requests; + private Queue responses; + + public MockProductServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createProduct( + CreateProductRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Product) { + requests.add(request); + responseObserver.onNext(((Product) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getProduct(GetProductRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Product) { + requests.add(request); + responseObserver.onNext(((Product) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateProduct( + UpdateProductRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Product) { + requests.add(request); + responseObserver.onNext(((Product) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteProduct(DeleteProductRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void importProducts( + ImportProductsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockUserEventService.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockUserEventService.java new file mode 100644 index 00000000..6283da76 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockUserEventService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockUserEventService implements MockGrpcService { + private final MockUserEventServiceImpl serviceImpl; + + public MockUserEventService() { + serviceImpl = new MockUserEventServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockUserEventServiceImpl.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockUserEventServiceImpl.java new file mode 100644 index 00000000..179819a4 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockUserEventServiceImpl.java @@ -0,0 +1,137 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.HttpBody; +import com.google.api.core.BetaApi; +import com.google.cloud.retail.v2.UserEventServiceGrpc.UserEventServiceImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockUserEventServiceImpl extends UserEventServiceImplBase { + private List requests; + private Queue responses; + + public MockUserEventServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void writeUserEvent( + WriteUserEventRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof UserEvent) { + requests.add(request); + responseObserver.onNext(((UserEvent) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void collectUserEvent( + CollectUserEventRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof HttpBody) { + requests.add(request); + responseObserver.onNext(((HttpBody) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void purgeUserEvents( + PurgeUserEventsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void importUserEvents( + ImportUserEventsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void rejoinUserEvents( + RejoinUserEventsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/PredictionServiceClientTest.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/PredictionServiceClientTest.java new file mode 100644 index 00000000..78be2792 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/PredictionServiceClientTest.java @@ -0,0 +1,148 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Value; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class PredictionServiceClientTest { + private static MockServiceHelper mockServiceHelper; + private PredictionServiceClient client; + private static MockPredictionService mockPredictionService; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockPredictionService = new MockPredictionService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockPredictionService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + PredictionServiceSettings settings = + PredictionServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = PredictionServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void predictTest() throws Exception { + PredictResponse expectedResponse = + PredictResponse.newBuilder() + .addAllResults(new ArrayList()) + .setAttributionToken("attributionToken104706234") + .addAllMissingIds(new ArrayList()) + .setValidateOnly(true) + .build(); + mockPredictionService.addResponse(expectedResponse); + + PredictRequest request = + PredictRequest.newBuilder() + .setPlacement("placement1792938725") + .setUserEvent(UserEvent.newBuilder().build()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setValidateOnly(true) + .putAllParams(new HashMap()) + .putAllLabels(new HashMap()) + .build(); + + PredictResponse actualResponse = client.predict(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPredictionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PredictRequest actualRequest = ((PredictRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getPlacement(), actualRequest.getPlacement()); + Assert.assertEquals(request.getUserEvent(), actualRequest.getUserEvent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getValidateOnly(), actualRequest.getValidateOnly()); + Assert.assertEquals(request.getParamsMap(), actualRequest.getParamsMap()); + Assert.assertEquals(request.getLabelsMap(), actualRequest.getLabelsMap()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void predictExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPredictionService.addException(exception); + + try { + PredictRequest request = + PredictRequest.newBuilder() + .setPlacement("placement1792938725") + .setUserEvent(UserEvent.newBuilder().build()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setValidateOnly(true) + .putAllParams(new HashMap()) + .putAllLabels(new HashMap()) + .build(); + client.predict(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientTest.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientTest.java new file mode 100644 index 00000000..6540fde8 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientTest.java @@ -0,0 +1,497 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Int32Value; +import com.google.protobuf.Timestamp; +import com.google.rpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ProductServiceClientTest { + private static MockProductService mockProductService; + private static MockServiceHelper mockServiceHelper; + private ProductServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockProductService = new MockProductService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockProductService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + ProductServiceSettings settings = + ProductServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ProductServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createProductTest() throws Exception { + Product expectedResponse = + Product.newBuilder() + .setName( + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") + .toString()) + .setId("id3355") + .setPrimaryProductId("primaryProductId-857339256") + .addAllCategories(new ArrayList()) + .setTitle("title110371416") + .setDescription("description-1724546052") + .putAllAttributes(new HashMap()) + .addAllTags(new ArrayList()) + .setPriceInfo(PriceInfo.newBuilder().build()) + .setAvailableTime(Timestamp.newBuilder().build()) + .setAvailableQuantity(Int32Value.newBuilder().build()) + .setUri("uri116076") + .addAllImages(new ArrayList()) + .build(); + mockProductService.addResponse(expectedResponse); + + BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"); + Product product = Product.newBuilder().build(); + String productId = "productId-1051830678"; + + Product actualResponse = client.createProduct(parent, product, productId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateProductRequest actualRequest = ((CreateProductRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(product, actualRequest.getProduct()); + Assert.assertEquals(productId, actualRequest.getProductId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createProductExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"); + Product product = Product.newBuilder().build(); + String productId = "productId-1051830678"; + client.createProduct(parent, product, productId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createProductTest2() throws Exception { + Product expectedResponse = + Product.newBuilder() + .setName( + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") + .toString()) + .setId("id3355") + .setPrimaryProductId("primaryProductId-857339256") + .addAllCategories(new ArrayList()) + .setTitle("title110371416") + .setDescription("description-1724546052") + .putAllAttributes(new HashMap()) + .addAllTags(new ArrayList()) + .setPriceInfo(PriceInfo.newBuilder().build()) + .setAvailableTime(Timestamp.newBuilder().build()) + .setAvailableQuantity(Int32Value.newBuilder().build()) + .setUri("uri116076") + .addAllImages(new ArrayList()) + .build(); + mockProductService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Product product = Product.newBuilder().build(); + String productId = "productId-1051830678"; + + Product actualResponse = client.createProduct(parent, product, productId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateProductRequest actualRequest = ((CreateProductRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(product, actualRequest.getProduct()); + Assert.assertEquals(productId, actualRequest.getProductId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createProductExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + String parent = "parent-995424086"; + Product product = Product.newBuilder().build(); + String productId = "productId-1051830678"; + client.createProduct(parent, product, productId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getProductTest() throws Exception { + Product expectedResponse = + Product.newBuilder() + .setName( + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") + .toString()) + .setId("id3355") + .setPrimaryProductId("primaryProductId-857339256") + .addAllCategories(new ArrayList()) + .setTitle("title110371416") + .setDescription("description-1724546052") + .putAllAttributes(new HashMap()) + .addAllTags(new ArrayList()) + .setPriceInfo(PriceInfo.newBuilder().build()) + .setAvailableTime(Timestamp.newBuilder().build()) + .setAvailableQuantity(Int32Value.newBuilder().build()) + .setUri("uri116076") + .addAllImages(new ArrayList()) + .build(); + mockProductService.addResponse(expectedResponse); + + ProductName name = + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); + + Product actualResponse = client.getProduct(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetProductRequest actualRequest = ((GetProductRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getProductExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + ProductName name = + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); + client.getProduct(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getProductTest2() throws Exception { + Product expectedResponse = + Product.newBuilder() + .setName( + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") + .toString()) + .setId("id3355") + .setPrimaryProductId("primaryProductId-857339256") + .addAllCategories(new ArrayList()) + .setTitle("title110371416") + .setDescription("description-1724546052") + .putAllAttributes(new HashMap()) + .addAllTags(new ArrayList()) + .setPriceInfo(PriceInfo.newBuilder().build()) + .setAvailableTime(Timestamp.newBuilder().build()) + .setAvailableQuantity(Int32Value.newBuilder().build()) + .setUri("uri116076") + .addAllImages(new ArrayList()) + .build(); + mockProductService.addResponse(expectedResponse); + + String name = "name3373707"; + + Product actualResponse = client.getProduct(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetProductRequest actualRequest = ((GetProductRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getProductExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + String name = "name3373707"; + client.getProduct(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateProductTest() throws Exception { + Product expectedResponse = + Product.newBuilder() + .setName( + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") + .toString()) + .setId("id3355") + .setPrimaryProductId("primaryProductId-857339256") + .addAllCategories(new ArrayList()) + .setTitle("title110371416") + .setDescription("description-1724546052") + .putAllAttributes(new HashMap()) + .addAllTags(new ArrayList()) + .setPriceInfo(PriceInfo.newBuilder().build()) + .setAvailableTime(Timestamp.newBuilder().build()) + .setAvailableQuantity(Int32Value.newBuilder().build()) + .setUri("uri116076") + .addAllImages(new ArrayList()) + .build(); + mockProductService.addResponse(expectedResponse); + + Product product = Product.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Product actualResponse = client.updateProduct(product, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateProductRequest actualRequest = ((UpdateProductRequest) actualRequests.get(0)); + + Assert.assertEquals(product, actualRequest.getProduct()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateProductExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + Product product = Product.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateProduct(product, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteProductTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockProductService.addResponse(expectedResponse); + + ProductName name = + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); + + client.deleteProduct(name); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteProductRequest actualRequest = ((DeleteProductRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteProductExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + ProductName name = + ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); + client.deleteProduct(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteProductTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockProductService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteProduct(name); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteProductRequest actualRequest = ((DeleteProductRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteProductExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + String name = "name3373707"; + client.deleteProduct(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void importProductsTest() throws Exception { + ImportProductsResponse expectedResponse = + ImportProductsResponse.newBuilder() + .addAllErrorSamples(new ArrayList()) + .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("importProductsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockProductService.addResponse(resultOperation); + + ImportProductsRequest request = + ImportProductsRequest.newBuilder() + .setParent("parent-995424086") + .setInputConfig(ProductInputConfig.newBuilder().build()) + .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + ImportProductsResponse actualResponse = client.importProductsAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockProductService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ImportProductsRequest actualRequest = ((ImportProductsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getInputConfig(), actualRequest.getInputConfig()); + Assert.assertEquals(request.getErrorsConfig(), actualRequest.getErrorsConfig()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void importProductsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockProductService.addException(exception); + + try { + ImportProductsRequest request = + ImportProductsRequest.newBuilder() + .setParent("parent-995424086") + .setInputConfig(ProductInputConfig.newBuilder().build()) + .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.importProductsAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/UserEventServiceClientTest.java b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/UserEventServiceClientTest.java new file mode 100644 index 00000000..b4c1a349 --- /dev/null +++ b/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/UserEventServiceClientTest.java @@ -0,0 +1,366 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.HttpBody; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +import com.google.protobuf.Timestamp; +import com.google.rpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class UserEventServiceClientTest { + private static MockServiceHelper mockServiceHelper; + private UserEventServiceClient client; + private static MockUserEventService mockUserEventService; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockUserEventService = new MockUserEventService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockUserEventService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + UserEventServiceSettings settings = + UserEventServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = UserEventServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void writeUserEventTest() throws Exception { + UserEvent expectedResponse = + UserEvent.newBuilder() + .setEventType("eventType31430900") + .setVisitorId("visitorId1880545833") + .setEventTime(Timestamp.newBuilder().build()) + .addAllExperimentIds(new ArrayList()) + .setAttributionToken("attributionToken104706234") + .addAllProductDetails(new ArrayList()) + .putAllAttributes(new HashMap()) + .setCartId("cartId-1367589797") + .setPurchaseTransaction(PurchaseTransaction.newBuilder().build()) + .setSearchQuery("searchQuery-552137728") + .addAllPageCategories(new ArrayList()) + .setUserInfo(UserInfo.newBuilder().build()) + .setUri("uri116076") + .setReferrerUri("referrerUri348088525") + .setPageViewId("pageViewId1362499087") + .build(); + mockUserEventService.addResponse(expectedResponse); + + WriteUserEventRequest request = + WriteUserEventRequest.newBuilder() + .setParent("parent-995424086") + .setUserEvent(UserEvent.newBuilder().build()) + .build(); + + UserEvent actualResponse = client.writeUserEvent(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUserEventService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + WriteUserEventRequest actualRequest = ((WriteUserEventRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getUserEvent(), actualRequest.getUserEvent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void writeUserEventExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockUserEventService.addException(exception); + + try { + WriteUserEventRequest request = + WriteUserEventRequest.newBuilder() + .setParent("parent-995424086") + .setUserEvent(UserEvent.newBuilder().build()) + .build(); + client.writeUserEvent(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void collectUserEventTest() throws Exception { + HttpBody expectedResponse = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + mockUserEventService.addResponse(expectedResponse); + + CollectUserEventRequest request = + CollectUserEventRequest.newBuilder() + .setParent("parent-995424086") + .setUserEvent("userEvent315571599") + .setUri("uri116076") + .setEts(100772) + .build(); + + HttpBody actualResponse = client.collectUserEvent(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUserEventService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CollectUserEventRequest actualRequest = ((CollectUserEventRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getUserEvent(), actualRequest.getUserEvent()); + Assert.assertEquals(request.getUri(), actualRequest.getUri()); + Assert.assertEquals(request.getEts(), actualRequest.getEts()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void collectUserEventExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockUserEventService.addException(exception); + + try { + CollectUserEventRequest request = + CollectUserEventRequest.newBuilder() + .setParent("parent-995424086") + .setUserEvent("userEvent315571599") + .setUri("uri116076") + .setEts(100772) + .build(); + client.collectUserEvent(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void purgeUserEventsTest() throws Exception { + PurgeUserEventsResponse expectedResponse = + PurgeUserEventsResponse.newBuilder().setPurgedEventsCount(-310774833).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("purgeUserEventsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockUserEventService.addResponse(resultOperation); + + PurgeUserEventsRequest request = + PurgeUserEventsRequest.newBuilder() + .setParent("parent-995424086") + .setFilter("filter-1274492040") + .setForce(true) + .build(); + + PurgeUserEventsResponse actualResponse = client.purgeUserEventsAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUserEventService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PurgeUserEventsRequest actualRequest = ((PurgeUserEventsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getForce(), actualRequest.getForce()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void purgeUserEventsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockUserEventService.addException(exception); + + try { + PurgeUserEventsRequest request = + PurgeUserEventsRequest.newBuilder() + .setParent("parent-995424086") + .setFilter("filter-1274492040") + .setForce(true) + .build(); + client.purgeUserEventsAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void importUserEventsTest() throws Exception { + ImportUserEventsResponse expectedResponse = + ImportUserEventsResponse.newBuilder() + .addAllErrorSamples(new ArrayList()) + .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) + .setImportSummary(UserEventImportSummary.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("importUserEventsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockUserEventService.addResponse(resultOperation); + + ImportUserEventsRequest request = + ImportUserEventsRequest.newBuilder() + .setParent("parent-995424086") + .setInputConfig(UserEventInputConfig.newBuilder().build()) + .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) + .build(); + + ImportUserEventsResponse actualResponse = client.importUserEventsAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUserEventService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ImportUserEventsRequest actualRequest = ((ImportUserEventsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getInputConfig(), actualRequest.getInputConfig()); + Assert.assertEquals(request.getErrorsConfig(), actualRequest.getErrorsConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void importUserEventsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockUserEventService.addException(exception); + + try { + ImportUserEventsRequest request = + ImportUserEventsRequest.newBuilder() + .setParent("parent-995424086") + .setInputConfig(UserEventInputConfig.newBuilder().build()) + .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) + .build(); + client.importUserEventsAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void rejoinUserEventsTest() throws Exception { + RejoinUserEventsResponse expectedResponse = + RejoinUserEventsResponse.newBuilder().setRejoinedUserEventsCount(-1152281574).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("rejoinUserEventsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockUserEventService.addResponse(resultOperation); + + RejoinUserEventsRequest request = + RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build(); + + RejoinUserEventsResponse actualResponse = client.rejoinUserEventsAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUserEventService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RejoinUserEventsRequest actualRequest = ((RejoinUserEventsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getUserEventRejoinScope(), actualRequest.getUserEventRejoinScope()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void rejoinUserEventsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockUserEventService.addException(exception); + + try { + RejoinUserEventsRequest request = + RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build(); + client.rejoinUserEventsAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/grpc-google-cloud-retail-v2/pom.xml b/grpc-google-cloud-retail-v2/pom.xml new file mode 100644 index 00000000..5f10645d --- /dev/null +++ b/grpc-google-cloud-retail-v2/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-retail-v2 + 0.0.1-SNAPSHOT + grpc-google-cloud-retail-v2 + GRPC library for google-cloud-retail + + com.google.cloud + google-cloud-retail-parent + 0.0.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-cloud-retail-v2 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogServiceGrpc.java b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogServiceGrpc.java new file mode 100644 index 00000000..d1a80ce0 --- /dev/null +++ b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogServiceGrpc.java @@ -0,0 +1,476 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Service for managing catalog configuration.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/retail/v2/catalog_service.proto") +public final class CatalogServiceGrpc { + + private CatalogServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.retail.v2.CatalogService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListCatalogsRequest, + com.google.cloud.retail.v2.ListCatalogsResponse> + getListCatalogsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListCatalogs", + requestType = com.google.cloud.retail.v2.ListCatalogsRequest.class, + responseType = com.google.cloud.retail.v2.ListCatalogsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListCatalogsRequest, + com.google.cloud.retail.v2.ListCatalogsResponse> + getListCatalogsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListCatalogsRequest, + com.google.cloud.retail.v2.ListCatalogsResponse> + getListCatalogsMethod; + if ((getListCatalogsMethod = CatalogServiceGrpc.getListCatalogsMethod) == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getListCatalogsMethod = CatalogServiceGrpc.getListCatalogsMethod) == null) { + CatalogServiceGrpc.getListCatalogsMethod = + getListCatalogsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListCatalogs")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ListCatalogsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ListCatalogsResponse.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("ListCatalogs")) + .build(); + } + } + } + return getListCatalogsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateCatalogRequest, com.google.cloud.retail.v2.Catalog> + getUpdateCatalogMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateCatalog", + requestType = com.google.cloud.retail.v2.UpdateCatalogRequest.class, + responseType = com.google.cloud.retail.v2.Catalog.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateCatalogRequest, com.google.cloud.retail.v2.Catalog> + getUpdateCatalogMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateCatalogRequest, com.google.cloud.retail.v2.Catalog> + getUpdateCatalogMethod; + if ((getUpdateCatalogMethod = CatalogServiceGrpc.getUpdateCatalogMethod) == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getUpdateCatalogMethod = CatalogServiceGrpc.getUpdateCatalogMethod) == null) { + CatalogServiceGrpc.getUpdateCatalogMethod = + getUpdateCatalogMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateCatalog")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.UpdateCatalogRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.Catalog.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("UpdateCatalog")) + .build(); + } + } + } + return getUpdateCatalogMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static CatalogServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public CatalogServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CatalogServiceStub(channel, callOptions); + } + }; + return CatalogServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static CatalogServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public CatalogServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CatalogServiceBlockingStub(channel, callOptions); + } + }; + return CatalogServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static CatalogServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public CatalogServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CatalogServiceFutureStub(channel, callOptions); + } + }; + return CatalogServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service for managing catalog configuration.
+   * 
+ */ + public abstract static class CatalogServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with
+     * the project.
+     * 
+ */ + public void listCatalogs( + com.google.cloud.retail.v2.ListCatalogsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListCatalogsMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ */ + public void updateCatalog( + com.google.cloud.retail.v2.UpdateCatalogRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getUpdateCatalogMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getListCatalogsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.ListCatalogsRequest, + com.google.cloud.retail.v2.ListCatalogsResponse>( + this, METHODID_LIST_CATALOGS))) + .addMethod( + getUpdateCatalogMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.UpdateCatalogRequest, + com.google.cloud.retail.v2.Catalog>(this, METHODID_UPDATE_CATALOG))) + .build(); + } + } + + /** + * + * + *
+   * Service for managing catalog configuration.
+   * 
+ */ + public static final class CatalogServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private CatalogServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CatalogServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CatalogServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with
+     * the project.
+     * 
+ */ + public void listCatalogs( + com.google.cloud.retail.v2.ListCatalogsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListCatalogsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ */ + public void updateCatalog( + com.google.cloud.retail.v2.UpdateCatalogRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateCatalogMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service for managing catalog configuration.
+   * 
+ */ + public static final class CatalogServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private CatalogServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CatalogServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CatalogServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with
+     * the project.
+     * 
+ */ + public com.google.cloud.retail.v2.ListCatalogsResponse listCatalogs( + com.google.cloud.retail.v2.ListCatalogsRequest request) { + return blockingUnaryCall(getChannel(), getListCatalogsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ */ + public com.google.cloud.retail.v2.Catalog updateCatalog( + com.google.cloud.retail.v2.UpdateCatalogRequest request) { + return blockingUnaryCall(getChannel(), getUpdateCatalogMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service for managing catalog configuration.
+   * 
+ */ + public static final class CatalogServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private CatalogServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CatalogServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CatalogServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with
+     * the project.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ListCatalogsResponse> + listCatalogs(com.google.cloud.retail.v2.ListCatalogsRequest request) { + return futureUnaryCall( + getChannel().newCall(getListCatalogsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateCatalog(com.google.cloud.retail.v2.UpdateCatalogRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateCatalogMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_LIST_CATALOGS = 0; + private static final int METHODID_UPDATE_CATALOG = 1; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final CatalogServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(CatalogServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_LIST_CATALOGS: + serviceImpl.listCatalogs( + (com.google.cloud.retail.v2.ListCatalogsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_CATALOG: + serviceImpl.updateCatalog( + (com.google.cloud.retail.v2.UpdateCatalogRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class CatalogServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + CatalogServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("CatalogService"); + } + } + + private static final class CatalogServiceFileDescriptorSupplier + extends CatalogServiceBaseDescriptorSupplier { + CatalogServiceFileDescriptorSupplier() {} + } + + private static final class CatalogServiceMethodDescriptorSupplier + extends CatalogServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + CatalogServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (CatalogServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new CatalogServiceFileDescriptorSupplier()) + .addMethod(getListCatalogsMethod()) + .addMethod(getUpdateCatalogMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictionServiceGrpc.java b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictionServiceGrpc.java new file mode 100644 index 00000000..1548b2d3 --- /dev/null +++ b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictionServiceGrpc.java @@ -0,0 +1,355 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Service for making recommendation prediction.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/retail/v2/prediction_service.proto") +public final class PredictionServiceGrpc { + + private PredictionServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.retail.v2.PredictionService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.PredictRequest, com.google.cloud.retail.v2.PredictResponse> + getPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "Predict", + requestType = com.google.cloud.retail.v2.PredictRequest.class, + responseType = com.google.cloud.retail.v2.PredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.PredictRequest, com.google.cloud.retail.v2.PredictResponse> + getPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.PredictRequest, com.google.cloud.retail.v2.PredictResponse> + getPredictMethod; + if ((getPredictMethod = PredictionServiceGrpc.getPredictMethod) == null) { + synchronized (PredictionServiceGrpc.class) { + if ((getPredictMethod = PredictionServiceGrpc.getPredictMethod) == null) { + PredictionServiceGrpc.getPredictMethod = + getPredictMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Predict")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.PredictRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.PredictResponse.getDefaultInstance())) + .setSchemaDescriptor(new PredictionServiceMethodDescriptorSupplier("Predict")) + .build(); + } + } + } + return getPredictMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static PredictionServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PredictionServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PredictionServiceStub(channel, callOptions); + } + }; + return PredictionServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static PredictionServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PredictionServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PredictionServiceBlockingStub(channel, callOptions); + } + }; + return PredictionServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static PredictionServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PredictionServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PredictionServiceFutureStub(channel, callOptions); + } + }; + return PredictionServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service for making recommendation prediction.
+   * 
+ */ + public abstract static class PredictionServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Makes a recommendation prediction.
+     * 
+ */ + public void predict( + com.google.cloud.retail.v2.PredictRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getPredictMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getPredictMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.PredictRequest, + com.google.cloud.retail.v2.PredictResponse>(this, METHODID_PREDICT))) + .build(); + } + } + + /** + * + * + *
+   * Service for making recommendation prediction.
+   * 
+ */ + public static final class PredictionServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private PredictionServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PredictionServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PredictionServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Makes a recommendation prediction.
+     * 
+ */ + public void predict( + com.google.cloud.retail.v2.PredictRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getPredictMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * + * + *
+   * Service for making recommendation prediction.
+   * 
+ */ + public static final class PredictionServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private PredictionServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PredictionServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PredictionServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Makes a recommendation prediction.
+     * 
+ */ + public com.google.cloud.retail.v2.PredictResponse predict( + com.google.cloud.retail.v2.PredictRequest request) { + return blockingUnaryCall(getChannel(), getPredictMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service for making recommendation prediction.
+   * 
+ */ + public static final class PredictionServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private PredictionServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PredictionServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PredictionServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Makes a recommendation prediction.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.PredictResponse> + predict(com.google.cloud.retail.v2.PredictRequest request) { + return futureUnaryCall(getChannel().newCall(getPredictMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_PREDICT = 0; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final PredictionServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(PredictionServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_PREDICT: + serviceImpl.predict( + (com.google.cloud.retail.v2.PredictRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class PredictionServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + PredictionServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.retail.v2.PredictionServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("PredictionService"); + } + } + + private static final class PredictionServiceFileDescriptorSupplier + extends PredictionServiceBaseDescriptorSupplier { + PredictionServiceFileDescriptorSupplier() {} + } + + private static final class PredictionServiceMethodDescriptorSupplier + extends PredictionServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + PredictionServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (PredictionServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new PredictionServiceFileDescriptorSupplier()) + .addMethod(getPredictMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductServiceGrpc.java b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductServiceGrpc.java new file mode 100644 index 00000000..33272d71 --- /dev/null +++ b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductServiceGrpc.java @@ -0,0 +1,809 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Service for ingesting [Product][google.cloud.retail.v2.Product] information
+ * of the customer's website.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/retail/v2/product_service.proto") +public final class ProductServiceGrpc { + + private ProductServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.retail.v2.ProductService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateProductRequest, com.google.cloud.retail.v2.Product> + getCreateProductMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateProduct", + requestType = com.google.cloud.retail.v2.CreateProductRequest.class, + responseType = com.google.cloud.retail.v2.Product.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateProductRequest, com.google.cloud.retail.v2.Product> + getCreateProductMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateProductRequest, com.google.cloud.retail.v2.Product> + getCreateProductMethod; + if ((getCreateProductMethod = ProductServiceGrpc.getCreateProductMethod) == null) { + synchronized (ProductServiceGrpc.class) { + if ((getCreateProductMethod = ProductServiceGrpc.getCreateProductMethod) == null) { + ProductServiceGrpc.getCreateProductMethod = + getCreateProductMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateProduct")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.CreateProductRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.Product.getDefaultInstance())) + .setSchemaDescriptor( + new ProductServiceMethodDescriptorSupplier("CreateProduct")) + .build(); + } + } + } + return getCreateProductMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetProductRequest, com.google.cloud.retail.v2.Product> + getGetProductMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetProduct", + requestType = com.google.cloud.retail.v2.GetProductRequest.class, + responseType = com.google.cloud.retail.v2.Product.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetProductRequest, com.google.cloud.retail.v2.Product> + getGetProductMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetProductRequest, com.google.cloud.retail.v2.Product> + getGetProductMethod; + if ((getGetProductMethod = ProductServiceGrpc.getGetProductMethod) == null) { + synchronized (ProductServiceGrpc.class) { + if ((getGetProductMethod = ProductServiceGrpc.getGetProductMethod) == null) { + ProductServiceGrpc.getGetProductMethod = + getGetProductMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetProduct")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.GetProductRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.Product.getDefaultInstance())) + .setSchemaDescriptor(new ProductServiceMethodDescriptorSupplier("GetProduct")) + .build(); + } + } + } + return getGetProductMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateProductRequest, com.google.cloud.retail.v2.Product> + getUpdateProductMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateProduct", + requestType = com.google.cloud.retail.v2.UpdateProductRequest.class, + responseType = com.google.cloud.retail.v2.Product.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateProductRequest, com.google.cloud.retail.v2.Product> + getUpdateProductMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateProductRequest, com.google.cloud.retail.v2.Product> + getUpdateProductMethod; + if ((getUpdateProductMethod = ProductServiceGrpc.getUpdateProductMethod) == null) { + synchronized (ProductServiceGrpc.class) { + if ((getUpdateProductMethod = ProductServiceGrpc.getUpdateProductMethod) == null) { + ProductServiceGrpc.getUpdateProductMethod = + getUpdateProductMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateProduct")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.UpdateProductRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.Product.getDefaultInstance())) + .setSchemaDescriptor( + new ProductServiceMethodDescriptorSupplier("UpdateProduct")) + .build(); + } + } + } + return getUpdateProductMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteProductRequest, com.google.protobuf.Empty> + getDeleteProductMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteProduct", + requestType = com.google.cloud.retail.v2.DeleteProductRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteProductRequest, com.google.protobuf.Empty> + getDeleteProductMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteProductRequest, com.google.protobuf.Empty> + getDeleteProductMethod; + if ((getDeleteProductMethod = ProductServiceGrpc.getDeleteProductMethod) == null) { + synchronized (ProductServiceGrpc.class) { + if ((getDeleteProductMethod = ProductServiceGrpc.getDeleteProductMethod) == null) { + ProductServiceGrpc.getDeleteProductMethod = + getDeleteProductMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteProduct")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.DeleteProductRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new ProductServiceMethodDescriptorSupplier("DeleteProduct")) + .build(); + } + } + } + return getDeleteProductMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ImportProductsRequest, com.google.longrunning.Operation> + getImportProductsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ImportProducts", + requestType = com.google.cloud.retail.v2.ImportProductsRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ImportProductsRequest, com.google.longrunning.Operation> + getImportProductsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ImportProductsRequest, com.google.longrunning.Operation> + getImportProductsMethod; + if ((getImportProductsMethod = ProductServiceGrpc.getImportProductsMethod) == null) { + synchronized (ProductServiceGrpc.class) { + if ((getImportProductsMethod = ProductServiceGrpc.getImportProductsMethod) == null) { + ProductServiceGrpc.getImportProductsMethod = + getImportProductsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ImportProducts")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ImportProductsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new ProductServiceMethodDescriptorSupplier("ImportProducts")) + .build(); + } + } + } + return getImportProductsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static ProductServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ProductServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProductServiceStub(channel, callOptions); + } + }; + return ProductServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ProductServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ProductServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProductServiceBlockingStub(channel, callOptions); + } + }; + return ProductServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static ProductServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ProductServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProductServiceFutureStub(channel, callOptions); + } + }; + return ProductServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service for ingesting [Product][google.cloud.retail.v2.Product] information
+   * of the customer's website.
+   * 
+ */ + public abstract static class ProductServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void createProduct( + com.google.cloud.retail.v2.CreateProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateProductMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void getProduct( + com.google.cloud.retail.v2.GetProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetProductMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void updateProduct( + com.google.cloud.retail.v2.UpdateProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getUpdateProductMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void deleteProduct( + com.google.cloud.retail.v2.DeleteProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getDeleteProductMethod(), responseObserver); + } + + /** + * + * + *
+     * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
+     * Request processing may be synchronous. No partial updating is supported.
+     * Non-existing items are created.
+     * Note that it is possible for a subset of the
+     * [Product][google.cloud.retail.v2.Product]s to be successfully updated.
+     * 
+ */ + public void importProducts( + com.google.cloud.retail.v2.ImportProductsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getImportProductsMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateProductMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.CreateProductRequest, + com.google.cloud.retail.v2.Product>(this, METHODID_CREATE_PRODUCT))) + .addMethod( + getGetProductMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.GetProductRequest, + com.google.cloud.retail.v2.Product>(this, METHODID_GET_PRODUCT))) + .addMethod( + getUpdateProductMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.UpdateProductRequest, + com.google.cloud.retail.v2.Product>(this, METHODID_UPDATE_PRODUCT))) + .addMethod( + getDeleteProductMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.DeleteProductRequest, com.google.protobuf.Empty>( + this, METHODID_DELETE_PRODUCT))) + .addMethod( + getImportProductsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.ImportProductsRequest, + com.google.longrunning.Operation>(this, METHODID_IMPORT_PRODUCTS))) + .build(); + } + } + + /** + * + * + *
+   * Service for ingesting [Product][google.cloud.retail.v2.Product] information
+   * of the customer's website.
+   * 
+ */ + public static final class ProductServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private ProductServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ProductServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProductServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void createProduct( + com.google.cloud.retail.v2.CreateProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateProductMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void getProduct( + com.google.cloud.retail.v2.GetProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetProductMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Updates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void updateProduct( + com.google.cloud.retail.v2.UpdateProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateProductMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public void deleteProduct( + com.google.cloud.retail.v2.DeleteProductRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getDeleteProductMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
+     * Request processing may be synchronous. No partial updating is supported.
+     * Non-existing items are created.
+     * Note that it is possible for a subset of the
+     * [Product][google.cloud.retail.v2.Product]s to be successfully updated.
+     * 
+ */ + public void importProducts( + com.google.cloud.retail.v2.ImportProductsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getImportProductsMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service for ingesting [Product][google.cloud.retail.v2.Product] information
+   * of the customer's website.
+   * 
+ */ + public static final class ProductServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private ProductServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ProductServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProductServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.cloud.retail.v2.Product createProduct( + com.google.cloud.retail.v2.CreateProductRequest request) { + return blockingUnaryCall(getChannel(), getCreateProductMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.cloud.retail.v2.Product getProduct( + com.google.cloud.retail.v2.GetProductRequest request) { + return blockingUnaryCall(getChannel(), getGetProductMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.cloud.retail.v2.Product updateProduct( + com.google.cloud.retail.v2.UpdateProductRequest request) { + return blockingUnaryCall(getChannel(), getUpdateProductMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.protobuf.Empty deleteProduct( + com.google.cloud.retail.v2.DeleteProductRequest request) { + return blockingUnaryCall(getChannel(), getDeleteProductMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
+     * Request processing may be synchronous. No partial updating is supported.
+     * Non-existing items are created.
+     * Note that it is possible for a subset of the
+     * [Product][google.cloud.retail.v2.Product]s to be successfully updated.
+     * 
+ */ + public com.google.longrunning.Operation importProducts( + com.google.cloud.retail.v2.ImportProductsRequest request) { + return blockingUnaryCall(getChannel(), getImportProductsMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service for ingesting [Product][google.cloud.retail.v2.Product] information
+   * of the customer's website.
+   * 
+ */ + public static final class ProductServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private ProductServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ProductServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProductServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createProduct(com.google.cloud.retail.v2.CreateProductRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateProductMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getProduct(com.google.cloud.retail.v2.GetProductRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetProductMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateProduct(com.google.cloud.retail.v2.UpdateProductRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateProductMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a [Product][google.cloud.retail.v2.Product].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteProduct(com.google.cloud.retail.v2.DeleteProductRequest request) { + return futureUnaryCall( + getChannel().newCall(getDeleteProductMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
+     * Request processing may be synchronous. No partial updating is supported.
+     * Non-existing items are created.
+     * Note that it is possible for a subset of the
+     * [Product][google.cloud.retail.v2.Product]s to be successfully updated.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + importProducts(com.google.cloud.retail.v2.ImportProductsRequest request) { + return futureUnaryCall( + getChannel().newCall(getImportProductsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_PRODUCT = 0; + private static final int METHODID_GET_PRODUCT = 1; + private static final int METHODID_UPDATE_PRODUCT = 2; + private static final int METHODID_DELETE_PRODUCT = 3; + private static final int METHODID_IMPORT_PRODUCTS = 4; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final ProductServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(ProductServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_PRODUCT: + serviceImpl.createProduct( + (com.google.cloud.retail.v2.CreateProductRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_PRODUCT: + serviceImpl.getProduct( + (com.google.cloud.retail.v2.GetProductRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_PRODUCT: + serviceImpl.updateProduct( + (com.google.cloud.retail.v2.UpdateProductRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_PRODUCT: + serviceImpl.deleteProduct( + (com.google.cloud.retail.v2.DeleteProductRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_IMPORT_PRODUCTS: + serviceImpl.importProducts( + (com.google.cloud.retail.v2.ImportProductsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class ProductServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ProductServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("ProductService"); + } + } + + private static final class ProductServiceFileDescriptorSupplier + extends ProductServiceBaseDescriptorSupplier { + ProductServiceFileDescriptorSupplier() {} + } + + private static final class ProductServiceMethodDescriptorSupplier + extends ProductServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ProductServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (ProductServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ProductServiceFileDescriptorSupplier()) + .addMethod(getCreateProductMethod()) + .addMethod(getGetProductMethod()) + .addMethod(getUpdateProductMethod()) + .addMethod(getDeleteProductMethod()) + .addMethod(getImportProductsMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventServiceGrpc.java b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventServiceGrpc.java new file mode 100644 index 00000000..827caba3 --- /dev/null +++ b/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventServiceGrpc.java @@ -0,0 +1,866 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Service for ingesting end user actions on the customer website.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/retail/v2/user_event_service.proto") +public final class UserEventServiceGrpc { + + private UserEventServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.retail.v2.UserEventService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.WriteUserEventRequest, com.google.cloud.retail.v2.UserEvent> + getWriteUserEventMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "WriteUserEvent", + requestType = com.google.cloud.retail.v2.WriteUserEventRequest.class, + responseType = com.google.cloud.retail.v2.UserEvent.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.WriteUserEventRequest, com.google.cloud.retail.v2.UserEvent> + getWriteUserEventMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.WriteUserEventRequest, com.google.cloud.retail.v2.UserEvent> + getWriteUserEventMethod; + if ((getWriteUserEventMethod = UserEventServiceGrpc.getWriteUserEventMethod) == null) { + synchronized (UserEventServiceGrpc.class) { + if ((getWriteUserEventMethod = UserEventServiceGrpc.getWriteUserEventMethod) == null) { + UserEventServiceGrpc.getWriteUserEventMethod = + getWriteUserEventMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "WriteUserEvent")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.WriteUserEventRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.UserEvent.getDefaultInstance())) + .setSchemaDescriptor( + new UserEventServiceMethodDescriptorSupplier("WriteUserEvent")) + .build(); + } + } + } + return getWriteUserEventMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CollectUserEventRequest, com.google.api.HttpBody> + getCollectUserEventMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CollectUserEvent", + requestType = com.google.cloud.retail.v2.CollectUserEventRequest.class, + responseType = com.google.api.HttpBody.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CollectUserEventRequest, com.google.api.HttpBody> + getCollectUserEventMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CollectUserEventRequest, com.google.api.HttpBody> + getCollectUserEventMethod; + if ((getCollectUserEventMethod = UserEventServiceGrpc.getCollectUserEventMethod) == null) { + synchronized (UserEventServiceGrpc.class) { + if ((getCollectUserEventMethod = UserEventServiceGrpc.getCollectUserEventMethod) == null) { + UserEventServiceGrpc.getCollectUserEventMethod = + getCollectUserEventMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CollectUserEvent")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.CollectUserEventRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setSchemaDescriptor( + new UserEventServiceMethodDescriptorSupplier("CollectUserEvent")) + .build(); + } + } + } + return getCollectUserEventMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.PurgeUserEventsRequest, com.google.longrunning.Operation> + getPurgeUserEventsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "PurgeUserEvents", + requestType = com.google.cloud.retail.v2.PurgeUserEventsRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.PurgeUserEventsRequest, com.google.longrunning.Operation> + getPurgeUserEventsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.PurgeUserEventsRequest, com.google.longrunning.Operation> + getPurgeUserEventsMethod; + if ((getPurgeUserEventsMethod = UserEventServiceGrpc.getPurgeUserEventsMethod) == null) { + synchronized (UserEventServiceGrpc.class) { + if ((getPurgeUserEventsMethod = UserEventServiceGrpc.getPurgeUserEventsMethod) == null) { + UserEventServiceGrpc.getPurgeUserEventsMethod = + getPurgeUserEventsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "PurgeUserEvents")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.PurgeUserEventsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new UserEventServiceMethodDescriptorSupplier("PurgeUserEvents")) + .build(); + } + } + } + return getPurgeUserEventsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ImportUserEventsRequest, com.google.longrunning.Operation> + getImportUserEventsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ImportUserEvents", + requestType = com.google.cloud.retail.v2.ImportUserEventsRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ImportUserEventsRequest, com.google.longrunning.Operation> + getImportUserEventsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ImportUserEventsRequest, com.google.longrunning.Operation> + getImportUserEventsMethod; + if ((getImportUserEventsMethod = UserEventServiceGrpc.getImportUserEventsMethod) == null) { + synchronized (UserEventServiceGrpc.class) { + if ((getImportUserEventsMethod = UserEventServiceGrpc.getImportUserEventsMethod) == null) { + UserEventServiceGrpc.getImportUserEventsMethod = + getImportUserEventsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ImportUserEvents")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ImportUserEventsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new UserEventServiceMethodDescriptorSupplier("ImportUserEvents")) + .build(); + } + } + } + return getImportUserEventsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RejoinUserEventsRequest, com.google.longrunning.Operation> + getRejoinUserEventsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "RejoinUserEvents", + requestType = com.google.cloud.retail.v2.RejoinUserEventsRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RejoinUserEventsRequest, com.google.longrunning.Operation> + getRejoinUserEventsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RejoinUserEventsRequest, com.google.longrunning.Operation> + getRejoinUserEventsMethod; + if ((getRejoinUserEventsMethod = UserEventServiceGrpc.getRejoinUserEventsMethod) == null) { + synchronized (UserEventServiceGrpc.class) { + if ((getRejoinUserEventsMethod = UserEventServiceGrpc.getRejoinUserEventsMethod) == null) { + UserEventServiceGrpc.getRejoinUserEventsMethod = + getRejoinUserEventsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "RejoinUserEvents")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.RejoinUserEventsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new UserEventServiceMethodDescriptorSupplier("RejoinUserEvents")) + .build(); + } + } + } + return getRejoinUserEventsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static UserEventServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public UserEventServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new UserEventServiceStub(channel, callOptions); + } + }; + return UserEventServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static UserEventServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public UserEventServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new UserEventServiceBlockingStub(channel, callOptions); + } + }; + return UserEventServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static UserEventServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public UserEventServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new UserEventServiceFutureStub(channel, callOptions); + } + }; + return UserEventServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service for ingesting end user actions on the customer website.
+   * 
+ */ + public abstract static class UserEventServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Writes a single user event.
+     * 
+ */ + public void writeUserEvent( + com.google.cloud.retail.v2.WriteUserEventRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getWriteUserEventMethod(), responseObserver); + } + + /** + * + * + *
+     * Writes a single user event from the browser. This uses a GET request to
+     * due to browser restriction of POST-ing to a 3rd party domain.
+     * This method is used only by the Retail API JavaScript pixel and Google Tag
+     * Manager. Users should not call this method directly.
+     * 
+ */ + public void collectUserEvent( + com.google.cloud.retail.v2.CollectUserEventRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCollectUserEventMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes permanently all user events specified by the filter provided.
+     * Depending on the number of events specified by the filter, this operation
+     * could take hours or days to complete. To test a filter, use the list
+     * command first.
+     * 
+ */ + public void purgeUserEvents( + com.google.cloud.retail.v2.PurgeUserEventsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getPurgeUserEventsMethod(), responseObserver); + } + + /** + * + * + *
+     * Bulk import of User events. Request processing might be
+     * synchronous. Events that already exist are skipped.
+     * Use this method for backfilling historical user events.
+     * Operation.response is of type ImportResponse. Note that it is
+     * possible for a subset of the items to be successfully inserted.
+     * Operation.metadata is of type ImportMetadata.
+     * 
+ */ + public void importUserEvents( + com.google.cloud.retail.v2.ImportUserEventsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getImportUserEventsMethod(), responseObserver); + } + + /** + * + * + *
+     * Triggers a user event rejoin operation with latest product catalog. Events
+     * will not be annotated with detailed product information if product is
+     * missing from the catalog at the time the user event is ingested, and these
+     * events are stored as unjoined events with a limited usage on training and
+     * serving. This API can be used to trigger a 'join' operation on specified
+     * events with latest version of product catalog. It can also be used to
+     * correct events joined with wrong product catalog.
+     * 
+ */ + public void rejoinUserEvents( + com.google.cloud.retail.v2.RejoinUserEventsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getRejoinUserEventsMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getWriteUserEventMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.WriteUserEventRequest, + com.google.cloud.retail.v2.UserEvent>(this, METHODID_WRITE_USER_EVENT))) + .addMethod( + getCollectUserEventMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.CollectUserEventRequest, com.google.api.HttpBody>( + this, METHODID_COLLECT_USER_EVENT))) + .addMethod( + getPurgeUserEventsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.PurgeUserEventsRequest, + com.google.longrunning.Operation>(this, METHODID_PURGE_USER_EVENTS))) + .addMethod( + getImportUserEventsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.ImportUserEventsRequest, + com.google.longrunning.Operation>(this, METHODID_IMPORT_USER_EVENTS))) + .addMethod( + getRejoinUserEventsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.RejoinUserEventsRequest, + com.google.longrunning.Operation>(this, METHODID_REJOIN_USER_EVENTS))) + .build(); + } + } + + /** + * + * + *
+   * Service for ingesting end user actions on the customer website.
+   * 
+ */ + public static final class UserEventServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private UserEventServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected UserEventServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new UserEventServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Writes a single user event.
+     * 
+ */ + public void writeUserEvent( + com.google.cloud.retail.v2.WriteUserEventRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getWriteUserEventMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Writes a single user event from the browser. This uses a GET request to
+     * due to browser restriction of POST-ing to a 3rd party domain.
+     * This method is used only by the Retail API JavaScript pixel and Google Tag
+     * Manager. Users should not call this method directly.
+     * 
+ */ + public void collectUserEvent( + com.google.cloud.retail.v2.CollectUserEventRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCollectUserEventMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes permanently all user events specified by the filter provided.
+     * Depending on the number of events specified by the filter, this operation
+     * could take hours or days to complete. To test a filter, use the list
+     * command first.
+     * 
+ */ + public void purgeUserEvents( + com.google.cloud.retail.v2.PurgeUserEventsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getPurgeUserEventsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Bulk import of User events. Request processing might be
+     * synchronous. Events that already exist are skipped.
+     * Use this method for backfilling historical user events.
+     * Operation.response is of type ImportResponse. Note that it is
+     * possible for a subset of the items to be successfully inserted.
+     * Operation.metadata is of type ImportMetadata.
+     * 
+ */ + public void importUserEvents( + com.google.cloud.retail.v2.ImportUserEventsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getImportUserEventsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Triggers a user event rejoin operation with latest product catalog. Events
+     * will not be annotated with detailed product information if product is
+     * missing from the catalog at the time the user event is ingested, and these
+     * events are stored as unjoined events with a limited usage on training and
+     * serving. This API can be used to trigger a 'join' operation on specified
+     * events with latest version of product catalog. It can also be used to
+     * correct events joined with wrong product catalog.
+     * 
+ */ + public void rejoinUserEvents( + com.google.cloud.retail.v2.RejoinUserEventsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getRejoinUserEventsMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service for ingesting end user actions on the customer website.
+   * 
+ */ + public static final class UserEventServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private UserEventServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected UserEventServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new UserEventServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Writes a single user event.
+     * 
+ */ + public com.google.cloud.retail.v2.UserEvent writeUserEvent( + com.google.cloud.retail.v2.WriteUserEventRequest request) { + return blockingUnaryCall(getChannel(), getWriteUserEventMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Writes a single user event from the browser. This uses a GET request to
+     * due to browser restriction of POST-ing to a 3rd party domain.
+     * This method is used only by the Retail API JavaScript pixel and Google Tag
+     * Manager. Users should not call this method directly.
+     * 
+ */ + public com.google.api.HttpBody collectUserEvent( + com.google.cloud.retail.v2.CollectUserEventRequest request) { + return blockingUnaryCall( + getChannel(), getCollectUserEventMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes permanently all user events specified by the filter provided.
+     * Depending on the number of events specified by the filter, this operation
+     * could take hours or days to complete. To test a filter, use the list
+     * command first.
+     * 
+ */ + public com.google.longrunning.Operation purgeUserEvents( + com.google.cloud.retail.v2.PurgeUserEventsRequest request) { + return blockingUnaryCall(getChannel(), getPurgeUserEventsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Bulk import of User events. Request processing might be
+     * synchronous. Events that already exist are skipped.
+     * Use this method for backfilling historical user events.
+     * Operation.response is of type ImportResponse. Note that it is
+     * possible for a subset of the items to be successfully inserted.
+     * Operation.metadata is of type ImportMetadata.
+     * 
+ */ + public com.google.longrunning.Operation importUserEvents( + com.google.cloud.retail.v2.ImportUserEventsRequest request) { + return blockingUnaryCall( + getChannel(), getImportUserEventsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Triggers a user event rejoin operation with latest product catalog. Events
+     * will not be annotated with detailed product information if product is
+     * missing from the catalog at the time the user event is ingested, and these
+     * events are stored as unjoined events with a limited usage on training and
+     * serving. This API can be used to trigger a 'join' operation on specified
+     * events with latest version of product catalog. It can also be used to
+     * correct events joined with wrong product catalog.
+     * 
+ */ + public com.google.longrunning.Operation rejoinUserEvents( + com.google.cloud.retail.v2.RejoinUserEventsRequest request) { + return blockingUnaryCall( + getChannel(), getRejoinUserEventsMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service for ingesting end user actions on the customer website.
+   * 
+ */ + public static final class UserEventServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private UserEventServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected UserEventServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new UserEventServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Writes a single user event.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + writeUserEvent(com.google.cloud.retail.v2.WriteUserEventRequest request) { + return futureUnaryCall( + getChannel().newCall(getWriteUserEventMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Writes a single user event from the browser. This uses a GET request to
+     * due to browser restriction of POST-ing to a 3rd party domain.
+     * This method is used only by the Retail API JavaScript pixel and Google Tag
+     * Manager. Users should not call this method directly.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + collectUserEvent(com.google.cloud.retail.v2.CollectUserEventRequest request) { + return futureUnaryCall( + getChannel().newCall(getCollectUserEventMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes permanently all user events specified by the filter provided.
+     * Depending on the number of events specified by the filter, this operation
+     * could take hours or days to complete. To test a filter, use the list
+     * command first.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + purgeUserEvents(com.google.cloud.retail.v2.PurgeUserEventsRequest request) { + return futureUnaryCall( + getChannel().newCall(getPurgeUserEventsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Bulk import of User events. Request processing might be
+     * synchronous. Events that already exist are skipped.
+     * Use this method for backfilling historical user events.
+     * Operation.response is of type ImportResponse. Note that it is
+     * possible for a subset of the items to be successfully inserted.
+     * Operation.metadata is of type ImportMetadata.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + importUserEvents(com.google.cloud.retail.v2.ImportUserEventsRequest request) { + return futureUnaryCall( + getChannel().newCall(getImportUserEventsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Triggers a user event rejoin operation with latest product catalog. Events
+     * will not be annotated with detailed product information if product is
+     * missing from the catalog at the time the user event is ingested, and these
+     * events are stored as unjoined events with a limited usage on training and
+     * serving. This API can be used to trigger a 'join' operation on specified
+     * events with latest version of product catalog. It can also be used to
+     * correct events joined with wrong product catalog.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + rejoinUserEvents(com.google.cloud.retail.v2.RejoinUserEventsRequest request) { + return futureUnaryCall( + getChannel().newCall(getRejoinUserEventsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_WRITE_USER_EVENT = 0; + private static final int METHODID_COLLECT_USER_EVENT = 1; + private static final int METHODID_PURGE_USER_EVENTS = 2; + private static final int METHODID_IMPORT_USER_EVENTS = 3; + private static final int METHODID_REJOIN_USER_EVENTS = 4; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final UserEventServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(UserEventServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_WRITE_USER_EVENT: + serviceImpl.writeUserEvent( + (com.google.cloud.retail.v2.WriteUserEventRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_COLLECT_USER_EVENT: + serviceImpl.collectUserEvent( + (com.google.cloud.retail.v2.CollectUserEventRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_PURGE_USER_EVENTS: + serviceImpl.purgeUserEvents( + (com.google.cloud.retail.v2.PurgeUserEventsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_IMPORT_USER_EVENTS: + serviceImpl.importUserEvents( + (com.google.cloud.retail.v2.ImportUserEventsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_REJOIN_USER_EVENTS: + serviceImpl.rejoinUserEvents( + (com.google.cloud.retail.v2.RejoinUserEventsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class UserEventServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + UserEventServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("UserEventService"); + } + } + + private static final class UserEventServiceFileDescriptorSupplier + extends UserEventServiceBaseDescriptorSupplier { + UserEventServiceFileDescriptorSupplier() {} + } + + private static final class UserEventServiceMethodDescriptorSupplier + extends UserEventServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + UserEventServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (UserEventServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new UserEventServiceFileDescriptorSupplier()) + .addMethod(getWriteUserEventMethod()) + .addMethod(getCollectUserEventMethod()) + .addMethod(getPurgeUserEventsMethod()) + .addMethod(getImportUserEventsMethod()) + .addMethod(getRejoinUserEventsMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java.header b/java.header new file mode 100644 index 00000000..3a9b503a --- /dev/null +++ b/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)( All [rR]ights [rR]eserved\.)?$ +^ \*$ +^ \* 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$ +^ \*$ +^ \*[ ]+https?://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\.$ +^ \*/$ diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 00000000..6597fced --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..056cfe4d --- /dev/null +++ b/pom.xml @@ -0,0 +1,189 @@ + + + 4.0.0 + com.google.cloud + google-cloud-retail-parent + pom + 0.0.1-SNAPSHOT + Google Cloud Retail Parent + https://github.com/googleapis/java- + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 0.9.2 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-.git + scm:git:git@github.com:googleapis/java-.git + https://github.com/googleapis/java- + HEAD + + + https://github.com/googleapis/java-/issues + GitHub Issues + + + + sonatype-nexus-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-retail-parent + + + + + + com.google.cloud + google-cloud-retail + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-retail-v2 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-retail-v2 + 0.0.1-SNAPSHOT + + + + com.google.cloud + google-cloud-shared-dependencies + 0.9.0 + pom + import + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.objenesis:objenesis + javax.annotation:javax.annotation-api + + + + + + + + + google-cloud-retail + proto-google-cloud-retail-v2 + grpc-google-cloud-retail-v2 + google-cloud-retail-bom + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.1.1 + + + + index + dependency-info + team + ci-management + issue-management + licenses + scm + dependency-management + distribution-management + summary + modules + + + + + true + ${site.installationModule} + jar + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + html + + aggregate + javadoc + + + + + none + protected + true + ${project.build.directory}/javadoc + + + Test helpers packages + com.google.cloud.testing + + + SPI packages + com.google.cloud.spi* + + + + + https://grpc.io/grpc-java/javadoc/ + https://developers.google.com/protocol-buffers/docs/reference/java/ + https://googleapis.dev/java/google-auth-library/latest/ + https://googleapis.dev/java/gax/latest/ + https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ + + + + + + \ No newline at end of file diff --git a/proto-google-cloud-retail-v2/pom.xml b/proto-google-cloud-retail-v2/pom.xml new file mode 100644 index 00000000..cae81360 --- /dev/null +++ b/proto-google-cloud-retail-v2/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-retail-v2 + 0.0.1-SNAPSHOT + proto-google-cloud-retail-v2 + Proto library for google-cloud-retail + + com.google.cloud + google-cloud-retail-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySource.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySource.java new file mode 100644 index 00000000..1fb0d42c --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySource.java @@ -0,0 +1,1469 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * BigQuery source import data from.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.BigQuerySource} + */ +public final class BigQuerySource extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.BigQuerySource) + BigQuerySourceOrBuilder { + private static final long serialVersionUID = 0L; + // Use BigQuerySource.newBuilder() to construct. + private BigQuerySource(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BigQuerySource() { + projectId_ = ""; + datasetId_ = ""; + tableId_ = ""; + gcsStagingDir_ = ""; + dataSchema_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BigQuerySource(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BigQuerySource( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + datasetId_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + tableId_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + gcsStagingDir_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + dataSchema_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + projectId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_BigQuerySource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_BigQuerySource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.BigQuerySource.class, + com.google.cloud.retail.v2.BigQuerySource.Builder.class); + } + + public static final int PROJECT_ID_FIELD_NUMBER = 5; + private volatile java.lang.Object projectId_; + /** + * + * + *
+   * The project id (can be project # or id) that the BigQuery source is in with
+   * a length limit of 128 characters. If not specified, inherits the project
+   * id from the parent request.
+   * 
+ * + * string project_id = 5; + * + * @return The projectId. + */ + @java.lang.Override + public java.lang.String getProjectId() { + java.lang.Object ref = projectId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + projectId_ = s; + return s; + } + } + /** + * + * + *
+   * The project id (can be project # or id) that the BigQuery source is in with
+   * a length limit of 128 characters. If not specified, inherits the project
+   * id from the parent request.
+   * 
+ * + * string project_id = 5; + * + * @return The bytes for projectId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getProjectIdBytes() { + java.lang.Object ref = projectId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + projectId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DATASET_ID_FIELD_NUMBER = 1; + private volatile java.lang.Object datasetId_; + /** + * + * + *
+   * Required. The BigQuery data set to copy the data from with a length limit
+   * of 1,024 characters.
+   * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The datasetId. + */ + @java.lang.Override + public java.lang.String getDatasetId() { + java.lang.Object ref = datasetId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + datasetId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The BigQuery data set to copy the data from with a length limit
+   * of 1,024 characters.
+   * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for datasetId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDatasetIdBytes() { + java.lang.Object ref = datasetId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + datasetId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TABLE_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object tableId_; + /** + * + * + *
+   * Required. The BigQuery table to copy the data from with a length limit of
+   * 1,024 characters.
+   * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The tableId. + */ + @java.lang.Override + public java.lang.String getTableId() { + java.lang.Object ref = tableId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tableId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The BigQuery table to copy the data from with a length limit of
+   * 1,024 characters.
+   * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for tableId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTableIdBytes() { + java.lang.Object ref = tableId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + tableId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GCS_STAGING_DIR_FIELD_NUMBER = 3; + private volatile java.lang.Object gcsStagingDir_; + /** + * + * + *
+   * Intermediate Cloud Storage directory used for the import with a length
+   * limit of 2,000 characters. Can be specified if one wants to have the
+   * BigQuery export to a specific Cloud Storage directory.
+   * 
+ * + * string gcs_staging_dir = 3; + * + * @return The gcsStagingDir. + */ + @java.lang.Override + public java.lang.String getGcsStagingDir() { + java.lang.Object ref = gcsStagingDir_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcsStagingDir_ = s; + return s; + } + } + /** + * + * + *
+   * Intermediate Cloud Storage directory used for the import with a length
+   * limit of 2,000 characters. Can be specified if one wants to have the
+   * BigQuery export to a specific Cloud Storage directory.
+   * 
+ * + * string gcs_staging_dir = 3; + * + * @return The bytes for gcsStagingDir. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcsStagingDirBytes() { + java.lang.Object ref = gcsStagingDir_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcsStagingDir_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DATA_SCHEMA_FIELD_NUMBER = 4; + private volatile java.lang.Object dataSchema_; + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 4; + * + * @return The dataSchema. + */ + @java.lang.Override + public java.lang.String getDataSchema() { + java.lang.Object ref = dataSchema_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + dataSchema_ = s; + return s; + } + } + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 4; + * + * @return The bytes for dataSchema. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDataSchemaBytes() { + java.lang.Object ref = dataSchema_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + dataSchema_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getDatasetIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, datasetId_); + } + if (!getTableIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, tableId_); + } + if (!getGcsStagingDirBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, gcsStagingDir_); + } + if (!getDataSchemaBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, dataSchema_); + } + if (!getProjectIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, projectId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getDatasetIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, datasetId_); + } + if (!getTableIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, tableId_); + } + if (!getGcsStagingDirBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, gcsStagingDir_); + } + if (!getDataSchemaBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, dataSchema_); + } + if (!getProjectIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, projectId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.BigQuerySource)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.BigQuerySource other = + (com.google.cloud.retail.v2.BigQuerySource) obj; + + if (!getProjectId().equals(other.getProjectId())) return false; + if (!getDatasetId().equals(other.getDatasetId())) return false; + if (!getTableId().equals(other.getTableId())) return false; + if (!getGcsStagingDir().equals(other.getGcsStagingDir())) return false; + if (!getDataSchema().equals(other.getDataSchema())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PROJECT_ID_FIELD_NUMBER; + hash = (53 * hash) + getProjectId().hashCode(); + hash = (37 * hash) + DATASET_ID_FIELD_NUMBER; + hash = (53 * hash) + getDatasetId().hashCode(); + hash = (37 * hash) + TABLE_ID_FIELD_NUMBER; + hash = (53 * hash) + getTableId().hashCode(); + hash = (37 * hash) + GCS_STAGING_DIR_FIELD_NUMBER; + hash = (53 * hash) + getGcsStagingDir().hashCode(); + hash = (37 * hash) + DATA_SCHEMA_FIELD_NUMBER; + hash = (53 * hash) + getDataSchema().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.BigQuerySource parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.BigQuerySource prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * BigQuery source import data from.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.BigQuerySource} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.BigQuerySource) + com.google.cloud.retail.v2.BigQuerySourceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_BigQuerySource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_BigQuerySource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.BigQuerySource.class, + com.google.cloud.retail.v2.BigQuerySource.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.BigQuerySource.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + projectId_ = ""; + + datasetId_ = ""; + + tableId_ = ""; + + gcsStagingDir_ = ""; + + dataSchema_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_BigQuerySource_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource getDefaultInstanceForType() { + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource build() { + com.google.cloud.retail.v2.BigQuerySource result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource buildPartial() { + com.google.cloud.retail.v2.BigQuerySource result = + new com.google.cloud.retail.v2.BigQuerySource(this); + result.projectId_ = projectId_; + result.datasetId_ = datasetId_; + result.tableId_ = tableId_; + result.gcsStagingDir_ = gcsStagingDir_; + result.dataSchema_ = dataSchema_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.BigQuerySource) { + return mergeFrom((com.google.cloud.retail.v2.BigQuerySource) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.BigQuerySource other) { + if (other == com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance()) return this; + if (!other.getProjectId().isEmpty()) { + projectId_ = other.projectId_; + onChanged(); + } + if (!other.getDatasetId().isEmpty()) { + datasetId_ = other.datasetId_; + onChanged(); + } + if (!other.getTableId().isEmpty()) { + tableId_ = other.tableId_; + onChanged(); + } + if (!other.getGcsStagingDir().isEmpty()) { + gcsStagingDir_ = other.gcsStagingDir_; + onChanged(); + } + if (!other.getDataSchema().isEmpty()) { + dataSchema_ = other.dataSchema_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.BigQuerySource parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.BigQuerySource) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object projectId_ = ""; + /** + * + * + *
+     * The project id (can be project # or id) that the BigQuery source is in with
+     * a length limit of 128 characters. If not specified, inherits the project
+     * id from the parent request.
+     * 
+ * + * string project_id = 5; + * + * @return The projectId. + */ + public java.lang.String getProjectId() { + java.lang.Object ref = projectId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + projectId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The project id (can be project # or id) that the BigQuery source is in with
+     * a length limit of 128 characters. If not specified, inherits the project
+     * id from the parent request.
+     * 
+ * + * string project_id = 5; + * + * @return The bytes for projectId. + */ + public com.google.protobuf.ByteString getProjectIdBytes() { + java.lang.Object ref = projectId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + projectId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The project id (can be project # or id) that the BigQuery source is in with
+     * a length limit of 128 characters. If not specified, inherits the project
+     * id from the parent request.
+     * 
+ * + * string project_id = 5; + * + * @param value The projectId to set. + * @return This builder for chaining. + */ + public Builder setProjectId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + projectId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The project id (can be project # or id) that the BigQuery source is in with
+     * a length limit of 128 characters. If not specified, inherits the project
+     * id from the parent request.
+     * 
+ * + * string project_id = 5; + * + * @return This builder for chaining. + */ + public Builder clearProjectId() { + + projectId_ = getDefaultInstance().getProjectId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The project id (can be project # or id) that the BigQuery source is in with
+     * a length limit of 128 characters. If not specified, inherits the project
+     * id from the parent request.
+     * 
+ * + * string project_id = 5; + * + * @param value The bytes for projectId to set. + * @return This builder for chaining. + */ + public Builder setProjectIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + projectId_ = value; + onChanged(); + return this; + } + + private java.lang.Object datasetId_ = ""; + /** + * + * + *
+     * Required. The BigQuery data set to copy the data from with a length limit
+     * of 1,024 characters.
+     * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The datasetId. + */ + public java.lang.String getDatasetId() { + java.lang.Object ref = datasetId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + datasetId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The BigQuery data set to copy the data from with a length limit
+     * of 1,024 characters.
+     * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for datasetId. + */ + public com.google.protobuf.ByteString getDatasetIdBytes() { + java.lang.Object ref = datasetId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + datasetId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The BigQuery data set to copy the data from with a length limit
+     * of 1,024 characters.
+     * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The datasetId to set. + * @return This builder for chaining. + */ + public Builder setDatasetId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + datasetId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The BigQuery data set to copy the data from with a length limit
+     * of 1,024 characters.
+     * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearDatasetId() { + + datasetId_ = getDefaultInstance().getDatasetId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The BigQuery data set to copy the data from with a length limit
+     * of 1,024 characters.
+     * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for datasetId to set. + * @return This builder for chaining. + */ + public Builder setDatasetIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + datasetId_ = value; + onChanged(); + return this; + } + + private java.lang.Object tableId_ = ""; + /** + * + * + *
+     * Required. The BigQuery table to copy the data from with a length limit of
+     * 1,024 characters.
+     * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The tableId. + */ + public java.lang.String getTableId() { + java.lang.Object ref = tableId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tableId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The BigQuery table to copy the data from with a length limit of
+     * 1,024 characters.
+     * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for tableId. + */ + public com.google.protobuf.ByteString getTableIdBytes() { + java.lang.Object ref = tableId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + tableId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The BigQuery table to copy the data from with a length limit of
+     * 1,024 characters.
+     * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The tableId to set. + * @return This builder for chaining. + */ + public Builder setTableId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + tableId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The BigQuery table to copy the data from with a length limit of
+     * 1,024 characters.
+     * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearTableId() { + + tableId_ = getDefaultInstance().getTableId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The BigQuery table to copy the data from with a length limit of
+     * 1,024 characters.
+     * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for tableId to set. + * @return This builder for chaining. + */ + public Builder setTableIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + tableId_ = value; + onChanged(); + return this; + } + + private java.lang.Object gcsStagingDir_ = ""; + /** + * + * + *
+     * Intermediate Cloud Storage directory used for the import with a length
+     * limit of 2,000 characters. Can be specified if one wants to have the
+     * BigQuery export to a specific Cloud Storage directory.
+     * 
+ * + * string gcs_staging_dir = 3; + * + * @return The gcsStagingDir. + */ + public java.lang.String getGcsStagingDir() { + java.lang.Object ref = gcsStagingDir_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcsStagingDir_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Intermediate Cloud Storage directory used for the import with a length
+     * limit of 2,000 characters. Can be specified if one wants to have the
+     * BigQuery export to a specific Cloud Storage directory.
+     * 
+ * + * string gcs_staging_dir = 3; + * + * @return The bytes for gcsStagingDir. + */ + public com.google.protobuf.ByteString getGcsStagingDirBytes() { + java.lang.Object ref = gcsStagingDir_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcsStagingDir_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Intermediate Cloud Storage directory used for the import with a length
+     * limit of 2,000 characters. Can be specified if one wants to have the
+     * BigQuery export to a specific Cloud Storage directory.
+     * 
+ * + * string gcs_staging_dir = 3; + * + * @param value The gcsStagingDir to set. + * @return This builder for chaining. + */ + public Builder setGcsStagingDir(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + gcsStagingDir_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Intermediate Cloud Storage directory used for the import with a length
+     * limit of 2,000 characters. Can be specified if one wants to have the
+     * BigQuery export to a specific Cloud Storage directory.
+     * 
+ * + * string gcs_staging_dir = 3; + * + * @return This builder for chaining. + */ + public Builder clearGcsStagingDir() { + + gcsStagingDir_ = getDefaultInstance().getGcsStagingDir(); + onChanged(); + return this; + } + /** + * + * + *
+     * Intermediate Cloud Storage directory used for the import with a length
+     * limit of 2,000 characters. Can be specified if one wants to have the
+     * BigQuery export to a specific Cloud Storage directory.
+     * 
+ * + * string gcs_staging_dir = 3; + * + * @param value The bytes for gcsStagingDir to set. + * @return This builder for chaining. + */ + public Builder setGcsStagingDirBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + gcsStagingDir_ = value; + onChanged(); + return this; + } + + private java.lang.Object dataSchema_ = ""; + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 4; + * + * @return The dataSchema. + */ + public java.lang.String getDataSchema() { + java.lang.Object ref = dataSchema_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + dataSchema_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 4; + * + * @return The bytes for dataSchema. + */ + public com.google.protobuf.ByteString getDataSchemaBytes() { + java.lang.Object ref = dataSchema_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + dataSchema_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 4; + * + * @param value The dataSchema to set. + * @return This builder for chaining. + */ + public Builder setDataSchema(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + dataSchema_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 4; + * + * @return This builder for chaining. + */ + public Builder clearDataSchema() { + + dataSchema_ = getDefaultInstance().getDataSchema(); + onChanged(); + return this; + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 4; + * + * @param value The bytes for dataSchema to set. + * @return This builder for chaining. + */ + public Builder setDataSchemaBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + dataSchema_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.BigQuerySource) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.BigQuerySource) + private static final com.google.cloud.retail.v2.BigQuerySource DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.BigQuerySource(); + } + + public static com.google.cloud.retail.v2.BigQuerySource getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BigQuerySource parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BigQuerySource(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySourceOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySourceOrBuilder.java new file mode 100644 index 00000000..05996a9e --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySourceOrBuilder.java @@ -0,0 +1,184 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface BigQuerySourceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.BigQuerySource) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The project id (can be project # or id) that the BigQuery source is in with
+   * a length limit of 128 characters. If not specified, inherits the project
+   * id from the parent request.
+   * 
+ * + * string project_id = 5; + * + * @return The projectId. + */ + java.lang.String getProjectId(); + /** + * + * + *
+   * The project id (can be project # or id) that the BigQuery source is in with
+   * a length limit of 128 characters. If not specified, inherits the project
+   * id from the parent request.
+   * 
+ * + * string project_id = 5; + * + * @return The bytes for projectId. + */ + com.google.protobuf.ByteString getProjectIdBytes(); + + /** + * + * + *
+   * Required. The BigQuery data set to copy the data from with a length limit
+   * of 1,024 characters.
+   * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The datasetId. + */ + java.lang.String getDatasetId(); + /** + * + * + *
+   * Required. The BigQuery data set to copy the data from with a length limit
+   * of 1,024 characters.
+   * 
+ * + * string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for datasetId. + */ + com.google.protobuf.ByteString getDatasetIdBytes(); + + /** + * + * + *
+   * Required. The BigQuery table to copy the data from with a length limit of
+   * 1,024 characters.
+   * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The tableId. + */ + java.lang.String getTableId(); + /** + * + * + *
+   * Required. The BigQuery table to copy the data from with a length limit of
+   * 1,024 characters.
+   * 
+ * + * string table_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for tableId. + */ + com.google.protobuf.ByteString getTableIdBytes(); + + /** + * + * + *
+   * Intermediate Cloud Storage directory used for the import with a length
+   * limit of 2,000 characters. Can be specified if one wants to have the
+   * BigQuery export to a specific Cloud Storage directory.
+   * 
+ * + * string gcs_staging_dir = 3; + * + * @return The gcsStagingDir. + */ + java.lang.String getGcsStagingDir(); + /** + * + * + *
+   * Intermediate Cloud Storage directory used for the import with a length
+   * limit of 2,000 characters. Can be specified if one wants to have the
+   * BigQuery export to a specific Cloud Storage directory.
+   * 
+ * + * string gcs_staging_dir = 3; + * + * @return The bytes for gcsStagingDir. + */ + com.google.protobuf.ByteString getGcsStagingDirBytes(); + + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 4; + * + * @return The dataSchema. + */ + java.lang.String getDataSchema(); + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 4; + * + * @return The bytes for dataSchema. + */ + com.google.protobuf.ByteString getDataSchemaBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BranchName.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BranchName.java new file mode 100644 index 00000000..2157b935 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BranchName.java @@ -0,0 +1,257 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class BranchName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_CATALOG_BRANCH = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String catalog; + private final String branch; + + @Deprecated + protected BranchName() { + project = null; + location = null; + catalog = null; + branch = null; + } + + private BranchName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + catalog = Preconditions.checkNotNull(builder.getCatalog()); + branch = Preconditions.checkNotNull(builder.getBranch()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getBranch() { + return branch; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static BranchName of(String project, String location, String catalog, String branch) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setBranch(branch) + .build(); + } + + public static String format(String project, String location, String catalog, String branch) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setBranch(branch) + .build() + .toString(); + } + + public static BranchName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_CATALOG_BRANCH.validatedMatch( + formattedString, "BranchName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("catalog"), + matchMap.get("branch")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (BranchName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_CATALOG_BRANCH.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (catalog != null) { + fieldMapBuilder.put("catalog", catalog); + } + if (branch != null) { + fieldMapBuilder.put("branch", branch); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_CATALOG_BRANCH.instantiate( + "project", project, "location", location, "catalog", catalog, "branch", branch); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + BranchName that = ((BranchName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.catalog, that.catalog) + && Objects.equals(this.branch, that.branch); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(catalog); + h *= 1000003; + h ^= Objects.hashCode(branch); + return h; + } + + /** Builder for projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}. */ + public static class Builder { + private String project; + private String location; + private String catalog; + private String branch; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getBranch() { + return branch; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setCatalog(String catalog) { + this.catalog = catalog; + return this; + } + + public Builder setBranch(String branch) { + this.branch = branch; + return this; + } + + private Builder(BranchName branchName) { + project = branchName.project; + location = branchName.location; + catalog = branchName.catalog; + branch = branchName.branch; + } + + public BranchName build() { + return new BranchName(this); + } + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Catalog.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Catalog.java new file mode 100644 index 00000000..e1a25bdc --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Catalog.java @@ -0,0 +1,1154 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * The catalog configuration.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Catalog} + */ +public final class Catalog extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Catalog) + CatalogOrBuilder { + private static final long serialVersionUID = 0L; + // Use Catalog.newBuilder() to construct. + private Catalog(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Catalog() { + name_ = ""; + displayName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Catalog(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Catalog( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 34: + { + com.google.cloud.retail.v2.ProductLevelConfig.Builder subBuilder = null; + if (productLevelConfig_ != null) { + subBuilder = productLevelConfig_.toBuilder(); + } + productLevelConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ProductLevelConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(productLevelConfig_); + productLevelConfig_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_Catalog_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_Catalog_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Catalog.class, + com.google.cloud.retail.v2.Catalog.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the catalog.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the catalog.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * Required. Immutable. The catalog display name.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Immutable. The catalog display name.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PRODUCT_LEVEL_CONFIG_FIELD_NUMBER = 4; + private com.google.cloud.retail.v2.ProductLevelConfig productLevelConfig_; + /** + * + * + *
+   * Required. The product level configuration.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the productLevelConfig field is set. + */ + @java.lang.Override + public boolean hasProductLevelConfig() { + return productLevelConfig_ != null; + } + /** + * + * + *
+   * Required. The product level configuration.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The productLevelConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductLevelConfig getProductLevelConfig() { + return productLevelConfig_ == null + ? com.google.cloud.retail.v2.ProductLevelConfig.getDefaultInstance() + : productLevelConfig_; + } + /** + * + * + *
+   * Required. The product level configuration.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductLevelConfigOrBuilder getProductLevelConfigOrBuilder() { + return getProductLevelConfig(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (productLevelConfig_ != null) { + output.writeMessage(4, getProductLevelConfig()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!getDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (productLevelConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getProductLevelConfig()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Catalog)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Catalog other = (com.google.cloud.retail.v2.Catalog) obj; + + if (!getName().equals(other.getName())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (hasProductLevelConfig() != other.hasProductLevelConfig()) return false; + if (hasProductLevelConfig()) { + if (!getProductLevelConfig().equals(other.getProductLevelConfig())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + if (hasProductLevelConfig()) { + hash = (37 * hash) + PRODUCT_LEVEL_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getProductLevelConfig().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Catalog parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Catalog parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Catalog parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Catalog parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Catalog prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The catalog configuration.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Catalog} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Catalog) + com.google.cloud.retail.v2.CatalogOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_Catalog_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_Catalog_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Catalog.class, + com.google.cloud.retail.v2.Catalog.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Catalog.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + displayName_ = ""; + + if (productLevelConfigBuilder_ == null) { + productLevelConfig_ = null; + } else { + productLevelConfig_ = null; + productLevelConfigBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_Catalog_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Catalog getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Catalog.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Catalog build() { + com.google.cloud.retail.v2.Catalog result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Catalog buildPartial() { + com.google.cloud.retail.v2.Catalog result = new com.google.cloud.retail.v2.Catalog(this); + result.name_ = name_; + result.displayName_ = displayName_; + if (productLevelConfigBuilder_ == null) { + result.productLevelConfig_ = productLevelConfig_; + } else { + result.productLevelConfig_ = productLevelConfigBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Catalog) { + return mergeFrom((com.google.cloud.retail.v2.Catalog) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Catalog other) { + if (other == com.google.cloud.retail.v2.Catalog.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (other.hasProductLevelConfig()) { + mergeProductLevelConfig(other.getProductLevelConfig()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Catalog parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Catalog) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the catalog.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the catalog.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the catalog.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the catalog.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the catalog.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * Required. Immutable. The catalog display name.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Immutable. The catalog display name.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Immutable. The catalog display name.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The catalog display name.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The catalog display name.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.ProductLevelConfig productLevelConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductLevelConfig, + com.google.cloud.retail.v2.ProductLevelConfig.Builder, + com.google.cloud.retail.v2.ProductLevelConfigOrBuilder> + productLevelConfigBuilder_; + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the productLevelConfig field is set. + */ + public boolean hasProductLevelConfig() { + return productLevelConfigBuilder_ != null || productLevelConfig_ != null; + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The productLevelConfig. + */ + public com.google.cloud.retail.v2.ProductLevelConfig getProductLevelConfig() { + if (productLevelConfigBuilder_ == null) { + return productLevelConfig_ == null + ? com.google.cloud.retail.v2.ProductLevelConfig.getDefaultInstance() + : productLevelConfig_; + } else { + return productLevelConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProductLevelConfig(com.google.cloud.retail.v2.ProductLevelConfig value) { + if (productLevelConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + productLevelConfig_ = value; + onChanged(); + } else { + productLevelConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProductLevelConfig( + com.google.cloud.retail.v2.ProductLevelConfig.Builder builderForValue) { + if (productLevelConfigBuilder_ == null) { + productLevelConfig_ = builderForValue.build(); + onChanged(); + } else { + productLevelConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeProductLevelConfig(com.google.cloud.retail.v2.ProductLevelConfig value) { + if (productLevelConfigBuilder_ == null) { + if (productLevelConfig_ != null) { + productLevelConfig_ = + com.google.cloud.retail.v2.ProductLevelConfig.newBuilder(productLevelConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + productLevelConfig_ = value; + } + onChanged(); + } else { + productLevelConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearProductLevelConfig() { + if (productLevelConfigBuilder_ == null) { + productLevelConfig_ = null; + onChanged(); + } else { + productLevelConfig_ = null; + productLevelConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductLevelConfig.Builder getProductLevelConfigBuilder() { + + onChanged(); + return getProductLevelConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductLevelConfigOrBuilder getProductLevelConfigOrBuilder() { + if (productLevelConfigBuilder_ != null) { + return productLevelConfigBuilder_.getMessageOrBuilder(); + } else { + return productLevelConfig_ == null + ? com.google.cloud.retail.v2.ProductLevelConfig.getDefaultInstance() + : productLevelConfig_; + } + } + /** + * + * + *
+     * Required. The product level configuration.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductLevelConfig, + com.google.cloud.retail.v2.ProductLevelConfig.Builder, + com.google.cloud.retail.v2.ProductLevelConfigOrBuilder> + getProductLevelConfigFieldBuilder() { + if (productLevelConfigBuilder_ == null) { + productLevelConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductLevelConfig, + com.google.cloud.retail.v2.ProductLevelConfig.Builder, + com.google.cloud.retail.v2.ProductLevelConfigOrBuilder>( + getProductLevelConfig(), getParentForChildren(), isClean()); + productLevelConfig_ = null; + } + return productLevelConfigBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Catalog) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Catalog) + private static final com.google.cloud.retail.v2.Catalog DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Catalog(); + } + + public static com.google.cloud.retail.v2.Catalog getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Catalog parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Catalog(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Catalog getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogOrBuilder.java new file mode 100644 index 00000000..e1fb6ff1 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogOrBuilder.java @@ -0,0 +1,128 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +public interface CatalogOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Catalog) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the catalog.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the catalog.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. Immutable. The catalog display name.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * Required. Immutable. The catalog display name.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Required. The product level configuration.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the productLevelConfig field is set. + */ + boolean hasProductLevelConfig(); + /** + * + * + *
+   * Required. The product level configuration.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The productLevelConfig. + */ + com.google.cloud.retail.v2.ProductLevelConfig getProductLevelConfig(); + /** + * + * + *
+   * Required. The product level configuration.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductLevelConfig product_level_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ProductLevelConfigOrBuilder getProductLevelConfigOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogProto.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogProto.java new file mode 100644 index 00000000..92a1c3fb --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogProto.java @@ -0,0 +1,102 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +public final class CatalogProto { + private CatalogProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ProductLevelConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ProductLevelConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_Catalog_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_Catalog_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n$google/cloud/retail/v2/catalog.proto\022\026" + + "google.cloud.retail.v2\032\034google/api/annot" + + "ations.proto\032\037google/api/field_behavior." + + "proto\032\031google/api/resource.proto\"^\n\022Prod" + + "uctLevelConfig\022\036\n\026ingestion_product_type" + + "\030\001 \001(\t\022(\n merchant_center_product_id_fie" + + "ld\030\002 \001(\t\"\354\001\n\007Catalog\022\024\n\004name\030\001 \001(\tB\006\340A\002\340" + + "A\005\022\034\n\014display_name\030\002 \001(\tB\006\340A\002\340A\005\022M\n\024prod" + + "uct_level_config\030\004 \001(\0132*.google.cloud.re" + + "tail.v2.ProductLevelConfigB\003\340A\002:^\352A[\n\035re" + + "tail.googleapis.com/Catalog\022:projects/{p" + + "roject}/locations/{location}/catalogs/{c" + + "atalog}B\301\001\n\032com.google.cloud.retail.v2B\014" + + "CatalogProtoP\001Z + * Request message for CollectUserEvent method. + * + * + * Protobuf type {@code google.cloud.retail.v2.CollectUserEventRequest} + */ +public final class CollectUserEventRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CollectUserEventRequest) + CollectUserEventRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CollectUserEventRequest.newBuilder() to construct. + private CollectUserEventRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CollectUserEventRequest() { + parent_ = ""; + userEvent_ = ""; + uri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CollectUserEventRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CollectUserEventRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + userEvent_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + case 32: + { + ets_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_CollectUserEventRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_CollectUserEventRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CollectUserEventRequest.class, + com.google.cloud.retail.v2.CollectUserEventRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The parent catalog name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The parent catalog name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USER_EVENT_FIELD_NUMBER = 2; + private volatile java.lang.Object userEvent_; + /** + * + * + *
+   * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+   * characters.
+   * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The userEvent. + */ + @java.lang.Override + public java.lang.String getUserEvent() { + java.lang.Object ref = userEvent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + userEvent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+   * characters.
+   * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for userEvent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUserEventBytes() { + java.lang.Object ref = userEvent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + userEvent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int URI_FIELD_NUMBER = 3; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * The URL including cgi-parameters but excluding the hash fragment with a
+   * length limit of 5,000 characters. This is often more useful than the
+   * referer URL, because many browsers only send the domain for 3rd party
+   * requests.
+   * 
+ * + * string uri = 3; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * The URL including cgi-parameters but excluding the hash fragment with a
+   * length limit of 5,000 characters. This is often more useful than the
+   * referer URL, because many browsers only send the domain for 3rd party
+   * requests.
+   * 
+ * + * string uri = 3; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ETS_FIELD_NUMBER = 4; + private long ets_; + /** + * + * + *
+   * The event timestamp in milliseconds. This prevents browser caching of
+   * otherwise identical get requests. The name is abbreviated to reduce the
+   * payload bytes.
+   * 
+ * + * int64 ets = 4; + * + * @return The ets. + */ + @java.lang.Override + public long getEts() { + return ets_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!getUserEventBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, userEvent_); + } + if (!getUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, uri_); + } + if (ets_ != 0L) { + output.writeInt64(4, ets_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!getUserEventBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, userEvent_); + } + if (!getUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, uri_); + } + if (ets_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, ets_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.CollectUserEventRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.CollectUserEventRequest other = + (com.google.cloud.retail.v2.CollectUserEventRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getUserEvent().equals(other.getUserEvent())) return false; + if (!getUri().equals(other.getUri())) return false; + if (getEts() != other.getEts()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + USER_EVENT_FIELD_NUMBER; + hash = (53 * hash) + getUserEvent().hashCode(); + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (37 * hash) + ETS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getEts()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.CollectUserEventRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for CollectUserEvent method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CollectUserEventRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CollectUserEventRequest) + com.google.cloud.retail.v2.CollectUserEventRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_CollectUserEventRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_CollectUserEventRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CollectUserEventRequest.class, + com.google.cloud.retail.v2.CollectUserEventRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.CollectUserEventRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + userEvent_ = ""; + + uri_ = ""; + + ets_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_CollectUserEventRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CollectUserEventRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.CollectUserEventRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.CollectUserEventRequest build() { + com.google.cloud.retail.v2.CollectUserEventRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CollectUserEventRequest buildPartial() { + com.google.cloud.retail.v2.CollectUserEventRequest result = + new com.google.cloud.retail.v2.CollectUserEventRequest(this); + result.parent_ = parent_; + result.userEvent_ = userEvent_; + result.uri_ = uri_; + result.ets_ = ets_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.CollectUserEventRequest) { + return mergeFrom((com.google.cloud.retail.v2.CollectUserEventRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.CollectUserEventRequest other) { + if (other == com.google.cloud.retail.v2.CollectUserEventRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getUserEvent().isEmpty()) { + userEvent_ = other.userEvent_; + onChanged(); + } + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + if (other.getEts() != 0L) { + setEts(other.getEts()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.CollectUserEventRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.CollectUserEventRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent catalog name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object userEvent_ = ""; + /** + * + * + *
+     * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+     * characters.
+     * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The userEvent. + */ + public java.lang.String getUserEvent() { + java.lang.Object ref = userEvent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + userEvent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+     * characters.
+     * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for userEvent. + */ + public com.google.protobuf.ByteString getUserEventBytes() { + java.lang.Object ref = userEvent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + userEvent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+     * characters.
+     * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The userEvent to set. + * @return This builder for chaining. + */ + public Builder setUserEvent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + userEvent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+     * characters.
+     * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearUserEvent() { + + userEvent_ = getDefaultInstance().getUserEvent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+     * characters.
+     * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for userEvent to set. + * @return This builder for chaining. + */ + public Builder setUserEventBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + userEvent_ = value; + onChanged(); + return this; + } + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * The URL including cgi-parameters but excluding the hash fragment with a
+     * length limit of 5,000 characters. This is often more useful than the
+     * referer URL, because many browsers only send the domain for 3rd party
+     * requests.
+     * 
+ * + * string uri = 3; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The URL including cgi-parameters but excluding the hash fragment with a
+     * length limit of 5,000 characters. This is often more useful than the
+     * referer URL, because many browsers only send the domain for 3rd party
+     * requests.
+     * 
+ * + * string uri = 3; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The URL including cgi-parameters but excluding the hash fragment with a
+     * length limit of 5,000 characters. This is often more useful than the
+     * referer URL, because many browsers only send the domain for 3rd party
+     * requests.
+     * 
+ * + * string uri = 3; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The URL including cgi-parameters but excluding the hash fragment with a
+     * length limit of 5,000 characters. This is often more useful than the
+     * referer URL, because many browsers only send the domain for 3rd party
+     * requests.
+     * 
+ * + * string uri = 3; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * The URL including cgi-parameters but excluding the hash fragment with a
+     * length limit of 5,000 characters. This is often more useful than the
+     * referer URL, because many browsers only send the domain for 3rd party
+     * requests.
+     * 
+ * + * string uri = 3; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = value; + onChanged(); + return this; + } + + private long ets_; + /** + * + * + *
+     * The event timestamp in milliseconds. This prevents browser caching of
+     * otherwise identical get requests. The name is abbreviated to reduce the
+     * payload bytes.
+     * 
+ * + * int64 ets = 4; + * + * @return The ets. + */ + @java.lang.Override + public long getEts() { + return ets_; + } + /** + * + * + *
+     * The event timestamp in milliseconds. This prevents browser caching of
+     * otherwise identical get requests. The name is abbreviated to reduce the
+     * payload bytes.
+     * 
+ * + * int64 ets = 4; + * + * @param value The ets to set. + * @return This builder for chaining. + */ + public Builder setEts(long value) { + + ets_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The event timestamp in milliseconds. This prevents browser caching of
+     * otherwise identical get requests. The name is abbreviated to reduce the
+     * payload bytes.
+     * 
+ * + * int64 ets = 4; + * + * @return This builder for chaining. + */ + public Builder clearEts() { + + ets_ = 0L; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CollectUserEventRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CollectUserEventRequest) + private static final com.google.cloud.retail.v2.CollectUserEventRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CollectUserEventRequest(); + } + + public static com.google.cloud.retail.v2.CollectUserEventRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CollectUserEventRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CollectUserEventRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CollectUserEventRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CollectUserEventRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CollectUserEventRequestOrBuilder.java new file mode 100644 index 00000000..54342604 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CollectUserEventRequestOrBuilder.java @@ -0,0 +1,125 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +public interface CollectUserEventRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.CollectUserEventRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent catalog name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent catalog name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+   * characters.
+   * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The userEvent. + */ + java.lang.String getUserEvent(); + /** + * + * + *
+   * Required. URL encoded UserEvent proto with a length limit of 2,000,000
+   * characters.
+   * 
+ * + * string user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for userEvent. + */ + com.google.protobuf.ByteString getUserEventBytes(); + + /** + * + * + *
+   * The URL including cgi-parameters but excluding the hash fragment with a
+   * length limit of 5,000 characters. This is often more useful than the
+   * referer URL, because many browsers only send the domain for 3rd party
+   * requests.
+   * 
+ * + * string uri = 3; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * The URL including cgi-parameters but excluding the hash fragment with a
+   * length limit of 5,000 characters. This is often more useful than the
+   * referer URL, because many browsers only send the domain for 3rd party
+   * requests.
+   * 
+ * + * string uri = 3; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * The event timestamp in milliseconds. This prevents browser caching of
+   * otherwise identical get requests. The name is abbreviated to reduce the
+   * payload bytes.
+   * 
+ * + * int64 ets = 4; + * + * @return The ets. + */ + long getEts(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CommonProto.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CommonProto.java new file mode 100644 index 00000000..f6634f99 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CommonProto.java @@ -0,0 +1,124 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +public final class CommonProto { + private CommonProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_CustomAttribute_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_CustomAttribute_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_Image_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_Image_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PriceInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PriceInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_UserInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_UserInfo_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n#google/cloud/retail/v2/common.proto\022\026g" + + "oogle.cloud.retail.v2\032\034google/api/annota" + + "tions.proto\032\037google/api/field_behavior.p" + + "roto\032\037google/protobuf/timestamp.proto\"0\n" + + "\017CustomAttribute\022\014\n\004text\030\001 \003(\t\022\017\n\007number" + + "s\030\002 \003(\001\"8\n\005Image\022\020\n\003uri\030\001 \001(\tB\003\340A\002\022\016\n\006he" + + "ight\030\002 \001(\005\022\r\n\005width\030\003 \001(\005\"W\n\tPriceInfo\022\025" + + "\n\rcurrency_code\030\001 \001(\t\022\r\n\005price\030\002 \001(\002\022\026\n\016" + + "original_price\030\003 \001(\002\022\014\n\004cost\030\004 \001(\002\"`\n\010Us" + + "erInfo\022\017\n\007user_id\030\001 \001(\t\022\022\n\nip_address\030\002 " + + "\001(\t\022\022\n\nuser_agent\030\003 \001(\t\022\033\n\023direct_user_r" + + "equest\030\004 \001(\010B\300\001\n\032com.google.cloud.retail" + + ".v2B\013CommonProtoP\001Z + * Request message for [CreateProduct][] method. + * + * + * Protobuf type {@code google.cloud.retail.v2.CreateProductRequest} + */ +public final class CreateProductRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CreateProductRequest) + CreateProductRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateProductRequest.newBuilder() to construct. + private CreateProductRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateProductRequest() { + parent_ = ""; + productId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateProductRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateProductRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.Product.Builder subBuilder = null; + if (product_ != null) { + subBuilder = product_.toBuilder(); + } + product_ = + input.readMessage(com.google.cloud.retail.v2.Product.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(product_); + product_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + productId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_CreateProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_CreateProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CreateProductRequest.class, + com.google.cloud.retail.v2.CreateProductRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PRODUCT_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.Product product_; + /** + * + * + *
+   * Required. The [Product][google.cloud.retail.v2.Product] to create.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + @java.lang.Override + public boolean hasProduct() { + return product_ != null; + } + /** + * + * + *
+   * Required. The [Product][google.cloud.retail.v2.Product] to create.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product getProduct() { + return product_ == null ? com.google.cloud.retail.v2.Product.getDefaultInstance() : product_; + } + /** + * + * + *
+   * Required. The [Product][google.cloud.retail.v2.Product] to create.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder() { + return getProduct(); + } + + public static final int PRODUCT_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object productId_; + /** + * + * + *
+   * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+   * which will become the final component of the
+   * [Product.name][google.cloud.retail.v2.Product.name].
+   * If the caller does not have permission to create the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * This field must be unique among all
+   * [Product][google.cloud.retail.v2.Product]s with the same
+   * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+   * ALREADY_EXISTS error is returned.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The productId. + */ + @java.lang.Override + public java.lang.String getProductId() { + java.lang.Object ref = productId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + productId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+   * which will become the final component of the
+   * [Product.name][google.cloud.retail.v2.Product.name].
+   * If the caller does not have permission to create the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * This field must be unique among all
+   * [Product][google.cloud.retail.v2.Product]s with the same
+   * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+   * ALREADY_EXISTS error is returned.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for productId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getProductIdBytes() { + java.lang.Object ref = productId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + productId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (product_ != null) { + output.writeMessage(2, getProduct()); + } + if (!getProductIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, productId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (product_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getProduct()); + } + if (!getProductIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, productId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.CreateProductRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.CreateProductRequest other = + (com.google.cloud.retail.v2.CreateProductRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasProduct() != other.hasProduct()) return false; + if (hasProduct()) { + if (!getProduct().equals(other.getProduct())) return false; + } + if (!getProductId().equals(other.getProductId())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasProduct()) { + hash = (37 * hash) + PRODUCT_FIELD_NUMBER; + hash = (53 * hash) + getProduct().hashCode(); + } + hash = (37 * hash) + PRODUCT_ID_FIELD_NUMBER; + hash = (53 * hash) + getProductId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateProductRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.CreateProductRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for [CreateProduct][] method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CreateProductRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CreateProductRequest) + com.google.cloud.retail.v2.CreateProductRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_CreateProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_CreateProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CreateProductRequest.class, + com.google.cloud.retail.v2.CreateProductRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.CreateProductRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (productBuilder_ == null) { + product_ = null; + } else { + product_ = null; + productBuilder_ = null; + } + productId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_CreateProductRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateProductRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.CreateProductRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateProductRequest build() { + com.google.cloud.retail.v2.CreateProductRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateProductRequest buildPartial() { + com.google.cloud.retail.v2.CreateProductRequest result = + new com.google.cloud.retail.v2.CreateProductRequest(this); + result.parent_ = parent_; + if (productBuilder_ == null) { + result.product_ = product_; + } else { + result.product_ = productBuilder_.build(); + } + result.productId_ = productId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.CreateProductRequest) { + return mergeFrom((com.google.cloud.retail.v2.CreateProductRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.CreateProductRequest other) { + if (other == com.google.cloud.retail.v2.CreateProductRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasProduct()) { + mergeProduct(other.getProduct()); + } + if (!other.getProductId().isEmpty()) { + productId_ = other.productId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.CreateProductRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.CreateProductRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.Product product_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + productBuilder_; + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + public boolean hasProduct() { + return productBuilder_ != null || product_ != null; + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + public com.google.cloud.retail.v2.Product getProduct() { + if (productBuilder_ == null) { + return product_ == null + ? com.google.cloud.retail.v2.Product.getDefaultInstance() + : product_; + } else { + return productBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProduct(com.google.cloud.retail.v2.Product value) { + if (productBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + product_ = value; + onChanged(); + } else { + productBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProduct(com.google.cloud.retail.v2.Product.Builder builderForValue) { + if (productBuilder_ == null) { + product_ = builderForValue.build(); + onChanged(); + } else { + productBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeProduct(com.google.cloud.retail.v2.Product value) { + if (productBuilder_ == null) { + if (product_ != null) { + product_ = + com.google.cloud.retail.v2.Product.newBuilder(product_) + .mergeFrom(value) + .buildPartial(); + } else { + product_ = value; + } + onChanged(); + } else { + productBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearProduct() { + if (productBuilder_ == null) { + product_ = null; + onChanged(); + } else { + product_ = null; + productBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Product.Builder getProductBuilder() { + + onChanged(); + return getProductFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder() { + if (productBuilder_ != null) { + return productBuilder_.getMessageOrBuilder(); + } else { + return product_ == null + ? com.google.cloud.retail.v2.Product.getDefaultInstance() + : product_; + } + } + /** + * + * + *
+     * Required. The [Product][google.cloud.retail.v2.Product] to create.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + getProductFieldBuilder() { + if (productBuilder_ == null) { + productBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder>( + getProduct(), getParentForChildren(), isClean()); + product_ = null; + } + return productBuilder_; + } + + private java.lang.Object productId_ = ""; + /** + * + * + *
+     * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+     * which will become the final component of the
+     * [Product.name][google.cloud.retail.v2.Product.name].
+     * If the caller does not have permission to create the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * This field must be unique among all
+     * [Product][google.cloud.retail.v2.Product]s with the same
+     * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+     * ALREADY_EXISTS error is returned.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The productId. + */ + public java.lang.String getProductId() { + java.lang.Object ref = productId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + productId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+     * which will become the final component of the
+     * [Product.name][google.cloud.retail.v2.Product.name].
+     * If the caller does not have permission to create the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * This field must be unique among all
+     * [Product][google.cloud.retail.v2.Product]s with the same
+     * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+     * ALREADY_EXISTS error is returned.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for productId. + */ + public com.google.protobuf.ByteString getProductIdBytes() { + java.lang.Object ref = productId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + productId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+     * which will become the final component of the
+     * [Product.name][google.cloud.retail.v2.Product.name].
+     * If the caller does not have permission to create the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * This field must be unique among all
+     * [Product][google.cloud.retail.v2.Product]s with the same
+     * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+     * ALREADY_EXISTS error is returned.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The productId to set. + * @return This builder for chaining. + */ + public Builder setProductId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + productId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+     * which will become the final component of the
+     * [Product.name][google.cloud.retail.v2.Product.name].
+     * If the caller does not have permission to create the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * This field must be unique among all
+     * [Product][google.cloud.retail.v2.Product]s with the same
+     * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+     * ALREADY_EXISTS error is returned.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearProductId() { + + productId_ = getDefaultInstance().getProductId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+     * which will become the final component of the
+     * [Product.name][google.cloud.retail.v2.Product.name].
+     * If the caller does not have permission to create the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * This field must be unique among all
+     * [Product][google.cloud.retail.v2.Product]s with the same
+     * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+     * ALREADY_EXISTS error is returned.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for productId to set. + * @return This builder for chaining. + */ + public Builder setProductIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + productId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CreateProductRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CreateProductRequest) + private static final com.google.cloud.retail.v2.CreateProductRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CreateProductRequest(); + } + + public static com.google.cloud.retail.v2.CreateProductRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateProductRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateProductRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateProductRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateProductRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateProductRequestOrBuilder.java new file mode 100644 index 00000000..6acc8c4e --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateProductRequestOrBuilder.java @@ -0,0 +1,141 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product_service.proto + +package com.google.cloud.retail.v2; + +public interface CreateProductRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.CreateProductRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The [Product][google.cloud.retail.v2.Product] to create.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + boolean hasProduct(); + /** + * + * + *
+   * Required. The [Product][google.cloud.retail.v2.Product] to create.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + com.google.cloud.retail.v2.Product getProduct(); + /** + * + * + *
+   * Required. The [Product][google.cloud.retail.v2.Product] to create.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder(); + + /** + * + * + *
+   * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+   * which will become the final component of the
+   * [Product.name][google.cloud.retail.v2.Product.name].
+   * If the caller does not have permission to create the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * This field must be unique among all
+   * [Product][google.cloud.retail.v2.Product]s with the same
+   * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+   * ALREADY_EXISTS error is returned.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The productId. + */ + java.lang.String getProductId(); + /** + * + * + *
+   * Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
+   * which will become the final component of the
+   * [Product.name][google.cloud.retail.v2.Product.name].
+   * If the caller does not have permission to create the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * This field must be unique among all
+   * [Product][google.cloud.retail.v2.Product]s with the same
+   * [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
+   * ALREADY_EXISTS error is returned.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string product_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for productId. + */ + com.google.protobuf.ByteString getProductIdBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttribute.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttribute.java new file mode 100644 index 00000000..18f6e067 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttribute.java @@ -0,0 +1,1130 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * A custom attribute that is not explicitly modeled in
+ * [Product][google.cloud.retail.v2.Product]].
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CustomAttribute} + */ +public final class CustomAttribute extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CustomAttribute) + CustomAttributeOrBuilder { + private static final long serialVersionUID = 0L; + // Use CustomAttribute.newBuilder() to construct. + private CustomAttribute(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CustomAttribute() { + text_ = com.google.protobuf.LazyStringArrayList.EMPTY; + numbers_ = emptyDoubleList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CustomAttribute(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CustomAttribute( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + text_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + text_.add(s); + break; + } + case 17: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + numbers_ = newDoubleList(); + mutable_bitField0_ |= 0x00000002; + } + numbers_.addDouble(input.readDouble()); + break; + } + case 18: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { + numbers_ = newDoubleList(); + mutable_bitField0_ |= 0x00000002; + } + while (input.getBytesUntilLimit() > 0) { + numbers_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + text_ = text_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + numbers_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_CustomAttribute_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_CustomAttribute_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CustomAttribute.class, + com.google.cloud.retail.v2.CustomAttribute.Builder.class); + } + + public static final int TEXT_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList text_; + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @return A list containing the text. + */ + public com.google.protobuf.ProtocolStringList getTextList() { + return text_; + } + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @return The count of text. + */ + public int getTextCount() { + return text_.size(); + } + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @param index The index of the element to return. + * @return The text at the given index. + */ + public java.lang.String getText(int index) { + return text_.get(index); + } + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @param index The index of the value to return. + * @return The bytes of the text at the given index. + */ + public com.google.protobuf.ByteString getTextBytes(int index) { + return text_.getByteString(index); + } + + public static final int NUMBERS_FIELD_NUMBER = 2; + private com.google.protobuf.Internal.DoubleList numbers_; + /** + * + * + *
+   * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+   * when the key is "lengths_cm".
+   * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated double numbers = 2; + * + * @return A list containing the numbers. + */ + @java.lang.Override + public java.util.List getNumbersList() { + return numbers_; + } + /** + * + * + *
+   * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+   * when the key is "lengths_cm".
+   * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated double numbers = 2; + * + * @return The count of numbers. + */ + public int getNumbersCount() { + return numbers_.size(); + } + /** + * + * + *
+   * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+   * when the key is "lengths_cm".
+   * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated double numbers = 2; + * + * @param index The index of the element to return. + * @return The numbers at the given index. + */ + public double getNumbers(int index) { + return numbers_.getDouble(index); + } + + private int numbersMemoizedSerializedSize = -1; + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < text_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, text_.getRaw(i)); + } + if (getNumbersList().size() > 0) { + output.writeUInt32NoTag(18); + output.writeUInt32NoTag(numbersMemoizedSerializedSize); + } + for (int i = 0; i < numbers_.size(); i++) { + output.writeDoubleNoTag(numbers_.getDouble(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < text_.size(); i++) { + dataSize += computeStringSizeNoTag(text_.getRaw(i)); + } + size += dataSize; + size += 1 * getTextList().size(); + } + { + int dataSize = 0; + dataSize = 8 * getNumbersList().size(); + size += dataSize; + if (!getNumbersList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + numbersMemoizedSerializedSize = dataSize; + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.CustomAttribute)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.CustomAttribute other = + (com.google.cloud.retail.v2.CustomAttribute) obj; + + if (!getTextList().equals(other.getTextList())) return false; + if (!getNumbersList().equals(other.getNumbersList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getTextCount() > 0) { + hash = (37 * hash) + TEXT_FIELD_NUMBER; + hash = (53 * hash) + getTextList().hashCode(); + } + if (getNumbersCount() > 0) { + hash = (37 * hash) + NUMBERS_FIELD_NUMBER; + hash = (53 * hash) + getNumbersList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CustomAttribute parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.CustomAttribute prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A custom attribute that is not explicitly modeled in
+   * [Product][google.cloud.retail.v2.Product]].
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CustomAttribute} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CustomAttribute) + com.google.cloud.retail.v2.CustomAttributeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_CustomAttribute_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_CustomAttribute_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CustomAttribute.class, + com.google.cloud.retail.v2.CustomAttribute.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.CustomAttribute.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + text_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + numbers_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_CustomAttribute_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getDefaultInstanceForType() { + return com.google.cloud.retail.v2.CustomAttribute.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute build() { + com.google.cloud.retail.v2.CustomAttribute result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute buildPartial() { + com.google.cloud.retail.v2.CustomAttribute result = + new com.google.cloud.retail.v2.CustomAttribute(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + text_ = text_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.text_ = text_; + if (((bitField0_ & 0x00000002) != 0)) { + numbers_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.numbers_ = numbers_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.CustomAttribute) { + return mergeFrom((com.google.cloud.retail.v2.CustomAttribute) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.CustomAttribute other) { + if (other == com.google.cloud.retail.v2.CustomAttribute.getDefaultInstance()) return this; + if (!other.text_.isEmpty()) { + if (text_.isEmpty()) { + text_ = other.text_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTextIsMutable(); + text_.addAll(other.text_); + } + onChanged(); + } + if (!other.numbers_.isEmpty()) { + if (numbers_.isEmpty()) { + numbers_ = other.numbers_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureNumbersIsMutable(); + numbers_.addAll(other.numbers_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.CustomAttribute parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.CustomAttribute) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList text_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureTextIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + text_ = new com.google.protobuf.LazyStringArrayList(text_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @return A list containing the text. + */ + public com.google.protobuf.ProtocolStringList getTextList() { + return text_.getUnmodifiableView(); + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @return The count of text. + */ + public int getTextCount() { + return text_.size(); + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @param index The index of the element to return. + * @return The text at the given index. + */ + public java.lang.String getText(int index) { + return text_.get(index); + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @param index The index of the value to return. + * @return The bytes of the text at the given index. + */ + public com.google.protobuf.ByteString getTextBytes(int index) { + return text_.getByteString(index); + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @param index The index to set the value at. + * @param value The text to set. + * @return This builder for chaining. + */ + public Builder setText(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTextIsMutable(); + text_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @param value The text to add. + * @return This builder for chaining. + */ + public Builder addText(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTextIsMutable(); + text_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @param values The text to add. + * @return This builder for chaining. + */ + public Builder addAllText(java.lang.Iterable values) { + ensureTextIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, text_); + onChanged(); + return this; + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @return This builder for chaining. + */ + public Builder clearText() { + text_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * The textual values of this custom attribute. For example, `["yellow",
+     * "green"]` when the key is "color".
+     * At most 400 values are allowed. Empty values are not allowed. Each value
+     * must be a UTF-8 encoded string with a length limit of 256 characters.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string text = 1; + * + * @param value The bytes of the text to add. + * @return This builder for chaining. + */ + public Builder addTextBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTextIsMutable(); + text_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList numbers_ = emptyDoubleList(); + + private void ensureNumbersIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + numbers_ = mutableCopy(numbers_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+     * when the key is "lengths_cm".
+     * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated double numbers = 2; + * + * @return A list containing the numbers. + */ + public java.util.List getNumbersList() { + return ((bitField0_ & 0x00000002) != 0) + ? java.util.Collections.unmodifiableList(numbers_) + : numbers_; + } + /** + * + * + *
+     * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+     * when the key is "lengths_cm".
+     * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated double numbers = 2; + * + * @return The count of numbers. + */ + public int getNumbersCount() { + return numbers_.size(); + } + /** + * + * + *
+     * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+     * when the key is "lengths_cm".
+     * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated double numbers = 2; + * + * @param index The index of the element to return. + * @return The numbers at the given index. + */ + public double getNumbers(int index) { + return numbers_.getDouble(index); + } + /** + * + * + *
+     * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+     * when the key is "lengths_cm".
+     * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated double numbers = 2; + * + * @param index The index to set the value at. + * @param value The numbers to set. + * @return This builder for chaining. + */ + public Builder setNumbers(int index, double value) { + ensureNumbersIsMutable(); + numbers_.setDouble(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+     * when the key is "lengths_cm".
+     * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated double numbers = 2; + * + * @param value The numbers to add. + * @return This builder for chaining. + */ + public Builder addNumbers(double value) { + ensureNumbersIsMutable(); + numbers_.addDouble(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+     * when the key is "lengths_cm".
+     * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated double numbers = 2; + * + * @param values The numbers to add. + * @return This builder for chaining. + */ + public Builder addAllNumbers(java.lang.Iterable values) { + ensureNumbersIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, numbers_); + onChanged(); + return this; + } + /** + * + * + *
+     * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+     * when the key is "lengths_cm".
+     * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+     * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated double numbers = 2; + * + * @return This builder for chaining. + */ + public Builder clearNumbers() { + numbers_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CustomAttribute) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CustomAttribute) + private static final com.google.cloud.retail.v2.CustomAttribute DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CustomAttribute(); + } + + public static com.google.cloud.retail.v2.CustomAttribute getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CustomAttribute parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CustomAttribute(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttributeOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttributeOrBuilder.java new file mode 100644 index 00000000..73b49c84 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttributeOrBuilder.java @@ -0,0 +1,160 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +public interface CustomAttributeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.CustomAttribute) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @return A list containing the text. + */ + java.util.List getTextList(); + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @return The count of text. + */ + int getTextCount(); + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @param index The index of the element to return. + * @return The text at the given index. + */ + java.lang.String getText(int index); + /** + * + * + *
+   * The textual values of this custom attribute. For example, `["yellow",
+   * "green"]` when the key is "color".
+   * At most 400 values are allowed. Empty values are not allowed. Each value
+   * must be a UTF-8 encoded string with a length limit of 256 characters.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string text = 1; + * + * @param index The index of the value to return. + * @return The bytes of the text at the given index. + */ + com.google.protobuf.ByteString getTextBytes(int index); + + /** + * + * + *
+   * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+   * when the key is "lengths_cm".
+   * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated double numbers = 2; + * + * @return A list containing the numbers. + */ + java.util.List getNumbersList(); + /** + * + * + *
+   * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+   * when the key is "lengths_cm".
+   * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated double numbers = 2; + * + * @return The count of numbers. + */ + int getNumbersCount(); + /** + * + * + *
+   * The numerical values of this custom attribute. For example, `[2.3, 15.4]`
+   * when the key is "lengths_cm".
+   * At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
+   * [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated double numbers = 2; + * + * @param index The index of the element to return. + * @return The numbers at the given index. + */ + double getNumbers(int index); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteProductRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteProductRequest.java new file mode 100644 index 00000000..3c544868 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteProductRequest.java @@ -0,0 +1,698 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for [DeleteProduct][] method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.DeleteProductRequest} + */ +public final class DeleteProductRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.DeleteProductRequest) + DeleteProductRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteProductRequest.newBuilder() to construct. + private DeleteProductRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteProductRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteProductRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteProductRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_DeleteProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_DeleteProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.DeleteProductRequest.class, + com.google.cloud.retail.v2.DeleteProductRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to delete the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to delete the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.DeleteProductRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.DeleteProductRequest other = + (com.google.cloud.retail.v2.DeleteProductRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.DeleteProductRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for [DeleteProduct][] method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.DeleteProductRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.DeleteProductRequest) + com.google.cloud.retail.v2.DeleteProductRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_DeleteProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_DeleteProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.DeleteProductRequest.class, + com.google.cloud.retail.v2.DeleteProductRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.DeleteProductRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_DeleteProductRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteProductRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.DeleteProductRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteProductRequest build() { + com.google.cloud.retail.v2.DeleteProductRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteProductRequest buildPartial() { + com.google.cloud.retail.v2.DeleteProductRequest result = + new com.google.cloud.retail.v2.DeleteProductRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.DeleteProductRequest) { + return mergeFrom((com.google.cloud.retail.v2.DeleteProductRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.DeleteProductRequest other) { + if (other == com.google.cloud.retail.v2.DeleteProductRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.DeleteProductRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.DeleteProductRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to delete the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to delete the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to delete the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to delete the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to delete the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.DeleteProductRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.DeleteProductRequest) + private static final com.google.cloud.retail.v2.DeleteProductRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.DeleteProductRequest(); + } + + public static com.google.cloud.retail.v2.DeleteProductRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteProductRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteProductRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteProductRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteProductRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteProductRequestOrBuilder.java new file mode 100644 index 00000000..7170d60c --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteProductRequestOrBuilder.java @@ -0,0 +1,68 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product_service.proto + +package com.google.cloud.retail.v2; + +public interface DeleteProductRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.DeleteProductRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to delete the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to delete the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSource.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSource.java new file mode 100644 index 00000000..32c28dc3 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSource.java @@ -0,0 +1,1068 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Google Cloud Storage location for input content.
+ * format.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GcsSource} + */ +public final class GcsSource extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.GcsSource) + GcsSourceOrBuilder { + private static final long serialVersionUID = 0L; + // Use GcsSource.newBuilder() to construct. + private GcsSource(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GcsSource() { + inputUris_ = com.google.protobuf.LazyStringArrayList.EMPTY; + dataSchema_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GcsSource(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GcsSource( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + inputUris_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + inputUris_.add(s); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + dataSchema_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + inputUris_ = inputUris_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_GcsSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_GcsSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GcsSource.class, + com.google.cloud.retail.v2.GcsSource.Builder.class); + } + + public static final int INPUT_URIS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList inputUris_; + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return A list containing the inputUris. + */ + public com.google.protobuf.ProtocolStringList getInputUrisList() { + return inputUris_; + } + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The count of inputUris. + */ + public int getInputUrisCount() { + return inputUris_.size(); + } + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the element to return. + * @return The inputUris at the given index. + */ + public java.lang.String getInputUris(int index) { + return inputUris_.get(index); + } + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the value to return. + * @return The bytes of the inputUris at the given index. + */ + public com.google.protobuf.ByteString getInputUrisBytes(int index) { + return inputUris_.getByteString(index); + } + + public static final int DATA_SCHEMA_FIELD_NUMBER = 2; + private volatile java.lang.Object dataSchema_; + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 2; + * + * @return The dataSchema. + */ + @java.lang.Override + public java.lang.String getDataSchema() { + java.lang.Object ref = dataSchema_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + dataSchema_ = s; + return s; + } + } + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 2; + * + * @return The bytes for dataSchema. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDataSchemaBytes() { + java.lang.Object ref = dataSchema_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + dataSchema_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < inputUris_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, inputUris_.getRaw(i)); + } + if (!getDataSchemaBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, dataSchema_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < inputUris_.size(); i++) { + dataSize += computeStringSizeNoTag(inputUris_.getRaw(i)); + } + size += dataSize; + size += 1 * getInputUrisList().size(); + } + if (!getDataSchemaBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, dataSchema_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.GcsSource)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.GcsSource other = (com.google.cloud.retail.v2.GcsSource) obj; + + if (!getInputUrisList().equals(other.getInputUrisList())) return false; + if (!getDataSchema().equals(other.getDataSchema())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getInputUrisCount() > 0) { + hash = (37 * hash) + INPUT_URIS_FIELD_NUMBER; + hash = (53 * hash) + getInputUrisList().hashCode(); + } + hash = (37 * hash) + DATA_SCHEMA_FIELD_NUMBER; + hash = (53 * hash) + getDataSchema().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GcsSource parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GcsSource parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GcsSource parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.GcsSource prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Google Cloud Storage location for input content.
+   * format.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GcsSource} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.GcsSource) + com.google.cloud.retail.v2.GcsSourceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_GcsSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_GcsSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GcsSource.class, + com.google.cloud.retail.v2.GcsSource.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.GcsSource.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + inputUris_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + dataSchema_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_GcsSource_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource getDefaultInstanceForType() { + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource build() { + com.google.cloud.retail.v2.GcsSource result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource buildPartial() { + com.google.cloud.retail.v2.GcsSource result = new com.google.cloud.retail.v2.GcsSource(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + inputUris_ = inputUris_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.inputUris_ = inputUris_; + result.dataSchema_ = dataSchema_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.GcsSource) { + return mergeFrom((com.google.cloud.retail.v2.GcsSource) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.GcsSource other) { + if (other == com.google.cloud.retail.v2.GcsSource.getDefaultInstance()) return this; + if (!other.inputUris_.isEmpty()) { + if (inputUris_.isEmpty()) { + inputUris_ = other.inputUris_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureInputUrisIsMutable(); + inputUris_.addAll(other.inputUris_); + } + onChanged(); + } + if (!other.getDataSchema().isEmpty()) { + dataSchema_ = other.dataSchema_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.GcsSource parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.GcsSource) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList inputUris_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureInputUrisIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + inputUris_ = new com.google.protobuf.LazyStringArrayList(inputUris_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return A list containing the inputUris. + */ + public com.google.protobuf.ProtocolStringList getInputUrisList() { + return inputUris_.getUnmodifiableView(); + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The count of inputUris. + */ + public int getInputUrisCount() { + return inputUris_.size(); + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the element to return. + * @return The inputUris at the given index. + */ + public java.lang.String getInputUris(int index) { + return inputUris_.get(index); + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the value to return. + * @return The bytes of the inputUris at the given index. + */ + public com.google.protobuf.ByteString getInputUrisBytes(int index) { + return inputUris_.getByteString(index); + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index to set the value at. + * @param value The inputUris to set. + * @return This builder for chaining. + */ + public Builder setInputUris(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputUrisIsMutable(); + inputUris_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The inputUris to add. + * @return This builder for chaining. + */ + public Builder addInputUris(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputUrisIsMutable(); + inputUris_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param values The inputUris to add. + * @return This builder for chaining. + */ + public Builder addAllInputUris(java.lang.Iterable values) { + ensureInputUrisIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, inputUris_); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearInputUris() { + inputUris_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage URIs to input files. URI can be up to
+     * 2000 characters long. URIs can match the full object path (for example,
+     * gs://bucket/directory/object.json) or a pattern matching one or more
+     * files, such as gs://bucket/directory/*.json. A request can
+     * contain at most 100 files, and each file can be up to 2 GB. See
+     * [Importing product information](/recommendations-ai/docs/upload-catalog)
+     * for the expected file format and setup instructions.
+     * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes of the inputUris to add. + * @return This builder for chaining. + */ + public Builder addInputUrisBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureInputUrisIsMutable(); + inputUris_.add(value); + onChanged(); + return this; + } + + private java.lang.Object dataSchema_ = ""; + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 2; + * + * @return The dataSchema. + */ + public java.lang.String getDataSchema() { + java.lang.Object ref = dataSchema_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + dataSchema_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 2; + * + * @return The bytes for dataSchema. + */ + public com.google.protobuf.ByteString getDataSchemaBytes() { + java.lang.Object ref = dataSchema_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + dataSchema_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 2; + * + * @param value The dataSchema to set. + * @return This builder for chaining. + */ + public Builder setDataSchema(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + dataSchema_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 2; + * + * @return This builder for chaining. + */ + public Builder clearDataSchema() { + + dataSchema_ = getDefaultInstance().getDataSchema(); + onChanged(); + return this; + } + /** + * + * + *
+     * The schema to use when parsing the data from the source.
+     * Supported values for product imports:
+     * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+     * per line. Each product must
+     *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+     * * `product_merchant_center`: See [Importing catalog data from Merchant
+     *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+     * Supported values for user events imports:
+     * * `user_event` (default): One JSON
+     * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+     * * `user_event_ga360`: Using
+     *   https://support.google.com/analytics/answer/3437719?hl=en.
+     * 
+ * + * string data_schema = 2; + * + * @param value The bytes for dataSchema to set. + * @return This builder for chaining. + */ + public Builder setDataSchemaBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + dataSchema_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.GcsSource) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.GcsSource) + private static final com.google.cloud.retail.v2.GcsSource DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.GcsSource(); + } + + public static com.google.cloud.retail.v2.GcsSource getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GcsSource parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GcsSource(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSourceOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSourceOrBuilder.java new file mode 100644 index 00000000..2ac80327 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSourceOrBuilder.java @@ -0,0 +1,147 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface GcsSourceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.GcsSource) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return A list containing the inputUris. + */ + java.util.List getInputUrisList(); + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The count of inputUris. + */ + int getInputUrisCount(); + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the element to return. + * @return The inputUris at the given index. + */ + java.lang.String getInputUris(int index); + /** + * + * + *
+   * Required. Google Cloud Storage URIs to input files. URI can be up to
+   * 2000 characters long. URIs can match the full object path (for example,
+   * gs://bucket/directory/object.json) or a pattern matching one or more
+   * files, such as gs://bucket/directory/*.json. A request can
+   * contain at most 100 files, and each file can be up to 2 GB. See
+   * [Importing product information](/recommendations-ai/docs/upload-catalog)
+   * for the expected file format and setup instructions.
+   * 
+ * + * repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the value to return. + * @return The bytes of the inputUris at the given index. + */ + com.google.protobuf.ByteString getInputUrisBytes(int index); + + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 2; + * + * @return The dataSchema. + */ + java.lang.String getDataSchema(); + /** + * + * + *
+   * The schema to use when parsing the data from the source.
+   * Supported values for product imports:
+   * * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
+   * per line. Each product must
+   *   have a valid [Product.id][google.cloud.retail.v2.Product.id].
+   * * `product_merchant_center`: See [Importing catalog data from Merchant
+   *   Center](/retail/recommendations-ai/docs/upload-catalog#mc).
+   * Supported values for user events imports:
+   * * `user_event` (default): One JSON
+   * [UserEvent][google.cloud.retail.v2.UserEvent] per line.
+   * * `user_event_ga360`: Using
+   *   https://support.google.com/analytics/answer/3437719?hl=en.
+   * 
+ * + * string data_schema = 2; + * + * @return The bytes for dataSchema. + */ + com.google.protobuf.ByteString getDataSchemaBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetProductRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetProductRequest.java new file mode 100644 index 00000000..a233d474 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetProductRequest.java @@ -0,0 +1,697 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for [GetProduct][] method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetProductRequest} + */ +public final class GetProductRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.GetProductRequest) + GetProductRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetProductRequest.newBuilder() to construct. + private GetProductRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetProductRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetProductRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetProductRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_GetProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_GetProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetProductRequest.class, + com.google.cloud.retail.v2.GetProductRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to access the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to access the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.GetProductRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.GetProductRequest other = + (com.google.cloud.retail.v2.GetProductRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetProductRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.GetProductRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for [GetProduct][] method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetProductRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.GetProductRequest) + com.google.cloud.retail.v2.GetProductRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_GetProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_GetProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetProductRequest.class, + com.google.cloud.retail.v2.GetProductRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.GetProductRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_GetProductRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetProductRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.GetProductRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetProductRequest build() { + com.google.cloud.retail.v2.GetProductRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetProductRequest buildPartial() { + com.google.cloud.retail.v2.GetProductRequest result = + new com.google.cloud.retail.v2.GetProductRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.GetProductRequest) { + return mergeFrom((com.google.cloud.retail.v2.GetProductRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.GetProductRequest other) { + if (other == com.google.cloud.retail.v2.GetProductRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.GetProductRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.GetProductRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to access the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to access the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to access the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to access the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+     * such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+     * If the caller does not have permission to access the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.GetProductRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.GetProductRequest) + private static final com.google.cloud.retail.v2.GetProductRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.GetProductRequest(); + } + + public static com.google.cloud.retail.v2.GetProductRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetProductRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetProductRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetProductRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetProductRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetProductRequestOrBuilder.java new file mode 100644 index 00000000..c61a0366 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetProductRequestOrBuilder.java @@ -0,0 +1,68 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product_service.proto + +package com.google.cloud.retail.v2; + +public interface GetProductRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.GetProductRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to access the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Full resource name of [Product][google.cloud.retail.v2.Product],
+   * such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
+   * If the caller does not have permission to access the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the requested [Product][google.cloud.retail.v2.Product] does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Image.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Image.java new file mode 100644 index 00000000..66bcb461 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Image.java @@ -0,0 +1,861 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * [Product][google.cloud.retail.v2.Product] thumbnail/detail image.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Image} + */ +public final class Image extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Image) + ImageOrBuilder { + private static final long serialVersionUID = 0L; + // Use Image.newBuilder() to construct. + private Image(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Image() { + uri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Image(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Image( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + case 16: + { + height_ = input.readInt32(); + break; + } + case 24: + { + width_ = input.readInt32(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Image_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Image_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Image.class, com.google.cloud.retail.v2.Image.Builder.class); + } + + public static final int URI_FIELD_NUMBER = 1; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * Required. URI of the image.
+   * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * Required. URI of the image.
+   * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int HEIGHT_FIELD_NUMBER = 2; + private int height_; + /** + * + * + *
+   * Height of the image in number of pixels.
+   * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * 
+ * + * int32 height = 2; + * + * @return The height. + */ + @java.lang.Override + public int getHeight() { + return height_; + } + + public static final int WIDTH_FIELD_NUMBER = 3; + private int width_; + /** + * + * + *
+   * Width of the image in number of pixels.
+   * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * 
+ * + * int32 width = 3; + * + * @return The width. + */ + @java.lang.Override + public int getWidth() { + return width_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, uri_); + } + if (height_ != 0) { + output.writeInt32(2, height_); + } + if (width_ != 0) { + output.writeInt32(3, width_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, uri_); + } + if (height_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, height_); + } + if (width_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, width_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Image)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Image other = (com.google.cloud.retail.v2.Image) obj; + + if (!getUri().equals(other.getUri())) return false; + if (getHeight() != other.getHeight()) return false; + if (getWidth() != other.getWidth()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (37 * hash) + HEIGHT_FIELD_NUMBER; + hash = (53 * hash) + getHeight(); + hash = (37 * hash) + WIDTH_FIELD_NUMBER; + hash = (53 * hash) + getWidth(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Image parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Image parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Image parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Image parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Image parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Image parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Image parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Image parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Image parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Image parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Image parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Image parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Image prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * [Product][google.cloud.retail.v2.Product] thumbnail/detail image.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Image} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Image) + com.google.cloud.retail.v2.ImageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Image_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Image_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Image.class, + com.google.cloud.retail.v2.Image.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Image.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + uri_ = ""; + + height_ = 0; + + width_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Image_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Image getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Image.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Image build() { + com.google.cloud.retail.v2.Image result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Image buildPartial() { + com.google.cloud.retail.v2.Image result = new com.google.cloud.retail.v2.Image(this); + result.uri_ = uri_; + result.height_ = height_; + result.width_ = width_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Image) { + return mergeFrom((com.google.cloud.retail.v2.Image) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Image other) { + if (other == com.google.cloud.retail.v2.Image.getDefaultInstance()) return this; + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + if (other.getHeight() != 0) { + setHeight(other.getHeight()); + } + if (other.getWidth() != 0) { + setWidth(other.getWidth()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Image parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Image) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * Required. URI of the image.
+     * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. URI of the image.
+     * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. URI of the image.
+     * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. URI of the image.
+     * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. URI of the image.
+     * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = value; + onChanged(); + return this; + } + + private int height_; + /** + * + * + *
+     * Height of the image in number of pixels.
+     * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * 
+ * + * int32 height = 2; + * + * @return The height. + */ + @java.lang.Override + public int getHeight() { + return height_; + } + /** + * + * + *
+     * Height of the image in number of pixels.
+     * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * 
+ * + * int32 height = 2; + * + * @param value The height to set. + * @return This builder for chaining. + */ + public Builder setHeight(int value) { + + height_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Height of the image in number of pixels.
+     * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * 
+ * + * int32 height = 2; + * + * @return This builder for chaining. + */ + public Builder clearHeight() { + + height_ = 0; + onChanged(); + return this; + } + + private int width_; + /** + * + * + *
+     * Width of the image in number of pixels.
+     * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * 
+ * + * int32 width = 3; + * + * @return The width. + */ + @java.lang.Override + public int getWidth() { + return width_; + } + /** + * + * + *
+     * Width of the image in number of pixels.
+     * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * 
+ * + * int32 width = 3; + * + * @param value The width to set. + * @return This builder for chaining. + */ + public Builder setWidth(int value) { + + width_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Width of the image in number of pixels.
+     * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+     * returned.
+     * 
+ * + * int32 width = 3; + * + * @return This builder for chaining. + */ + public Builder clearWidth() { + + width_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Image) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Image) + private static final com.google.cloud.retail.v2.Image DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Image(); + } + + public static com.google.cloud.retail.v2.Image getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Image parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Image(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Image getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImageOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImageOrBuilder.java new file mode 100644 index 00000000..180eb9d5 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImageOrBuilder.java @@ -0,0 +1,90 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +public interface ImageOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Image) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. URI of the image.
+   * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * Required. URI of the image.
+   * This field must be a valid UTF-8 encoded URI with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * Height of the image in number of pixels.
+   * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * 
+ * + * int32 height = 2; + * + * @return The height. + */ + int getHeight(); + + /** + * + * + *
+   * Width of the image in number of pixels.
+   * This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
+   * returned.
+   * 
+ * + * int32 width = 3; + * + * @return The width. + */ + int getWidth(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportConfigProto.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportConfigProto.java new file mode 100644 index 00000000..d912605f --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportConfigProto.java @@ -0,0 +1,285 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public final class ImportConfigProto { + private ImportConfigProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_GcsSource_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_GcsSource_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_BigQuerySource_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_BigQuerySource_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ProductInlineSource_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ProductInlineSource_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_UserEventInlineSource_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_UserEventInlineSource_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ImportErrorsConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ImportErrorsConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ImportProductsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ImportProductsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ImportUserEventsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ImportUserEventsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ProductInputConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ProductInputConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_UserEventInputConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_UserEventInputConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ImportMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ImportMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ImportProductsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ImportProductsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ImportUserEventsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ImportUserEventsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_UserEventImportSummary_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_UserEventImportSummary_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n*google/cloud/retail/v2/import_config.p" + + "roto\022\026google.cloud.retail.v2\032\034google/api" + + "/annotations.proto\032\037google/api/field_beh" + + "avior.proto\032$google/cloud/retail/v2/prod" + + "uct.proto\032\'google/cloud/retail/v2/user_e" + + "vent.proto\032 google/protobuf/field_mask.p" + + "roto\032\037google/protobuf/timestamp.proto\032\027g" + + "oogle/rpc/status.proto\"9\n\tGcsSource\022\027\n\ni" + + "nput_uris\030\001 \003(\tB\003\340A\002\022\023\n\013data_schema\030\002 \001(" + + "\t\"\202\001\n\016BigQuerySource\022\022\n\nproject_id\030\005 \001(\t" + + "\022\027\n\ndataset_id\030\001 \001(\tB\003\340A\002\022\025\n\010table_id\030\002 " + + "\001(\tB\003\340A\002\022\027\n\017gcs_staging_dir\030\003 \001(\t\022\023\n\013dat" + + "a_schema\030\004 \001(\t\"M\n\023ProductInlineSource\0226\n" + + "\010products\030\001 \003(\0132\037.google.cloud.retail.v2" + + ".ProductB\003\340A\002\"T\n\025UserEventInlineSource\022;" + + "\n\013user_events\030\001 \003(\0132!.google.cloud.retai" + + "l.v2.UserEventB\003\340A\002\"9\n\022ImportErrorsConfi" + + "g\022\024\n\ngcs_prefix\030\001 \001(\tH\000B\r\n\013destination\"\347" + + "\001\n\025ImportProductsRequest\022\023\n\006parent\030\001 \001(\t" + + "B\003\340A\002\022E\n\014input_config\030\002 \001(\0132*.google.clo" + + "ud.retail.v2.ProductInputConfigB\003\340A\002\022A\n\r" + + "errors_config\030\003 \001(\0132*.google.cloud.retai" + + "l.v2.ImportErrorsConfig\022/\n\013update_mask\030\004" + + " \001(\0132\032.google.protobuf.FieldMask\"\272\001\n\027Imp" + + "ortUserEventsRequest\022\023\n\006parent\030\001 \001(\tB\003\340A" + + "\002\022G\n\014input_config\030\002 \001(\0132,.google.cloud.r" + + "etail.v2.UserEventInputConfigB\003\340A\002\022A\n\rer" + + "rors_config\030\003 \001(\0132*.google.cloud.retail." + + "v2.ImportErrorsConfig\"\351\001\n\022ProductInputCo" + + "nfig\022L\n\025product_inline_source\030\001 \001(\0132+.go" + + "ogle.cloud.retail.v2.ProductInlineSource" + + "H\000\0227\n\ngcs_source\030\002 \001(\0132!.google.cloud.re" + + "tail.v2.GcsSourceH\000\022B\n\020big_query_source\030" + + "\003 \001(\0132&.google.cloud.retail.v2.BigQueryS" + + "ourceH\000B\010\n\006source\"\377\001\n\024UserEventInputConf" + + "ig\022V\n\030user_event_inline_source\030\001 \001(\0132-.g" + + "oogle.cloud.retail.v2.UserEventInlineSou" + + "rceB\003\340A\002H\000\022<\n\ngcs_source\030\002 \001(\0132!.google." + + "cloud.retail.v2.GcsSourceB\003\340A\002H\000\022G\n\020big_" + + "query_source\030\003 \001(\0132&.google.cloud.retail" + + ".v2.BigQuerySourceB\003\340A\002H\000B\010\n\006source\"\240\001\n\016" + + "ImportMetadata\022/\n\013create_time\030\001 \001(\0132\032.go" + + "ogle.protobuf.Timestamp\022/\n\013update_time\030\002" + + " \001(\0132\032.google.protobuf.Timestamp\022\025\n\rsucc" + + "ess_count\030\003 \001(\003\022\025\n\rfailure_count\030\004 \001(\003\"\206" + + "\001\n\026ImportProductsResponse\022)\n\rerror_sampl" + + "es\030\001 \003(\0132\022.google.rpc.Status\022A\n\rerrors_c" + + "onfig\030\002 \001(\0132*.google.cloud.retail.v2.Imp" + + "ortErrorsConfig\"\320\001\n\030ImportUserEventsResp" + + "onse\022)\n\rerror_samples\030\001 \003(\0132\022.google.rpc" + + ".Status\022A\n\rerrors_config\030\002 \001(\0132*.google." + + "cloud.retail.v2.ImportErrorsConfig\022F\n\016im" + + "port_summary\030\003 \001(\0132..google.cloud.retail" + + ".v2.UserEventImportSummary\"T\n\026UserEventI" + + "mportSummary\022\033\n\023joined_events_count\030\001 \001(" + + "\003\022\035\n\025unjoined_events_count\030\002 \001(\003B\306\001\n\032com" + + ".google.cloud.retail.v2B\021ImportConfigPro" + + "toP\001Z + * Configuration of destination for Import related errors. + * + * + * Protobuf type {@code google.cloud.retail.v2.ImportErrorsConfig} + */ +public final class ImportErrorsConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ImportErrorsConfig) + ImportErrorsConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ImportErrorsConfig.newBuilder() to construct. + private ImportErrorsConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ImportErrorsConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ImportErrorsConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ImportErrorsConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + destinationCase_ = 1; + destination_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportErrorsConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportErrorsConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportErrorsConfig.class, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder.class); + } + + private int destinationCase_ = 0; + private java.lang.Object destination_; + + public enum DestinationCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + GCS_PREFIX(1), + DESTINATION_NOT_SET(0); + private final int value; + + private DestinationCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DestinationCase valueOf(int value) { + return forNumber(value); + } + + public static DestinationCase forNumber(int value) { + switch (value) { + case 1: + return GCS_PREFIX; + case 0: + return DESTINATION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public DestinationCase getDestinationCase() { + return DestinationCase.forNumber(destinationCase_); + } + + public static final int GCS_PREFIX_FIELD_NUMBER = 1; + /** + * + * + *
+   * Google Cloud Storage path for import errors. This must be an empty,
+   * existing Cloud Storage bucket. Import errors will be written to a file in
+   * this bucket, one per line, as a JSON-encoded
+   * `google.rpc.Status` message.
+   * 
+ * + * string gcs_prefix = 1; + * + * @return The gcsPrefix. + */ + public java.lang.String getGcsPrefix() { + java.lang.Object ref = ""; + if (destinationCase_ == 1) { + ref = destination_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (destinationCase_ == 1) { + destination_ = s; + } + return s; + } + } + /** + * + * + *
+   * Google Cloud Storage path for import errors. This must be an empty,
+   * existing Cloud Storage bucket. Import errors will be written to a file in
+   * this bucket, one per line, as a JSON-encoded
+   * `google.rpc.Status` message.
+   * 
+ * + * string gcs_prefix = 1; + * + * @return The bytes for gcsPrefix. + */ + public com.google.protobuf.ByteString getGcsPrefixBytes() { + java.lang.Object ref = ""; + if (destinationCase_ == 1) { + ref = destination_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (destinationCase_ == 1) { + destination_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (destinationCase_ == 1) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, destination_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (destinationCase_ == 1) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, destination_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ImportErrorsConfig)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ImportErrorsConfig other = + (com.google.cloud.retail.v2.ImportErrorsConfig) obj; + + if (!getDestinationCase().equals(other.getDestinationCase())) return false; + switch (destinationCase_) { + case 1: + if (!getGcsPrefix().equals(other.getGcsPrefix())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (destinationCase_) { + case 1: + hash = (37 * hash) + GCS_PREFIX_FIELD_NUMBER; + hash = (53 * hash) + getGcsPrefix().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ImportErrorsConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configuration of destination for Import related errors.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportErrorsConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ImportErrorsConfig) + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportErrorsConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportErrorsConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportErrorsConfig.class, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ImportErrorsConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + destinationCase_ = 0; + destination_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportErrorsConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig build() { + com.google.cloud.retail.v2.ImportErrorsConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig buildPartial() { + com.google.cloud.retail.v2.ImportErrorsConfig result = + new com.google.cloud.retail.v2.ImportErrorsConfig(this); + if (destinationCase_ == 1) { + result.destination_ = destination_; + } + result.destinationCase_ = destinationCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ImportErrorsConfig) { + return mergeFrom((com.google.cloud.retail.v2.ImportErrorsConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ImportErrorsConfig other) { + if (other == com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance()) return this; + switch (other.getDestinationCase()) { + case GCS_PREFIX: + { + destinationCase_ = 1; + destination_ = other.destination_; + onChanged(); + break; + } + case DESTINATION_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ImportErrorsConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ImportErrorsConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int destinationCase_ = 0; + private java.lang.Object destination_; + + public DestinationCase getDestinationCase() { + return DestinationCase.forNumber(destinationCase_); + } + + public Builder clearDestination() { + destinationCase_ = 0; + destination_ = null; + onChanged(); + return this; + } + + /** + * + * + *
+     * Google Cloud Storage path for import errors. This must be an empty,
+     * existing Cloud Storage bucket. Import errors will be written to a file in
+     * this bucket, one per line, as a JSON-encoded
+     * `google.rpc.Status` message.
+     * 
+ * + * string gcs_prefix = 1; + * + * @return The gcsPrefix. + */ + @java.lang.Override + public java.lang.String getGcsPrefix() { + java.lang.Object ref = ""; + if (destinationCase_ == 1) { + ref = destination_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (destinationCase_ == 1) { + destination_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Google Cloud Storage path for import errors. This must be an empty,
+     * existing Cloud Storage bucket. Import errors will be written to a file in
+     * this bucket, one per line, as a JSON-encoded
+     * `google.rpc.Status` message.
+     * 
+ * + * string gcs_prefix = 1; + * + * @return The bytes for gcsPrefix. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcsPrefixBytes() { + java.lang.Object ref = ""; + if (destinationCase_ == 1) { + ref = destination_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (destinationCase_ == 1) { + destination_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Google Cloud Storage path for import errors. This must be an empty,
+     * existing Cloud Storage bucket. Import errors will be written to a file in
+     * this bucket, one per line, as a JSON-encoded
+     * `google.rpc.Status` message.
+     * 
+ * + * string gcs_prefix = 1; + * + * @param value The gcsPrefix to set. + * @return This builder for chaining. + */ + public Builder setGcsPrefix(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + destinationCase_ = 1; + destination_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Google Cloud Storage path for import errors. This must be an empty,
+     * existing Cloud Storage bucket. Import errors will be written to a file in
+     * this bucket, one per line, as a JSON-encoded
+     * `google.rpc.Status` message.
+     * 
+ * + * string gcs_prefix = 1; + * + * @return This builder for chaining. + */ + public Builder clearGcsPrefix() { + if (destinationCase_ == 1) { + destinationCase_ = 0; + destination_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Google Cloud Storage path for import errors. This must be an empty,
+     * existing Cloud Storage bucket. Import errors will be written to a file in
+     * this bucket, one per line, as a JSON-encoded
+     * `google.rpc.Status` message.
+     * 
+ * + * string gcs_prefix = 1; + * + * @param value The bytes for gcsPrefix to set. + * @return This builder for chaining. + */ + public Builder setGcsPrefixBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + destinationCase_ = 1; + destination_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ImportErrorsConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ImportErrorsConfig) + private static final com.google.cloud.retail.v2.ImportErrorsConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ImportErrorsConfig(); + } + + public static com.google.cloud.retail.v2.ImportErrorsConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImportErrorsConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ImportErrorsConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfigOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfigOrBuilder.java new file mode 100644 index 00000000..14cfa61b --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfigOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ImportErrorsConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ImportErrorsConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Google Cloud Storage path for import errors. This must be an empty,
+   * existing Cloud Storage bucket. Import errors will be written to a file in
+   * this bucket, one per line, as a JSON-encoded
+   * `google.rpc.Status` message.
+   * 
+ * + * string gcs_prefix = 1; + * + * @return The gcsPrefix. + */ + java.lang.String getGcsPrefix(); + /** + * + * + *
+   * Google Cloud Storage path for import errors. This must be an empty,
+   * existing Cloud Storage bucket. Import errors will be written to a file in
+   * this bucket, one per line, as a JSON-encoded
+   * `google.rpc.Status` message.
+   * 
+ * + * string gcs_prefix = 1; + * + * @return The bytes for gcsPrefix. + */ + com.google.protobuf.ByteString getGcsPrefixBytes(); + + public com.google.cloud.retail.v2.ImportErrorsConfig.DestinationCase getDestinationCase(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadata.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadata.java new file mode 100644 index 00000000..1b971787 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadata.java @@ -0,0 +1,1192 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Metadata related to the progress of the Import operation. This will be
+ * returned by the google.longrunning.Operation.metadata field.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportMetadata} + */ +public final class ImportMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ImportMetadata) + ImportMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use ImportMetadata.newBuilder() to construct. + private ImportMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ImportMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ImportMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ImportMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 24: + { + successCount_ = input.readInt64(); + break; + } + case 32: + { + failureCount_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportMetadata.class, + com.google.cloud.retail.v2.ImportMetadata.Builder.class); + } + + public static final int CREATE_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Operation create time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Operation create time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Operation create time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Operation last update time. If the operation is done, this is also the
+   * finish time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Operation last update time. If the operation is done, this is also the
+   * finish time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Operation last update time. If the operation is done, this is also the
+   * finish time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int SUCCESS_COUNT_FIELD_NUMBER = 3; + private long successCount_; + /** + * + * + *
+   * Count of entries that were processed successfully.
+   * 
+ * + * int64 success_count = 3; + * + * @return The successCount. + */ + @java.lang.Override + public long getSuccessCount() { + return successCount_; + } + + public static final int FAILURE_COUNT_FIELD_NUMBER = 4; + private long failureCount_; + /** + * + * + *
+   * Count of entries that encountered errors while processing.
+   * 
+ * + * int64 failure_count = 4; + * + * @return The failureCount. + */ + @java.lang.Override + public long getFailureCount() { + return failureCount_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (createTime_ != null) { + output.writeMessage(1, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(2, getUpdateTime()); + } + if (successCount_ != 0L) { + output.writeInt64(3, successCount_); + } + if (failureCount_ != 0L) { + output.writeInt64(4, failureCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateTime()); + } + if (successCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, successCount_); + } + if (failureCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, failureCount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ImportMetadata)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ImportMetadata other = + (com.google.cloud.retail.v2.ImportMetadata) obj; + + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (getSuccessCount() != other.getSuccessCount()) return false; + if (getFailureCount() != other.getFailureCount()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + hash = (37 * hash) + SUCCESS_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getSuccessCount()); + hash = (37 * hash) + FAILURE_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getFailureCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ImportMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata related to the progress of the Import operation. This will be
+   * returned by the google.longrunning.Operation.metadata field.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ImportMetadata) + com.google.cloud.retail.v2.ImportMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportMetadata.class, + com.google.cloud.retail.v2.ImportMetadata.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ImportMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + successCount_ = 0L; + + failureCount_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportMetadata getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ImportMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportMetadata build() { + com.google.cloud.retail.v2.ImportMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportMetadata buildPartial() { + com.google.cloud.retail.v2.ImportMetadata result = + new com.google.cloud.retail.v2.ImportMetadata(this); + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + result.successCount_ = successCount_; + result.failureCount_ = failureCount_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ImportMetadata) { + return mergeFrom((com.google.cloud.retail.v2.ImportMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ImportMetadata other) { + if (other == com.google.cloud.retail.v2.ImportMetadata.getDefaultInstance()) return this; + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.getSuccessCount() != 0L) { + setSuccessCount(other.getSuccessCount()); + } + if (other.getFailureCount() != 0L) { + setFailureCount(other.getFailureCount()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ImportMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ImportMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Operation create time.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Operation last update time. If the operation is done, this is also the
+     * finish time.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private long successCount_; + /** + * + * + *
+     * Count of entries that were processed successfully.
+     * 
+ * + * int64 success_count = 3; + * + * @return The successCount. + */ + @java.lang.Override + public long getSuccessCount() { + return successCount_; + } + /** + * + * + *
+     * Count of entries that were processed successfully.
+     * 
+ * + * int64 success_count = 3; + * + * @param value The successCount to set. + * @return This builder for chaining. + */ + public Builder setSuccessCount(long value) { + + successCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Count of entries that were processed successfully.
+     * 
+ * + * int64 success_count = 3; + * + * @return This builder for chaining. + */ + public Builder clearSuccessCount() { + + successCount_ = 0L; + onChanged(); + return this; + } + + private long failureCount_; + /** + * + * + *
+     * Count of entries that encountered errors while processing.
+     * 
+ * + * int64 failure_count = 4; + * + * @return The failureCount. + */ + @java.lang.Override + public long getFailureCount() { + return failureCount_; + } + /** + * + * + *
+     * Count of entries that encountered errors while processing.
+     * 
+ * + * int64 failure_count = 4; + * + * @param value The failureCount to set. + * @return This builder for chaining. + */ + public Builder setFailureCount(long value) { + + failureCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Count of entries that encountered errors while processing.
+     * 
+ * + * int64 failure_count = 4; + * + * @return This builder for chaining. + */ + public Builder clearFailureCount() { + + failureCount_ = 0L; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ImportMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ImportMetadata) + private static final com.google.cloud.retail.v2.ImportMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ImportMetadata(); + } + + public static com.google.cloud.retail.v2.ImportMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImportMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ImportMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadataOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadataOrBuilder.java new file mode 100644 index 00000000..2fcb4274 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadataOrBuilder.java @@ -0,0 +1,124 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ImportMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ImportMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Operation create time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Operation create time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Operation create time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Operation last update time. If the operation is done, this is also the
+   * finish time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Operation last update time. If the operation is done, this is also the
+   * finish time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Operation last update time. If the operation is done, this is also the
+   * finish time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Count of entries that were processed successfully.
+   * 
+ * + * int64 success_count = 3; + * + * @return The successCount. + */ + long getSuccessCount(); + + /** + * + * + *
+   * Count of entries that encountered errors while processing.
+   * 
+ * + * int64 failure_count = 4; + * + * @return The failureCount. + */ + long getFailureCount(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequest.java new file mode 100644 index 00000000..51e1e8e0 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequest.java @@ -0,0 +1,1520 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for Import methods.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportProductsRequest} + */ +public final class ImportProductsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ImportProductsRequest) + ImportProductsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ImportProductsRequest.newBuilder() to construct. + private ImportProductsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ImportProductsRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ImportProductsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ImportProductsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.ProductInputConfig.Builder subBuilder = null; + if (inputConfig_ != null) { + subBuilder = inputConfig_.toBuilder(); + } + inputConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ProductInputConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(inputConfig_); + inputConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.cloud.retail.v2.ImportErrorsConfig.Builder subBuilder = null; + if (errorsConfig_ != null) { + subBuilder = errorsConfig_.toBuilder(); + } + errorsConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ImportErrorsConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(errorsConfig_); + errorsConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportProductsRequest.class, + com.google.cloud.retail.v2.ImportProductsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required.
+   * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+   * If no updateMask is specified, requires products.create permission.
+   * If updateMask is specified, requires products.update permission.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required.
+   * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+   * If no updateMask is specified, requires products.create permission.
+   * If updateMask is specified, requires products.update permission.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUT_CONFIG_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.ProductInputConfig inputConfig_; + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the inputConfig field is set. + */ + @java.lang.Override + public boolean hasInputConfig() { + return inputConfig_ != null; + } + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The inputConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductInputConfig getInputConfig() { + return inputConfig_ == null + ? com.google.cloud.retail.v2.ProductInputConfig.getDefaultInstance() + : inputConfig_; + } + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductInputConfigOrBuilder getInputConfigOrBuilder() { + return getInputConfig(); + } + + public static final int ERRORS_CONFIG_FIELD_NUMBER = 3; + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + /** + * + * + *
+   * The desired location of errors incurred during the Import.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return Whether the errorsConfig field is set. + */ + @java.lang.Override + public boolean hasErrorsConfig() { + return errorsConfig_ != null; + } + /** + * + * + *
+   * The desired location of errors incurred during the Import.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return The errorsConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + /** + * + * + *
+   * The desired location of errors incurred during the Import.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + return getErrorsConfig(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 4; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided imported 'products' to update. If
+   * not set, will by default update all fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided imported 'products' to update. If
+   * not set, will by default update all fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided imported 'products' to update. If
+   * not set, will by default update all fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (inputConfig_ != null) { + output.writeMessage(2, getInputConfig()); + } + if (errorsConfig_ != null) { + output.writeMessage(3, getErrorsConfig()); + } + if (updateMask_ != null) { + output.writeMessage(4, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (inputConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getInputConfig()); + } + if (errorsConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getErrorsConfig()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ImportProductsRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ImportProductsRequest other = + (com.google.cloud.retail.v2.ImportProductsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasInputConfig() != other.hasInputConfig()) return false; + if (hasInputConfig()) { + if (!getInputConfig().equals(other.getInputConfig())) return false; + } + if (hasErrorsConfig() != other.hasErrorsConfig()) return false; + if (hasErrorsConfig()) { + if (!getErrorsConfig().equals(other.getErrorsConfig())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasInputConfig()) { + hash = (37 * hash) + INPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getInputConfig().hashCode(); + } + if (hasErrorsConfig()) { + hash = (37 * hash) + ERRORS_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getErrorsConfig().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ImportProductsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for Import methods.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportProductsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ImportProductsRequest) + com.google.cloud.retail.v2.ImportProductsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportProductsRequest.class, + com.google.cloud.retail.v2.ImportProductsRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ImportProductsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (inputConfigBuilder_ == null) { + inputConfig_ = null; + } else { + inputConfig_ = null; + inputConfigBuilder_ = null; + } + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ImportProductsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsRequest build() { + com.google.cloud.retail.v2.ImportProductsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsRequest buildPartial() { + com.google.cloud.retail.v2.ImportProductsRequest result = + new com.google.cloud.retail.v2.ImportProductsRequest(this); + result.parent_ = parent_; + if (inputConfigBuilder_ == null) { + result.inputConfig_ = inputConfig_; + } else { + result.inputConfig_ = inputConfigBuilder_.build(); + } + if (errorsConfigBuilder_ == null) { + result.errorsConfig_ = errorsConfig_; + } else { + result.errorsConfig_ = errorsConfigBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ImportProductsRequest) { + return mergeFrom((com.google.cloud.retail.v2.ImportProductsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ImportProductsRequest other) { + if (other == com.google.cloud.retail.v2.ImportProductsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasInputConfig()) { + mergeInputConfig(other.getInputConfig()); + } + if (other.hasErrorsConfig()) { + mergeErrorsConfig(other.getErrorsConfig()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ImportProductsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ImportProductsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required.
+     * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+     * If no updateMask is specified, requires products.create permission.
+     * If updateMask is specified, requires products.update permission.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required.
+     * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+     * If no updateMask is specified, requires products.create permission.
+     * If updateMask is specified, requires products.update permission.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required.
+     * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+     * If no updateMask is specified, requires products.create permission.
+     * If updateMask is specified, requires products.update permission.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required.
+     * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+     * If no updateMask is specified, requires products.create permission.
+     * If updateMask is specified, requires products.update permission.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required.
+     * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+     * If no updateMask is specified, requires products.create permission.
+     * If updateMask is specified, requires products.update permission.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.ProductInputConfig inputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductInputConfig, + com.google.cloud.retail.v2.ProductInputConfig.Builder, + com.google.cloud.retail.v2.ProductInputConfigOrBuilder> + inputConfigBuilder_; + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the inputConfig field is set. + */ + public boolean hasInputConfig() { + return inputConfigBuilder_ != null || inputConfig_ != null; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The inputConfig. + */ + public com.google.cloud.retail.v2.ProductInputConfig getInputConfig() { + if (inputConfigBuilder_ == null) { + return inputConfig_ == null + ? com.google.cloud.retail.v2.ProductInputConfig.getDefaultInstance() + : inputConfig_; + } else { + return inputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInputConfig(com.google.cloud.retail.v2.ProductInputConfig value) { + if (inputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + inputConfig_ = value; + onChanged(); + } else { + inputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInputConfig( + com.google.cloud.retail.v2.ProductInputConfig.Builder builderForValue) { + if (inputConfigBuilder_ == null) { + inputConfig_ = builderForValue.build(); + onChanged(); + } else { + inputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeInputConfig(com.google.cloud.retail.v2.ProductInputConfig value) { + if (inputConfigBuilder_ == null) { + if (inputConfig_ != null) { + inputConfig_ = + com.google.cloud.retail.v2.ProductInputConfig.newBuilder(inputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + inputConfig_ = value; + } + onChanged(); + } else { + inputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearInputConfig() { + if (inputConfigBuilder_ == null) { + inputConfig_ = null; + onChanged(); + } else { + inputConfig_ = null; + inputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductInputConfig.Builder getInputConfigBuilder() { + + onChanged(); + return getInputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductInputConfigOrBuilder getInputConfigOrBuilder() { + if (inputConfigBuilder_ != null) { + return inputConfigBuilder_.getMessageOrBuilder(); + } else { + return inputConfig_ == null + ? com.google.cloud.retail.v2.ProductInputConfig.getDefaultInstance() + : inputConfig_; + } + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductInputConfig, + com.google.cloud.retail.v2.ProductInputConfig.Builder, + com.google.cloud.retail.v2.ProductInputConfigOrBuilder> + getInputConfigFieldBuilder() { + if (inputConfigBuilder_ == null) { + inputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductInputConfig, + com.google.cloud.retail.v2.ProductInputConfig.Builder, + com.google.cloud.retail.v2.ProductInputConfigOrBuilder>( + getInputConfig(), getParentForChildren(), isClean()); + inputConfig_ = null; + } + return inputConfigBuilder_; + } + + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + errorsConfigBuilder_; + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return Whether the errorsConfig field is set. + */ + public boolean hasErrorsConfig() { + return errorsConfigBuilder_ != null || errorsConfig_ != null; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return The errorsConfig. + */ + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + if (errorsConfigBuilder_ == null) { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } else { + return errorsConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder setErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + errorsConfig_ = value; + onChanged(); + } else { + errorsConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder setErrorsConfig( + com.google.cloud.retail.v2.ImportErrorsConfig.Builder builderForValue) { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = builderForValue.build(); + onChanged(); + } else { + errorsConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder mergeErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (errorsConfig_ != null) { + errorsConfig_ = + com.google.cloud.retail.v2.ImportErrorsConfig.newBuilder(errorsConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + errorsConfig_ = value; + } + onChanged(); + } else { + errorsConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder clearErrorsConfig() { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + onChanged(); + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public com.google.cloud.retail.v2.ImportErrorsConfig.Builder getErrorsConfigBuilder() { + + onChanged(); + return getErrorsConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + if (errorsConfigBuilder_ != null) { + return errorsConfigBuilder_.getMessageOrBuilder(); + } else { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + } + /** + * + * + *
+     * The desired location of errors incurred during the Import.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + getErrorsConfigFieldBuilder() { + if (errorsConfigBuilder_ == null) { + errorsConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder>( + getErrorsConfig(), getParentForChildren(), isClean()); + errorsConfig_ = null; + } + return errorsConfigBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided imported 'products' to update. If
+     * not set, will by default update all fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ImportProductsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ImportProductsRequest) + private static final com.google.cloud.retail.v2.ImportProductsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ImportProductsRequest(); + } + + public static com.google.cloud.retail.v2.ImportProductsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImportProductsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ImportProductsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequestOrBuilder.java new file mode 100644 index 00000000..774c1b9c --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequestOrBuilder.java @@ -0,0 +1,170 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ImportProductsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ImportProductsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required.
+   * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+   * If no updateMask is specified, requires products.create permission.
+   * If updateMask is specified, requires products.update permission.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required.
+   * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch"
+   * If no updateMask is specified, requires products.create permission.
+   * If updateMask is specified, requires products.update permission.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the inputConfig field is set. + */ + boolean hasInputConfig(); + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The inputConfig. + */ + com.google.cloud.retail.v2.ProductInputConfig getInputConfig(); + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.ProductInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ProductInputConfigOrBuilder getInputConfigOrBuilder(); + + /** + * + * + *
+   * The desired location of errors incurred during the Import.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return Whether the errorsConfig field is set. + */ + boolean hasErrorsConfig(); + /** + * + * + *
+   * The desired location of errors incurred during the Import.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return The errorsConfig. + */ + com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig(); + /** + * + * + *
+   * The desired location of errors incurred during the Import.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided imported 'products' to update. If
+   * not set, will by default update all fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided imported 'products' to update. If
+   * not set, will by default update all fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided imported 'products' to update. If
+   * not set, will by default update all fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 4; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsResponse.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsResponse.java new file mode 100644 index 00000000..cfdde220 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsResponse.java @@ -0,0 +1,1220 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response of the
+ * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
+ * long running operation is done, then this message is returned by the
+ * google.longrunning.Operations.response field if the operation was successful.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportProductsResponse} + */ +public final class ImportProductsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ImportProductsResponse) + ImportProductsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ImportProductsResponse.newBuilder() to construct. + private ImportProductsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ImportProductsResponse() { + errorSamples_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ImportProductsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ImportProductsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + errorSamples_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + errorSamples_.add( + input.readMessage(com.google.rpc.Status.parser(), extensionRegistry)); + break; + } + case 18: + { + com.google.cloud.retail.v2.ImportErrorsConfig.Builder subBuilder = null; + if (errorsConfig_ != null) { + subBuilder = errorsConfig_.toBuilder(); + } + errorsConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ImportErrorsConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(errorsConfig_); + errorsConfig_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + errorSamples_ = java.util.Collections.unmodifiableList(errorSamples_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportProductsResponse.class, + com.google.cloud.retail.v2.ImportProductsResponse.Builder.class); + } + + public static final int ERROR_SAMPLES_FIELD_NUMBER = 1; + private java.util.List errorSamples_; + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public java.util.List getErrorSamplesList() { + return errorSamples_; + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public java.util.List getErrorSamplesOrBuilderList() { + return errorSamples_; + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public int getErrorSamplesCount() { + return errorSamples_.size(); + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public com.google.rpc.Status getErrorSamples(int index) { + return errorSamples_.get(index); + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getErrorSamplesOrBuilder(int index) { + return errorSamples_.get(index); + } + + public static final int ERRORS_CONFIG_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + /** + * + * + *
+   * Echoes the destination for the complete errors in the request if set.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return Whether the errorsConfig field is set. + */ + @java.lang.Override + public boolean hasErrorsConfig() { + return errorsConfig_ != null; + } + /** + * + * + *
+   * Echoes the destination for the complete errors in the request if set.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return The errorsConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + /** + * + * + *
+   * Echoes the destination for the complete errors in the request if set.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + return getErrorsConfig(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < errorSamples_.size(); i++) { + output.writeMessage(1, errorSamples_.get(i)); + } + if (errorsConfig_ != null) { + output.writeMessage(2, getErrorsConfig()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < errorSamples_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, errorSamples_.get(i)); + } + if (errorsConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getErrorsConfig()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ImportProductsResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ImportProductsResponse other = + (com.google.cloud.retail.v2.ImportProductsResponse) obj; + + if (!getErrorSamplesList().equals(other.getErrorSamplesList())) return false; + if (hasErrorsConfig() != other.hasErrorsConfig()) return false; + if (hasErrorsConfig()) { + if (!getErrorsConfig().equals(other.getErrorsConfig())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getErrorSamplesCount() > 0) { + hash = (37 * hash) + ERROR_SAMPLES_FIELD_NUMBER; + hash = (53 * hash) + getErrorSamplesList().hashCode(); + } + if (hasErrorsConfig()) { + hash = (37 * hash) + ERRORS_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getErrorsConfig().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ImportProductsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response of the
+   * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
+   * long running operation is done, then this message is returned by the
+   * google.longrunning.Operations.response field if the operation was successful.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportProductsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ImportProductsResponse) + com.google.cloud.retail.v2.ImportProductsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportProductsResponse.class, + com.google.cloud.retail.v2.ImportProductsResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ImportProductsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getErrorSamplesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (errorSamplesBuilder_ == null) { + errorSamples_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + errorSamplesBuilder_.clear(); + } + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportProductsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ImportProductsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsResponse build() { + com.google.cloud.retail.v2.ImportProductsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsResponse buildPartial() { + com.google.cloud.retail.v2.ImportProductsResponse result = + new com.google.cloud.retail.v2.ImportProductsResponse(this); + int from_bitField0_ = bitField0_; + if (errorSamplesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + errorSamples_ = java.util.Collections.unmodifiableList(errorSamples_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.errorSamples_ = errorSamples_; + } else { + result.errorSamples_ = errorSamplesBuilder_.build(); + } + if (errorsConfigBuilder_ == null) { + result.errorsConfig_ = errorsConfig_; + } else { + result.errorsConfig_ = errorsConfigBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ImportProductsResponse) { + return mergeFrom((com.google.cloud.retail.v2.ImportProductsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ImportProductsResponse other) { + if (other == com.google.cloud.retail.v2.ImportProductsResponse.getDefaultInstance()) + return this; + if (errorSamplesBuilder_ == null) { + if (!other.errorSamples_.isEmpty()) { + if (errorSamples_.isEmpty()) { + errorSamples_ = other.errorSamples_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureErrorSamplesIsMutable(); + errorSamples_.addAll(other.errorSamples_); + } + onChanged(); + } + } else { + if (!other.errorSamples_.isEmpty()) { + if (errorSamplesBuilder_.isEmpty()) { + errorSamplesBuilder_.dispose(); + errorSamplesBuilder_ = null; + errorSamples_ = other.errorSamples_; + bitField0_ = (bitField0_ & ~0x00000001); + errorSamplesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getErrorSamplesFieldBuilder() + : null; + } else { + errorSamplesBuilder_.addAllMessages(other.errorSamples_); + } + } + } + if (other.hasErrorsConfig()) { + mergeErrorsConfig(other.getErrorsConfig()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ImportProductsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.ImportProductsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List errorSamples_ = java.util.Collections.emptyList(); + + private void ensureErrorSamplesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + errorSamples_ = new java.util.ArrayList(errorSamples_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + errorSamplesBuilder_; + + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public java.util.List getErrorSamplesList() { + if (errorSamplesBuilder_ == null) { + return java.util.Collections.unmodifiableList(errorSamples_); + } else { + return errorSamplesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public int getErrorSamplesCount() { + if (errorSamplesBuilder_ == null) { + return errorSamples_.size(); + } else { + return errorSamplesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status getErrorSamples(int index) { + if (errorSamplesBuilder_ == null) { + return errorSamples_.get(index); + } else { + return errorSamplesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder setErrorSamples(int index, com.google.rpc.Status value) { + if (errorSamplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorSamplesIsMutable(); + errorSamples_.set(index, value); + onChanged(); + } else { + errorSamplesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder setErrorSamples(int index, com.google.rpc.Status.Builder builderForValue) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.set(index, builderForValue.build()); + onChanged(); + } else { + errorSamplesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(com.google.rpc.Status value) { + if (errorSamplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorSamplesIsMutable(); + errorSamples_.add(value); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(int index, com.google.rpc.Status value) { + if (errorSamplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorSamplesIsMutable(); + errorSamples_.add(index, value); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(com.google.rpc.Status.Builder builderForValue) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.add(builderForValue.build()); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(int index, com.google.rpc.Status.Builder builderForValue) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.add(index, builderForValue.build()); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addAllErrorSamples(java.lang.Iterable values) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, errorSamples_); + onChanged(); + } else { + errorSamplesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder clearErrorSamples() { + if (errorSamplesBuilder_ == null) { + errorSamples_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + errorSamplesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder removeErrorSamples(int index) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.remove(index); + onChanged(); + } else { + errorSamplesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status.Builder getErrorSamplesBuilder(int index) { + return getErrorSamplesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.StatusOrBuilder getErrorSamplesOrBuilder(int index) { + if (errorSamplesBuilder_ == null) { + return errorSamples_.get(index); + } else { + return errorSamplesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public java.util.List getErrorSamplesOrBuilderList() { + if (errorSamplesBuilder_ != null) { + return errorSamplesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(errorSamples_); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status.Builder addErrorSamplesBuilder() { + return getErrorSamplesFieldBuilder().addBuilder(com.google.rpc.Status.getDefaultInstance()); + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status.Builder addErrorSamplesBuilder(int index) { + return getErrorSamplesFieldBuilder() + .addBuilder(index, com.google.rpc.Status.getDefaultInstance()); + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public java.util.List getErrorSamplesBuilderList() { + return getErrorSamplesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getErrorSamplesFieldBuilder() { + if (errorSamplesBuilder_ == null) { + errorSamplesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>( + errorSamples_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + errorSamples_ = null; + } + return errorSamplesBuilder_; + } + + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + errorsConfigBuilder_; + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return Whether the errorsConfig field is set. + */ + public boolean hasErrorsConfig() { + return errorsConfigBuilder_ != null || errorsConfig_ != null; + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return The errorsConfig. + */ + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + if (errorsConfigBuilder_ == null) { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } else { + return errorsConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder setErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + errorsConfig_ = value; + onChanged(); + } else { + errorsConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder setErrorsConfig( + com.google.cloud.retail.v2.ImportErrorsConfig.Builder builderForValue) { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = builderForValue.build(); + onChanged(); + } else { + errorsConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder mergeErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (errorsConfig_ != null) { + errorsConfig_ = + com.google.cloud.retail.v2.ImportErrorsConfig.newBuilder(errorsConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + errorsConfig_ = value; + } + onChanged(); + } else { + errorsConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder clearErrorsConfig() { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + onChanged(); + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public com.google.cloud.retail.v2.ImportErrorsConfig.Builder getErrorsConfigBuilder() { + + onChanged(); + return getErrorsConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + if (errorsConfigBuilder_ != null) { + return errorsConfigBuilder_.getMessageOrBuilder(); + } else { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + } + /** + * + * + *
+     * Echoes the destination for the complete errors in the request if set.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + getErrorsConfigFieldBuilder() { + if (errorsConfigBuilder_ == null) { + errorsConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder>( + getErrorsConfig(), getParentForChildren(), isClean()); + errorsConfig_ = null; + } + return errorsConfigBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ImportProductsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ImportProductsResponse) + private static final com.google.cloud.retail.v2.ImportProductsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ImportProductsResponse(); + } + + public static com.google.cloud.retail.v2.ImportProductsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImportProductsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ImportProductsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportProductsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsResponseOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsResponseOrBuilder.java new file mode 100644 index 00000000..9223f5d3 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsResponseOrBuilder.java @@ -0,0 +1,111 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ImportProductsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ImportProductsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + java.util.List getErrorSamplesList(); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + com.google.rpc.Status getErrorSamples(int index); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + int getErrorSamplesCount(); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + java.util.List getErrorSamplesOrBuilderList(); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + com.google.rpc.StatusOrBuilder getErrorSamplesOrBuilder(int index); + + /** + * + * + *
+   * Echoes the destination for the complete errors in the request if set.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return Whether the errorsConfig field is set. + */ + boolean hasErrorsConfig(); + /** + * + * + *
+   * Echoes the destination for the complete errors in the request if set.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return The errorsConfig. + */ + com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig(); + /** + * + * + *
+   * Echoes the destination for the complete errors in the request if set.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsRequest.java new file mode 100644 index 00000000..e199bafd --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsRequest.java @@ -0,0 +1,1228 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for the ImportUserEvents request.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportUserEventsRequest} + */ +public final class ImportUserEventsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ImportUserEventsRequest) + ImportUserEventsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ImportUserEventsRequest.newBuilder() to construct. + private ImportUserEventsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ImportUserEventsRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ImportUserEventsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ImportUserEventsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.UserEventInputConfig.Builder subBuilder = null; + if (inputConfig_ != null) { + subBuilder = inputConfig_.toBuilder(); + } + inputConfig_ = + input.readMessage( + com.google.cloud.retail.v2.UserEventInputConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(inputConfig_); + inputConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.cloud.retail.v2.ImportErrorsConfig.Builder subBuilder = null; + if (errorsConfig_ != null) { + subBuilder = errorsConfig_.toBuilder(); + } + errorsConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ImportErrorsConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(errorsConfig_); + errorsConfig_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportUserEventsRequest.class, + com.google.cloud.retail.v2.ImportUserEventsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. "projects/1234/locations/global/catalogs/default_catalog"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. "projects/1234/locations/global/catalogs/default_catalog"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUT_CONFIG_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.UserEventInputConfig inputConfig_; + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the inputConfig field is set. + */ + @java.lang.Override + public boolean hasInputConfig() { + return inputConfig_ != null; + } + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The inputConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInputConfig getInputConfig() { + return inputConfig_ == null + ? com.google.cloud.retail.v2.UserEventInputConfig.getDefaultInstance() + : inputConfig_; + } + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInputConfigOrBuilder getInputConfigOrBuilder() { + return getInputConfig(); + } + + public static final int ERRORS_CONFIG_FIELD_NUMBER = 3; + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + /** + * + * + *
+   * The desired location of errors incurred during the Import. Cannot be set
+   * for inline user event imports.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return Whether the errorsConfig field is set. + */ + @java.lang.Override + public boolean hasErrorsConfig() { + return errorsConfig_ != null; + } + /** + * + * + *
+   * The desired location of errors incurred during the Import. Cannot be set
+   * for inline user event imports.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return The errorsConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + /** + * + * + *
+   * The desired location of errors incurred during the Import. Cannot be set
+   * for inline user event imports.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + return getErrorsConfig(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (inputConfig_ != null) { + output.writeMessage(2, getInputConfig()); + } + if (errorsConfig_ != null) { + output.writeMessage(3, getErrorsConfig()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (inputConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getInputConfig()); + } + if (errorsConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getErrorsConfig()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ImportUserEventsRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ImportUserEventsRequest other = + (com.google.cloud.retail.v2.ImportUserEventsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasInputConfig() != other.hasInputConfig()) return false; + if (hasInputConfig()) { + if (!getInputConfig().equals(other.getInputConfig())) return false; + } + if (hasErrorsConfig() != other.hasErrorsConfig()) return false; + if (hasErrorsConfig()) { + if (!getErrorsConfig().equals(other.getErrorsConfig())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasInputConfig()) { + hash = (37 * hash) + INPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getInputConfig().hashCode(); + } + if (hasErrorsConfig()) { + hash = (37 * hash) + ERRORS_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getErrorsConfig().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ImportUserEventsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the ImportUserEvents request.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportUserEventsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ImportUserEventsRequest) + com.google.cloud.retail.v2.ImportUserEventsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportUserEventsRequest.class, + com.google.cloud.retail.v2.ImportUserEventsRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ImportUserEventsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (inputConfigBuilder_ == null) { + inputConfig_ = null; + } else { + inputConfig_ = null; + inputConfigBuilder_ = null; + } + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ImportUserEventsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsRequest build() { + com.google.cloud.retail.v2.ImportUserEventsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsRequest buildPartial() { + com.google.cloud.retail.v2.ImportUserEventsRequest result = + new com.google.cloud.retail.v2.ImportUserEventsRequest(this); + result.parent_ = parent_; + if (inputConfigBuilder_ == null) { + result.inputConfig_ = inputConfig_; + } else { + result.inputConfig_ = inputConfigBuilder_.build(); + } + if (errorsConfigBuilder_ == null) { + result.errorsConfig_ = errorsConfig_; + } else { + result.errorsConfig_ = errorsConfigBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ImportUserEventsRequest) { + return mergeFrom((com.google.cloud.retail.v2.ImportUserEventsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ImportUserEventsRequest other) { + if (other == com.google.cloud.retail.v2.ImportUserEventsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasInputConfig()) { + mergeInputConfig(other.getInputConfig()); + } + if (other.hasErrorsConfig()) { + mergeErrorsConfig(other.getErrorsConfig()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ImportUserEventsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.ImportUserEventsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. "projects/1234/locations/global/catalogs/default_catalog"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. "projects/1234/locations/global/catalogs/default_catalog"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. "projects/1234/locations/global/catalogs/default_catalog"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. "projects/1234/locations/global/catalogs/default_catalog"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. "projects/1234/locations/global/catalogs/default_catalog"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.UserEventInputConfig inputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventInputConfig, + com.google.cloud.retail.v2.UserEventInputConfig.Builder, + com.google.cloud.retail.v2.UserEventInputConfigOrBuilder> + inputConfigBuilder_; + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the inputConfig field is set. + */ + public boolean hasInputConfig() { + return inputConfigBuilder_ != null || inputConfig_ != null; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The inputConfig. + */ + public com.google.cloud.retail.v2.UserEventInputConfig getInputConfig() { + if (inputConfigBuilder_ == null) { + return inputConfig_ == null + ? com.google.cloud.retail.v2.UserEventInputConfig.getDefaultInstance() + : inputConfig_; + } else { + return inputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInputConfig(com.google.cloud.retail.v2.UserEventInputConfig value) { + if (inputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + inputConfig_ = value; + onChanged(); + } else { + inputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInputConfig( + com.google.cloud.retail.v2.UserEventInputConfig.Builder builderForValue) { + if (inputConfigBuilder_ == null) { + inputConfig_ = builderForValue.build(); + onChanged(); + } else { + inputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeInputConfig(com.google.cloud.retail.v2.UserEventInputConfig value) { + if (inputConfigBuilder_ == null) { + if (inputConfig_ != null) { + inputConfig_ = + com.google.cloud.retail.v2.UserEventInputConfig.newBuilder(inputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + inputConfig_ = value; + } + onChanged(); + } else { + inputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearInputConfig() { + if (inputConfigBuilder_ == null) { + inputConfig_ = null; + onChanged(); + } else { + inputConfig_ = null; + inputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEventInputConfig.Builder getInputConfigBuilder() { + + onChanged(); + return getInputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEventInputConfigOrBuilder getInputConfigOrBuilder() { + if (inputConfigBuilder_ != null) { + return inputConfigBuilder_.getMessageOrBuilder(); + } else { + return inputConfig_ == null + ? com.google.cloud.retail.v2.UserEventInputConfig.getDefaultInstance() + : inputConfig_; + } + } + /** + * + * + *
+     * Required. The desired input location of the data.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventInputConfig, + com.google.cloud.retail.v2.UserEventInputConfig.Builder, + com.google.cloud.retail.v2.UserEventInputConfigOrBuilder> + getInputConfigFieldBuilder() { + if (inputConfigBuilder_ == null) { + inputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventInputConfig, + com.google.cloud.retail.v2.UserEventInputConfig.Builder, + com.google.cloud.retail.v2.UserEventInputConfigOrBuilder>( + getInputConfig(), getParentForChildren(), isClean()); + inputConfig_ = null; + } + return inputConfigBuilder_; + } + + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + errorsConfigBuilder_; + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return Whether the errorsConfig field is set. + */ + public boolean hasErrorsConfig() { + return errorsConfigBuilder_ != null || errorsConfig_ != null; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return The errorsConfig. + */ + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + if (errorsConfigBuilder_ == null) { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } else { + return errorsConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder setErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + errorsConfig_ = value; + onChanged(); + } else { + errorsConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder setErrorsConfig( + com.google.cloud.retail.v2.ImportErrorsConfig.Builder builderForValue) { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = builderForValue.build(); + onChanged(); + } else { + errorsConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder mergeErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (errorsConfig_ != null) { + errorsConfig_ = + com.google.cloud.retail.v2.ImportErrorsConfig.newBuilder(errorsConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + errorsConfig_ = value; + } + onChanged(); + } else { + errorsConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public Builder clearErrorsConfig() { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + onChanged(); + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public com.google.cloud.retail.v2.ImportErrorsConfig.Builder getErrorsConfigBuilder() { + + onChanged(); + return getErrorsConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + if (errorsConfigBuilder_ != null) { + return errorsConfigBuilder_.getMessageOrBuilder(); + } else { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + } + /** + * + * + *
+     * The desired location of errors incurred during the Import. Cannot be set
+     * for inline user event imports.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + getErrorsConfigFieldBuilder() { + if (errorsConfigBuilder_ == null) { + errorsConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder>( + getErrorsConfig(), getParentForChildren(), isClean()); + errorsConfig_ = null; + } + return errorsConfigBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ImportUserEventsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ImportUserEventsRequest) + private static final com.google.cloud.retail.v2.ImportUserEventsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ImportUserEventsRequest(); + } + + public static com.google.cloud.retail.v2.ImportUserEventsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImportUserEventsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ImportUserEventsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsRequestOrBuilder.java new file mode 100644 index 00000000..d8917b71 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsRequestOrBuilder.java @@ -0,0 +1,129 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ImportUserEventsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ImportUserEventsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. "projects/1234/locations/global/catalogs/default_catalog"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. "projects/1234/locations/global/catalogs/default_catalog"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the inputConfig field is set. + */ + boolean hasInputConfig(); + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The inputConfig. + */ + com.google.cloud.retail.v2.UserEventInputConfig getInputConfig(); + /** + * + * + *
+   * Required. The desired input location of the data.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.UserEventInputConfigOrBuilder getInputConfigOrBuilder(); + + /** + * + * + *
+   * The desired location of errors incurred during the Import. Cannot be set
+   * for inline user event imports.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return Whether the errorsConfig field is set. + */ + boolean hasErrorsConfig(); + /** + * + * + *
+   * The desired location of errors incurred during the Import. Cannot be set
+   * for inline user event imports.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + * + * @return The errorsConfig. + */ + com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig(); + /** + * + * + *
+   * The desired location of errors incurred during the Import. Cannot be set
+   * for inline user event imports.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 3; + */ + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsResponse.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsResponse.java new file mode 100644 index 00000000..034da0d1 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsResponse.java @@ -0,0 +1,1509 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response of the ImportUserEventsRequest. If the long running
+ * operation was successful, then this message is returned by the
+ * google.longrunning.Operations.response field if the operation was successful.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportUserEventsResponse} + */ +public final class ImportUserEventsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ImportUserEventsResponse) + ImportUserEventsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ImportUserEventsResponse.newBuilder() to construct. + private ImportUserEventsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ImportUserEventsResponse() { + errorSamples_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ImportUserEventsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ImportUserEventsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + errorSamples_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + errorSamples_.add( + input.readMessage(com.google.rpc.Status.parser(), extensionRegistry)); + break; + } + case 18: + { + com.google.cloud.retail.v2.ImportErrorsConfig.Builder subBuilder = null; + if (errorsConfig_ != null) { + subBuilder = errorsConfig_.toBuilder(); + } + errorsConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ImportErrorsConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(errorsConfig_); + errorsConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.cloud.retail.v2.UserEventImportSummary.Builder subBuilder = null; + if (importSummary_ != null) { + subBuilder = importSummary_.toBuilder(); + } + importSummary_ = + input.readMessage( + com.google.cloud.retail.v2.UserEventImportSummary.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(importSummary_); + importSummary_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + errorSamples_ = java.util.Collections.unmodifiableList(errorSamples_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportUserEventsResponse.class, + com.google.cloud.retail.v2.ImportUserEventsResponse.Builder.class); + } + + public static final int ERROR_SAMPLES_FIELD_NUMBER = 1; + private java.util.List errorSamples_; + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public java.util.List getErrorSamplesList() { + return errorSamples_; + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public java.util.List getErrorSamplesOrBuilderList() { + return errorSamples_; + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public int getErrorSamplesCount() { + return errorSamples_.size(); + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public com.google.rpc.Status getErrorSamples(int index) { + return errorSamples_.get(index); + } + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getErrorSamplesOrBuilder(int index) { + return errorSamples_.get(index); + } + + public static final int ERRORS_CONFIG_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + /** + * + * + *
+   * Echoes the destination for the complete errors if this field was set in
+   * the request.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return Whether the errorsConfig field is set. + */ + @java.lang.Override + public boolean hasErrorsConfig() { + return errorsConfig_ != null; + } + /** + * + * + *
+   * Echoes the destination for the complete errors if this field was set in
+   * the request.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return The errorsConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + /** + * + * + *
+   * Echoes the destination for the complete errors if this field was set in
+   * the request.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + return getErrorsConfig(); + } + + public static final int IMPORT_SUMMARY_FIELD_NUMBER = 3; + private com.google.cloud.retail.v2.UserEventImportSummary importSummary_; + /** + * + * + *
+   * Aggregated statistics of user event import status.
+   * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + * + * @return Whether the importSummary field is set. + */ + @java.lang.Override + public boolean hasImportSummary() { + return importSummary_ != null; + } + /** + * + * + *
+   * Aggregated statistics of user event import status.
+   * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + * + * @return The importSummary. + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventImportSummary getImportSummary() { + return importSummary_ == null + ? com.google.cloud.retail.v2.UserEventImportSummary.getDefaultInstance() + : importSummary_; + } + /** + * + * + *
+   * Aggregated statistics of user event import status.
+   * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventImportSummaryOrBuilder getImportSummaryOrBuilder() { + return getImportSummary(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < errorSamples_.size(); i++) { + output.writeMessage(1, errorSamples_.get(i)); + } + if (errorsConfig_ != null) { + output.writeMessage(2, getErrorsConfig()); + } + if (importSummary_ != null) { + output.writeMessage(3, getImportSummary()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < errorSamples_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, errorSamples_.get(i)); + } + if (errorsConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getErrorsConfig()); + } + if (importSummary_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getImportSummary()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ImportUserEventsResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ImportUserEventsResponse other = + (com.google.cloud.retail.v2.ImportUserEventsResponse) obj; + + if (!getErrorSamplesList().equals(other.getErrorSamplesList())) return false; + if (hasErrorsConfig() != other.hasErrorsConfig()) return false; + if (hasErrorsConfig()) { + if (!getErrorsConfig().equals(other.getErrorsConfig())) return false; + } + if (hasImportSummary() != other.hasImportSummary()) return false; + if (hasImportSummary()) { + if (!getImportSummary().equals(other.getImportSummary())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getErrorSamplesCount() > 0) { + hash = (37 * hash) + ERROR_SAMPLES_FIELD_NUMBER; + hash = (53 * hash) + getErrorSamplesList().hashCode(); + } + if (hasErrorsConfig()) { + hash = (37 * hash) + ERRORS_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getErrorsConfig().hashCode(); + } + if (hasImportSummary()) { + hash = (37 * hash) + IMPORT_SUMMARY_FIELD_NUMBER; + hash = (53 * hash) + getImportSummary().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ImportUserEventsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response of the ImportUserEventsRequest. If the long running
+   * operation was successful, then this message is returned by the
+   * google.longrunning.Operations.response field if the operation was successful.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ImportUserEventsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ImportUserEventsResponse) + com.google.cloud.retail.v2.ImportUserEventsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ImportUserEventsResponse.class, + com.google.cloud.retail.v2.ImportUserEventsResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ImportUserEventsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getErrorSamplesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (errorSamplesBuilder_ == null) { + errorSamples_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + errorSamplesBuilder_.clear(); + } + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + if (importSummaryBuilder_ == null) { + importSummary_ = null; + } else { + importSummary_ = null; + importSummaryBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ImportUserEventsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ImportUserEventsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsResponse build() { + com.google.cloud.retail.v2.ImportUserEventsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsResponse buildPartial() { + com.google.cloud.retail.v2.ImportUserEventsResponse result = + new com.google.cloud.retail.v2.ImportUserEventsResponse(this); + int from_bitField0_ = bitField0_; + if (errorSamplesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + errorSamples_ = java.util.Collections.unmodifiableList(errorSamples_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.errorSamples_ = errorSamples_; + } else { + result.errorSamples_ = errorSamplesBuilder_.build(); + } + if (errorsConfigBuilder_ == null) { + result.errorsConfig_ = errorsConfig_; + } else { + result.errorsConfig_ = errorsConfigBuilder_.build(); + } + if (importSummaryBuilder_ == null) { + result.importSummary_ = importSummary_; + } else { + result.importSummary_ = importSummaryBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ImportUserEventsResponse) { + return mergeFrom((com.google.cloud.retail.v2.ImportUserEventsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ImportUserEventsResponse other) { + if (other == com.google.cloud.retail.v2.ImportUserEventsResponse.getDefaultInstance()) + return this; + if (errorSamplesBuilder_ == null) { + if (!other.errorSamples_.isEmpty()) { + if (errorSamples_.isEmpty()) { + errorSamples_ = other.errorSamples_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureErrorSamplesIsMutable(); + errorSamples_.addAll(other.errorSamples_); + } + onChanged(); + } + } else { + if (!other.errorSamples_.isEmpty()) { + if (errorSamplesBuilder_.isEmpty()) { + errorSamplesBuilder_.dispose(); + errorSamplesBuilder_ = null; + errorSamples_ = other.errorSamples_; + bitField0_ = (bitField0_ & ~0x00000001); + errorSamplesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getErrorSamplesFieldBuilder() + : null; + } else { + errorSamplesBuilder_.addAllMessages(other.errorSamples_); + } + } + } + if (other.hasErrorsConfig()) { + mergeErrorsConfig(other.getErrorsConfig()); + } + if (other.hasImportSummary()) { + mergeImportSummary(other.getImportSummary()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ImportUserEventsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.ImportUserEventsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List errorSamples_ = java.util.Collections.emptyList(); + + private void ensureErrorSamplesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + errorSamples_ = new java.util.ArrayList(errorSamples_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + errorSamplesBuilder_; + + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public java.util.List getErrorSamplesList() { + if (errorSamplesBuilder_ == null) { + return java.util.Collections.unmodifiableList(errorSamples_); + } else { + return errorSamplesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public int getErrorSamplesCount() { + if (errorSamplesBuilder_ == null) { + return errorSamples_.size(); + } else { + return errorSamplesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status getErrorSamples(int index) { + if (errorSamplesBuilder_ == null) { + return errorSamples_.get(index); + } else { + return errorSamplesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder setErrorSamples(int index, com.google.rpc.Status value) { + if (errorSamplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorSamplesIsMutable(); + errorSamples_.set(index, value); + onChanged(); + } else { + errorSamplesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder setErrorSamples(int index, com.google.rpc.Status.Builder builderForValue) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.set(index, builderForValue.build()); + onChanged(); + } else { + errorSamplesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(com.google.rpc.Status value) { + if (errorSamplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorSamplesIsMutable(); + errorSamples_.add(value); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(int index, com.google.rpc.Status value) { + if (errorSamplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorSamplesIsMutable(); + errorSamples_.add(index, value); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(com.google.rpc.Status.Builder builderForValue) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.add(builderForValue.build()); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addErrorSamples(int index, com.google.rpc.Status.Builder builderForValue) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.add(index, builderForValue.build()); + onChanged(); + } else { + errorSamplesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder addAllErrorSamples(java.lang.Iterable values) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, errorSamples_); + onChanged(); + } else { + errorSamplesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder clearErrorSamples() { + if (errorSamplesBuilder_ == null) { + errorSamples_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + errorSamplesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public Builder removeErrorSamples(int index) { + if (errorSamplesBuilder_ == null) { + ensureErrorSamplesIsMutable(); + errorSamples_.remove(index); + onChanged(); + } else { + errorSamplesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status.Builder getErrorSamplesBuilder(int index) { + return getErrorSamplesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.StatusOrBuilder getErrorSamplesOrBuilder(int index) { + if (errorSamplesBuilder_ == null) { + return errorSamples_.get(index); + } else { + return errorSamplesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public java.util.List getErrorSamplesOrBuilderList() { + if (errorSamplesBuilder_ != null) { + return errorSamplesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(errorSamples_); + } + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status.Builder addErrorSamplesBuilder() { + return getErrorSamplesFieldBuilder().addBuilder(com.google.rpc.Status.getDefaultInstance()); + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public com.google.rpc.Status.Builder addErrorSamplesBuilder(int index) { + return getErrorSamplesFieldBuilder() + .addBuilder(index, com.google.rpc.Status.getDefaultInstance()); + } + /** + * + * + *
+     * A sample of errors encountered while processing the request.
+     * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + public java.util.List getErrorSamplesBuilderList() { + return getErrorSamplesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getErrorSamplesFieldBuilder() { + if (errorSamplesBuilder_ == null) { + errorSamplesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>( + errorSamples_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + errorSamples_ = null; + } + return errorSamplesBuilder_; + } + + private com.google.cloud.retail.v2.ImportErrorsConfig errorsConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + errorsConfigBuilder_; + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return Whether the errorsConfig field is set. + */ + public boolean hasErrorsConfig() { + return errorsConfigBuilder_ != null || errorsConfig_ != null; + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return The errorsConfig. + */ + public com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig() { + if (errorsConfigBuilder_ == null) { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } else { + return errorsConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder setErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + errorsConfig_ = value; + onChanged(); + } else { + errorsConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder setErrorsConfig( + com.google.cloud.retail.v2.ImportErrorsConfig.Builder builderForValue) { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = builderForValue.build(); + onChanged(); + } else { + errorsConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder mergeErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig value) { + if (errorsConfigBuilder_ == null) { + if (errorsConfig_ != null) { + errorsConfig_ = + com.google.cloud.retail.v2.ImportErrorsConfig.newBuilder(errorsConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + errorsConfig_ = value; + } + onChanged(); + } else { + errorsConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public Builder clearErrorsConfig() { + if (errorsConfigBuilder_ == null) { + errorsConfig_ = null; + onChanged(); + } else { + errorsConfig_ = null; + errorsConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public com.google.cloud.retail.v2.ImportErrorsConfig.Builder getErrorsConfigBuilder() { + + onChanged(); + return getErrorsConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder() { + if (errorsConfigBuilder_ != null) { + return errorsConfigBuilder_.getMessageOrBuilder(); + } else { + return errorsConfig_ == null + ? com.google.cloud.retail.v2.ImportErrorsConfig.getDefaultInstance() + : errorsConfig_; + } + } + /** + * + * + *
+     * Echoes the destination for the complete errors if this field was set in
+     * the request.
+     * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder> + getErrorsConfigFieldBuilder() { + if (errorsConfigBuilder_ == null) { + errorsConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ImportErrorsConfig, + com.google.cloud.retail.v2.ImportErrorsConfig.Builder, + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder>( + getErrorsConfig(), getParentForChildren(), isClean()); + errorsConfig_ = null; + } + return errorsConfigBuilder_; + } + + private com.google.cloud.retail.v2.UserEventImportSummary importSummary_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventImportSummary, + com.google.cloud.retail.v2.UserEventImportSummary.Builder, + com.google.cloud.retail.v2.UserEventImportSummaryOrBuilder> + importSummaryBuilder_; + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + * + * @return Whether the importSummary field is set. + */ + public boolean hasImportSummary() { + return importSummaryBuilder_ != null || importSummary_ != null; + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + * + * @return The importSummary. + */ + public com.google.cloud.retail.v2.UserEventImportSummary getImportSummary() { + if (importSummaryBuilder_ == null) { + return importSummary_ == null + ? com.google.cloud.retail.v2.UserEventImportSummary.getDefaultInstance() + : importSummary_; + } else { + return importSummaryBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + public Builder setImportSummary(com.google.cloud.retail.v2.UserEventImportSummary value) { + if (importSummaryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + importSummary_ = value; + onChanged(); + } else { + importSummaryBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + public Builder setImportSummary( + com.google.cloud.retail.v2.UserEventImportSummary.Builder builderForValue) { + if (importSummaryBuilder_ == null) { + importSummary_ = builderForValue.build(); + onChanged(); + } else { + importSummaryBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + public Builder mergeImportSummary(com.google.cloud.retail.v2.UserEventImportSummary value) { + if (importSummaryBuilder_ == null) { + if (importSummary_ != null) { + importSummary_ = + com.google.cloud.retail.v2.UserEventImportSummary.newBuilder(importSummary_) + .mergeFrom(value) + .buildPartial(); + } else { + importSummary_ = value; + } + onChanged(); + } else { + importSummaryBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + public Builder clearImportSummary() { + if (importSummaryBuilder_ == null) { + importSummary_ = null; + onChanged(); + } else { + importSummary_ = null; + importSummaryBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + public com.google.cloud.retail.v2.UserEventImportSummary.Builder getImportSummaryBuilder() { + + onChanged(); + return getImportSummaryFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + public com.google.cloud.retail.v2.UserEventImportSummaryOrBuilder getImportSummaryOrBuilder() { + if (importSummaryBuilder_ != null) { + return importSummaryBuilder_.getMessageOrBuilder(); + } else { + return importSummary_ == null + ? com.google.cloud.retail.v2.UserEventImportSummary.getDefaultInstance() + : importSummary_; + } + } + /** + * + * + *
+     * Aggregated statistics of user event import status.
+     * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventImportSummary, + com.google.cloud.retail.v2.UserEventImportSummary.Builder, + com.google.cloud.retail.v2.UserEventImportSummaryOrBuilder> + getImportSummaryFieldBuilder() { + if (importSummaryBuilder_ == null) { + importSummaryBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventImportSummary, + com.google.cloud.retail.v2.UserEventImportSummary.Builder, + com.google.cloud.retail.v2.UserEventImportSummaryOrBuilder>( + getImportSummary(), getParentForChildren(), isClean()); + importSummary_ = null; + } + return importSummaryBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ImportUserEventsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ImportUserEventsResponse) + private static final com.google.cloud.retail.v2.ImportUserEventsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ImportUserEventsResponse(); + } + + public static com.google.cloud.retail.v2.ImportUserEventsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImportUserEventsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ImportUserEventsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ImportUserEventsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsResponseOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsResponseOrBuilder.java new file mode 100644 index 00000000..cc871eed --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportUserEventsResponseOrBuilder.java @@ -0,0 +1,149 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ImportUserEventsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ImportUserEventsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + java.util.List getErrorSamplesList(); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + com.google.rpc.Status getErrorSamples(int index); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + int getErrorSamplesCount(); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + java.util.List getErrorSamplesOrBuilderList(); + /** + * + * + *
+   * A sample of errors encountered while processing the request.
+   * 
+ * + * repeated .google.rpc.Status error_samples = 1; + */ + com.google.rpc.StatusOrBuilder getErrorSamplesOrBuilder(int index); + + /** + * + * + *
+   * Echoes the destination for the complete errors if this field was set in
+   * the request.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return Whether the errorsConfig field is set. + */ + boolean hasErrorsConfig(); + /** + * + * + *
+   * Echoes the destination for the complete errors if this field was set in
+   * the request.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + * + * @return The errorsConfig. + */ + com.google.cloud.retail.v2.ImportErrorsConfig getErrorsConfig(); + /** + * + * + *
+   * Echoes the destination for the complete errors if this field was set in
+   * the request.
+   * 
+ * + * .google.cloud.retail.v2.ImportErrorsConfig errors_config = 2; + */ + com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrBuilder(); + + /** + * + * + *
+   * Aggregated statistics of user event import status.
+   * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + * + * @return Whether the importSummary field is set. + */ + boolean hasImportSummary(); + /** + * + * + *
+   * Aggregated statistics of user event import status.
+   * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + * + * @return The importSummary. + */ + com.google.cloud.retail.v2.UserEventImportSummary getImportSummary(); + /** + * + * + *
+   * Aggregated statistics of user event import status.
+   * 
+ * + * .google.cloud.retail.v2.UserEventImportSummary import_summary = 3; + */ + com.google.cloud.retail.v2.UserEventImportSummaryOrBuilder getImportSummaryOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsRequest.java new file mode 100644 index 00000000..6b205fd0 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsRequest.java @@ -0,0 +1,1017 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListCatalogsRequest} + */ +public final class ListCatalogsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ListCatalogsRequest) + ListCatalogsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListCatalogsRequest.newBuilder() to construct. + private ListCatalogsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListCatalogsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListCatalogsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListCatalogsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListCatalogsRequest.class, + com.google.cloud.retail.v2.ListCatalogsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The account resource name with an associated location.
+   * If the caller does not have permission to list
+   * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+   * of whether or not this location exists, a PERMISSION_DENIED error is
+   * returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The account resource name with an associated location.
+   * If the caller does not have permission to list
+   * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+   * of whether or not this location exists, a PERMISSION_DENIED error is
+   * returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
+   * unspecified, defaults to 50. The maximum allowed value is 1000. Values
+   * above 1000 will be coerced to 1000.
+   * If this field is negative, an INVALID_ARGUMENT is returned.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A page token
+   * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+   * received from a previous
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * call. Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * must match the call that provided the page token. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token
+   * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+   * received from a previous
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * call. Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * must match the call that provided the page token. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ListCatalogsRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ListCatalogsRequest other = + (com.google.cloud.retail.v2.ListCatalogsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ListCatalogsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListCatalogsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ListCatalogsRequest) + com.google.cloud.retail.v2.ListCatalogsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListCatalogsRequest.class, + com.google.cloud.retail.v2.ListCatalogsRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ListCatalogsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ListCatalogsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsRequest build() { + com.google.cloud.retail.v2.ListCatalogsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsRequest buildPartial() { + com.google.cloud.retail.v2.ListCatalogsRequest result = + new com.google.cloud.retail.v2.ListCatalogsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ListCatalogsRequest) { + return mergeFrom((com.google.cloud.retail.v2.ListCatalogsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ListCatalogsRequest other) { + if (other == com.google.cloud.retail.v2.ListCatalogsRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ListCatalogsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ListCatalogsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The account resource name with an associated location.
+     * If the caller does not have permission to list
+     * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+     * of whether or not this location exists, a PERMISSION_DENIED error is
+     * returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The account resource name with an associated location.
+     * If the caller does not have permission to list
+     * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+     * of whether or not this location exists, a PERMISSION_DENIED error is
+     * returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The account resource name with an associated location.
+     * If the caller does not have permission to list
+     * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+     * of whether or not this location exists, a PERMISSION_DENIED error is
+     * returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The account resource name with an associated location.
+     * If the caller does not have permission to list
+     * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+     * of whether or not this location exists, a PERMISSION_DENIED error is
+     * returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The account resource name with an associated location.
+     * If the caller does not have permission to list
+     * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+     * of whether or not this location exists, a PERMISSION_DENIED error is
+     * returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
+     * unspecified, defaults to 50. The maximum allowed value is 1000. Values
+     * above 1000 will be coerced to 1000.
+     * If this field is negative, an INVALID_ARGUMENT is returned.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
+     * unspecified, defaults to 50. The maximum allowed value is 1000. Values
+     * above 1000 will be coerced to 1000.
+     * If this field is negative, an INVALID_ARGUMENT is returned.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
+     * unspecified, defaults to 50. The maximum allowed value is 1000. Values
+     * above 1000 will be coerced to 1000.
+     * If this field is negative, an INVALID_ARGUMENT is returned.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token
+     * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+     * received from a previous
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * call. Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * must match the call that provided the page token. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token
+     * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+     * received from a previous
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * call. Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * must match the call that provided the page token. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token
+     * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+     * received from a previous
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * call. Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * must match the call that provided the page token. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token
+     * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+     * received from a previous
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * call. Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * must match the call that provided the page token. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token
+     * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+     * received from a previous
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * call. Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+     * must match the call that provided the page token. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ListCatalogsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ListCatalogsRequest) + private static final com.google.cloud.retail.v2.ListCatalogsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ListCatalogsRequest(); + } + + public static com.google.cloud.retail.v2.ListCatalogsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListCatalogsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCatalogsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsRequestOrBuilder.java new file mode 100644 index 00000000..d114c027 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsRequestOrBuilder.java @@ -0,0 +1,119 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface ListCatalogsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ListCatalogsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The account resource name with an associated location.
+   * If the caller does not have permission to list
+   * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+   * of whether or not this location exists, a PERMISSION_DENIED error is
+   * returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The account resource name with an associated location.
+   * If the caller does not have permission to list
+   * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
+   * of whether or not this location exists, a PERMISSION_DENIED error is
+   * returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
+   * unspecified, defaults to 50. The maximum allowed value is 1000. Values
+   * above 1000 will be coerced to 1000.
+   * If this field is negative, an INVALID_ARGUMENT is returned.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token
+   * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+   * received from a previous
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * call. Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * must match the call that provided the page token. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token
+   * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
+   * received from a previous
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * call. Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * must match the call that provided the page token. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsResponse.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsResponse.java new file mode 100644 index 00000000..cfdd0d48 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsResponse.java @@ -0,0 +1,1151 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response for
+ * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListCatalogsResponse} + */ +public final class ListCatalogsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ListCatalogsResponse) + ListCatalogsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListCatalogsResponse.newBuilder() to construct. + private ListCatalogsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListCatalogsResponse() { + catalogs_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListCatalogsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListCatalogsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + catalogs_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + catalogs_.add( + input.readMessage( + com.google.cloud.retail.v2.Catalog.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + catalogs_ = java.util.Collections.unmodifiableList(catalogs_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListCatalogsResponse.class, + com.google.cloud.retail.v2.ListCatalogsResponse.Builder.class); + } + + public static final int CATALOGS_FIELD_NUMBER = 1; + private java.util.List catalogs_; + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + @java.lang.Override + public java.util.List getCatalogsList() { + return catalogs_; + } + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + @java.lang.Override + public java.util.List + getCatalogsOrBuilderList() { + return catalogs_; + } + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + @java.lang.Override + public int getCatalogsCount() { + return catalogs_.size(); + } + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Catalog getCatalogs(int index) { + return catalogs_.get(index); + } + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogOrBuilder getCatalogsOrBuilder(int index) { + return catalogs_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token that can be sent as
+   * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+   * to retrieve the next page. If this field is omitted, there are no
+   * subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token that can be sent as
+   * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+   * to retrieve the next page. If this field is omitted, there are no
+   * subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < catalogs_.size(); i++) { + output.writeMessage(1, catalogs_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < catalogs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, catalogs_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ListCatalogsResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ListCatalogsResponse other = + (com.google.cloud.retail.v2.ListCatalogsResponse) obj; + + if (!getCatalogsList().equals(other.getCatalogsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getCatalogsCount() > 0) { + hash = (37 * hash) + CATALOGS_FIELD_NUMBER; + hash = (53 * hash) + getCatalogsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ListCatalogsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response for
+   * [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListCatalogsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ListCatalogsResponse) + com.google.cloud.retail.v2.ListCatalogsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListCatalogsResponse.class, + com.google.cloud.retail.v2.ListCatalogsResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ListCatalogsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getCatalogsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (catalogsBuilder_ == null) { + catalogs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + catalogsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ListCatalogsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ListCatalogsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsResponse build() { + com.google.cloud.retail.v2.ListCatalogsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsResponse buildPartial() { + com.google.cloud.retail.v2.ListCatalogsResponse result = + new com.google.cloud.retail.v2.ListCatalogsResponse(this); + int from_bitField0_ = bitField0_; + if (catalogsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + catalogs_ = java.util.Collections.unmodifiableList(catalogs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.catalogs_ = catalogs_; + } else { + result.catalogs_ = catalogsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ListCatalogsResponse) { + return mergeFrom((com.google.cloud.retail.v2.ListCatalogsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ListCatalogsResponse other) { + if (other == com.google.cloud.retail.v2.ListCatalogsResponse.getDefaultInstance()) + return this; + if (catalogsBuilder_ == null) { + if (!other.catalogs_.isEmpty()) { + if (catalogs_.isEmpty()) { + catalogs_ = other.catalogs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCatalogsIsMutable(); + catalogs_.addAll(other.catalogs_); + } + onChanged(); + } + } else { + if (!other.catalogs_.isEmpty()) { + if (catalogsBuilder_.isEmpty()) { + catalogsBuilder_.dispose(); + catalogsBuilder_ = null; + catalogs_ = other.catalogs_; + bitField0_ = (bitField0_ & ~0x00000001); + catalogsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getCatalogsFieldBuilder() + : null; + } else { + catalogsBuilder_.addAllMessages(other.catalogs_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ListCatalogsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ListCatalogsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List catalogs_ = + java.util.Collections.emptyList(); + + private void ensureCatalogsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + catalogs_ = new java.util.ArrayList(catalogs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Catalog, + com.google.cloud.retail.v2.Catalog.Builder, + com.google.cloud.retail.v2.CatalogOrBuilder> + catalogsBuilder_; + + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public java.util.List getCatalogsList() { + if (catalogsBuilder_ == null) { + return java.util.Collections.unmodifiableList(catalogs_); + } else { + return catalogsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public int getCatalogsCount() { + if (catalogsBuilder_ == null) { + return catalogs_.size(); + } else { + return catalogsBuilder_.getCount(); + } + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public com.google.cloud.retail.v2.Catalog getCatalogs(int index) { + if (catalogsBuilder_ == null) { + return catalogs_.get(index); + } else { + return catalogsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder setCatalogs(int index, com.google.cloud.retail.v2.Catalog value) { + if (catalogsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCatalogsIsMutable(); + catalogs_.set(index, value); + onChanged(); + } else { + catalogsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder setCatalogs( + int index, com.google.cloud.retail.v2.Catalog.Builder builderForValue) { + if (catalogsBuilder_ == null) { + ensureCatalogsIsMutable(); + catalogs_.set(index, builderForValue.build()); + onChanged(); + } else { + catalogsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder addCatalogs(com.google.cloud.retail.v2.Catalog value) { + if (catalogsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCatalogsIsMutable(); + catalogs_.add(value); + onChanged(); + } else { + catalogsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder addCatalogs(int index, com.google.cloud.retail.v2.Catalog value) { + if (catalogsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCatalogsIsMutable(); + catalogs_.add(index, value); + onChanged(); + } else { + catalogsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder addCatalogs(com.google.cloud.retail.v2.Catalog.Builder builderForValue) { + if (catalogsBuilder_ == null) { + ensureCatalogsIsMutable(); + catalogs_.add(builderForValue.build()); + onChanged(); + } else { + catalogsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder addCatalogs( + int index, com.google.cloud.retail.v2.Catalog.Builder builderForValue) { + if (catalogsBuilder_ == null) { + ensureCatalogsIsMutable(); + catalogs_.add(index, builderForValue.build()); + onChanged(); + } else { + catalogsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder addAllCatalogs( + java.lang.Iterable values) { + if (catalogsBuilder_ == null) { + ensureCatalogsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, catalogs_); + onChanged(); + } else { + catalogsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder clearCatalogs() { + if (catalogsBuilder_ == null) { + catalogs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + catalogsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public Builder removeCatalogs(int index) { + if (catalogsBuilder_ == null) { + ensureCatalogsIsMutable(); + catalogs_.remove(index); + onChanged(); + } else { + catalogsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public com.google.cloud.retail.v2.Catalog.Builder getCatalogsBuilder(int index) { + return getCatalogsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public com.google.cloud.retail.v2.CatalogOrBuilder getCatalogsOrBuilder(int index) { + if (catalogsBuilder_ == null) { + return catalogs_.get(index); + } else { + return catalogsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public java.util.List + getCatalogsOrBuilderList() { + if (catalogsBuilder_ != null) { + return catalogsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(catalogs_); + } + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public com.google.cloud.retail.v2.Catalog.Builder addCatalogsBuilder() { + return getCatalogsFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.Catalog.getDefaultInstance()); + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public com.google.cloud.retail.v2.Catalog.Builder addCatalogsBuilder(int index) { + return getCatalogsFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.Catalog.getDefaultInstance()); + } + /** + * + * + *
+     * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+     * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + public java.util.List getCatalogsBuilderList() { + return getCatalogsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Catalog, + com.google.cloud.retail.v2.Catalog.Builder, + com.google.cloud.retail.v2.CatalogOrBuilder> + getCatalogsFieldBuilder() { + if (catalogsBuilder_ == null) { + catalogsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Catalog, + com.google.cloud.retail.v2.Catalog.Builder, + com.google.cloud.retail.v2.CatalogOrBuilder>( + catalogs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + catalogs_ = null; + } + return catalogsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token that can be sent as
+     * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+     * to retrieve the next page. If this field is omitted, there are no
+     * subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token that can be sent as
+     * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+     * to retrieve the next page. If this field is omitted, there are no
+     * subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token that can be sent as
+     * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+     * to retrieve the next page. If this field is omitted, there are no
+     * subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token that can be sent as
+     * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+     * to retrieve the next page. If this field is omitted, there are no
+     * subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token that can be sent as
+     * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+     * to retrieve the next page. If this field is omitted, there are no
+     * subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ListCatalogsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ListCatalogsResponse) + private static final com.google.cloud.retail.v2.ListCatalogsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ListCatalogsResponse(); + } + + public static com.google.cloud.retail.v2.ListCatalogsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListCatalogsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCatalogsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListCatalogsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsResponseOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsResponseOrBuilder.java new file mode 100644 index 00000000..29f4a44d --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListCatalogsResponseOrBuilder.java @@ -0,0 +1,107 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface ListCatalogsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ListCatalogsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + java.util.List getCatalogsList(); + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + com.google.cloud.retail.v2.Catalog getCatalogs(int index); + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + int getCatalogsCount(); + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + java.util.List getCatalogsOrBuilderList(); + /** + * + * + *
+   * All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
+   * 
+ * + * repeated .google.cloud.retail.v2.Catalog catalogs = 1; + */ + com.google.cloud.retail.v2.CatalogOrBuilder getCatalogsOrBuilder(int index); + + /** + * + * + *
+   * A token that can be sent as
+   * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+   * to retrieve the next page. If this field is omitted, there are no
+   * subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token that can be sent as
+   * [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
+   * to retrieve the next page. If this field is omitted, there are no
+   * subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/LocationName.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/LocationName.java new file mode 100644 index 00000000..8ab5bb0a --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/LocationName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class LocationName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static LocationName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static LocationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION.validatedMatch( + formattedString, "LocationName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (LocationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate("project", project, "location", location); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { + private String project; + private String location; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(LocationName locationName) { + project = locationName.project; + location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictRequest.java new file mode 100644 index 00000000..3160883f --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictRequest.java @@ -0,0 +1,2628 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/prediction_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for Predict method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PredictRequest} + */ +public final class PredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PredictRequest) + PredictRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use PredictRequest.newBuilder() to construct. + private PredictRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PredictRequest() { + placement_ = ""; + pageToken_ = ""; + filter_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PredictRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PredictRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + placement_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.UserEvent.Builder subBuilder = null; + if (userEvent_ != null) { + subBuilder = userEvent_.toBuilder(); + } + userEvent_ = + input.readMessage( + com.google.cloud.retail.v2.UserEvent.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(userEvent_); + userEvent_ = subBuilder.buildPartial(); + } + + break; + } + case 24: + { + pageSize_ = input.readInt32(); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + case 48: + { + validateOnly_ = input.readBool(); + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + params_ = + com.google.protobuf.MapField.newMapField(ParamsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry params__ = + input.readMessage( + ParamsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + params_.getMutableMap().put(params__.getKey(), params__.getValue()); + break; + } + case 66: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + labels_ = + com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetParams(); + case 8: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PredictRequest.class, + com.google.cloud.retail.v2.PredictRequest.Builder.class); + } + + public static final int PLACEMENT_FIELD_NUMBER = 1; + private volatile java.lang.Object placement_; + /** + * + * + *
+   * Required. Full resource name of the format:
+   * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+   * The id of the recommendation engine placement. This id is used to identify
+   * the set of models that will be used to make the prediction.
+   * We currently support three placements with the following IDs by default:
+   * * `shopping_cart`: Predicts products frequently bought together with one or
+   *   more  products in the same shopping session. Commonly displayed after
+   *   `add-to-cart` events, on product detail pages, or on the shopping cart
+   *   page.
+   * * `home_page`: Predicts the next product that a user will most likely
+   *   engage with or purchase based on the shopping or viewing history of the
+   *   specified `userId` or `visitorId`. For example - Recommendations for you.
+   * * `product_detail`: Predicts the next product that a user will most likely
+   *   engage with or purchase. The prediction is based on the shopping or
+   *   viewing history of the specified `userId` or `visitorId` and its
+   *   relevance to a specified `CatalogItem`. Typically used on product detail
+   *   pages. For example - More products like this.
+   * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+   *   the specified `userId` or `visitorId`, most recent ones first. Returns
+   *   nothing if neither of them has viewed any products yet. For example -
+   *   Recently viewed.
+   * The full list of available placements can be seen at
+   * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+   * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The placement. + */ + @java.lang.Override + public java.lang.String getPlacement() { + java.lang.Object ref = placement_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + placement_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full resource name of the format:
+   * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+   * The id of the recommendation engine placement. This id is used to identify
+   * the set of models that will be used to make the prediction.
+   * We currently support three placements with the following IDs by default:
+   * * `shopping_cart`: Predicts products frequently bought together with one or
+   *   more  products in the same shopping session. Commonly displayed after
+   *   `add-to-cart` events, on product detail pages, or on the shopping cart
+   *   page.
+   * * `home_page`: Predicts the next product that a user will most likely
+   *   engage with or purchase based on the shopping or viewing history of the
+   *   specified `userId` or `visitorId`. For example - Recommendations for you.
+   * * `product_detail`: Predicts the next product that a user will most likely
+   *   engage with or purchase. The prediction is based on the shopping or
+   *   viewing history of the specified `userId` or `visitorId` and its
+   *   relevance to a specified `CatalogItem`. Typically used on product detail
+   *   pages. For example - More products like this.
+   * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+   *   the specified `userId` or `visitorId`, most recent ones first. Returns
+   *   nothing if neither of them has viewed any products yet. For example -
+   *   Recently viewed.
+   * The full list of available placements can be seen at
+   * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+   * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for placement. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPlacementBytes() { + java.lang.Object ref = placement_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + placement_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USER_EVENT_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.UserEvent userEvent_; + /** + * + * + *
+   * Required. Context about the user, what they are looking at and what action
+   * they took to trigger the predict request. Note that this user event detail
+   * won't be ingested to userEvent logs. Thus, a separate userEvent write
+   * request is required for event logging.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEvent field is set. + */ + @java.lang.Override + public boolean hasUserEvent() { + return userEvent_ != null; + } + /** + * + * + *
+   * Required. Context about the user, what they are looking at and what action
+   * they took to trigger the predict request. Note that this user event detail
+   * won't be ingested to userEvent logs. Thus, a separate userEvent write
+   * request is required for event logging.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEvent. + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEvent getUserEvent() { + return userEvent_ == null + ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() + : userEvent_; + } + /** + * + * + *
+   * Required. Context about the user, what they are looking at and what action
+   * they took to trigger the predict request. Note that this user event detail
+   * won't be ingested to userEvent logs. Thus, a separate userEvent write
+   * request is required for event logging.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder() { + return getUserEvent(); + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 3; + private int pageSize_; + /** + * + * + *
+   * Maximum number of results to return per page. Set this property
+   * to the number of prediction results needed. If zero, the service will
+   * choose a reasonable default. The maximum allowed value is 100. Values
+   * above 100 will be coerced to 100.
+   * 
+ * + * int32 page_size = 3; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 4; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * The previous PredictResponse.next_page_token.
+   * 
+ * + * string page_token = 4; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * The previous PredictResponse.next_page_token.
+   * 
+ * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 5; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Filter for restricting prediction results with a length limit of 5,000
+   * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+   *  * Tag expressions. Restricts predictions to products that match all of the
+   *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+   *    expression is enclosed in parentheses, and must be separated from the
+   *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+   *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+   *    with a size limit of 1,000 characters.
+   *  * filterOutOfStockItems. Restricts predictions to products that do not
+   *  have a
+   *    stockState value of OUT_OF_STOCK.
+   * Examples:
+   *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+   *  * filterOutOfStockItems  tag=(-"promotional")
+   *  * filterOutOfStockItems
+   * If your filter blocks all prediction results, nothing will be returned. If
+   * you want generic (unfiltered) popular products to be returned instead, set
+   * `strictFiltering` to false in `PredictRequest.params`.
+   * 
+ * + * string filter = 5; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Filter for restricting prediction results with a length limit of 5,000
+   * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+   *  * Tag expressions. Restricts predictions to products that match all of the
+   *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+   *    expression is enclosed in parentheses, and must be separated from the
+   *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+   *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+   *    with a size limit of 1,000 characters.
+   *  * filterOutOfStockItems. Restricts predictions to products that do not
+   *  have a
+   *    stockState value of OUT_OF_STOCK.
+   * Examples:
+   *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+   *  * filterOutOfStockItems  tag=(-"promotional")
+   *  * filterOutOfStockItems
+   * If your filter blocks all prediction results, nothing will be returned. If
+   * you want generic (unfiltered) popular products to be returned instead, set
+   * `strictFiltering` to false in `PredictRequest.params`.
+   * 
+ * + * string filter = 5; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 6; + private boolean validateOnly_; + /** + * + * + *
+   * Use validate only mode for this prediction query. If set to true, a
+   * dummy model will be used that returns arbitrary products.
+   * Note that the validate only mode should only be used for testing the API,
+   * or if the model is not ready.
+   * 
+ * + * bool validate_only = 6; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int PARAMS_FIELD_NUMBER = 7; + + private static final class ParamsDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictRequest_ParamsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.protobuf.Value.getDefaultInstance()); + } + + private com.google.protobuf.MapField params_; + + private com.google.protobuf.MapField + internalGetParams() { + if (params_ == null) { + return com.google.protobuf.MapField.emptyMapField(ParamsDefaultEntryHolder.defaultEntry); + } + return params_; + } + + public int getParamsCount() { + return internalGetParams().getMap().size(); + } + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public boolean containsParams(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetParams().getMap().containsKey(key); + } + /** Use {@link #getParamsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getParams() { + return getParamsMap(); + } + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public java.util.Map getParamsMap() { + return internalGetParams().getMap(); + } + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public com.google.protobuf.Value getParamsOrDefault( + java.lang.String key, com.google.protobuf.Value defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetParams().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public com.google.protobuf.Value getParamsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetParams().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int LABELS_FIELD_NUMBER = 8; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictRequest_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getPlacementBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, placement_); + } + if (userEvent_ != null) { + output.writeMessage(2, getUserEvent()); + } + if (pageSize_ != 0) { + output.writeInt32(3, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); + } + if (!getFilterBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, filter_); + } + if (validateOnly_ != false) { + output.writeBool(6, validateOnly_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetParams(), ParamsDefaultEntryHolder.defaultEntry, 7); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 8); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getPlacementBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, placement_); + } + if (userEvent_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUserEvent()); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); + } + if (!getFilterBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, filter_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, validateOnly_); + } + for (java.util.Map.Entry entry : + internalGetParams().getMap().entrySet()) { + com.google.protobuf.MapEntry params__ = + ParamsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, params__); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, labels__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PredictRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PredictRequest other = + (com.google.cloud.retail.v2.PredictRequest) obj; + + if (!getPlacement().equals(other.getPlacement())) return false; + if (hasUserEvent() != other.hasUserEvent()) return false; + if (hasUserEvent()) { + if (!getUserEvent().equals(other.getUserEvent())) return false; + } + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!internalGetParams().equals(other.internalGetParams())) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PLACEMENT_FIELD_NUMBER; + hash = (53 * hash) + getPlacement().hashCode(); + if (hasUserEvent()) { + hash = (37 * hash) + USER_EVENT_FIELD_NUMBER; + hash = (53 * hash) + getUserEvent().hashCode(); + } + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + if (!internalGetParams().getMap().isEmpty()) { + hash = (37 * hash) + PARAMS_FIELD_NUMBER; + hash = (53 * hash) + internalGetParams().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.PredictRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for Predict method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PredictRequest) + com.google.cloud.retail.v2.PredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetParams(); + case 8: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 7: + return internalGetMutableParams(); + case 8: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PredictRequest.class, + com.google.cloud.retail.v2.PredictRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PredictRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + placement_ = ""; + + if (userEventBuilder_ == null) { + userEvent_ = null; + } else { + userEvent_ = null; + userEventBuilder_ = null; + } + pageSize_ = 0; + + pageToken_ = ""; + + filter_ = ""; + + validateOnly_ = false; + + internalGetMutableParams().clear(); + internalGetMutableLabels().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictRequest build() { + com.google.cloud.retail.v2.PredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictRequest buildPartial() { + com.google.cloud.retail.v2.PredictRequest result = + new com.google.cloud.retail.v2.PredictRequest(this); + int from_bitField0_ = bitField0_; + result.placement_ = placement_; + if (userEventBuilder_ == null) { + result.userEvent_ = userEvent_; + } else { + result.userEvent_ = userEventBuilder_.build(); + } + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.filter_ = filter_; + result.validateOnly_ = validateOnly_; + result.params_ = internalGetParams(); + result.params_.makeImmutable(); + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PredictRequest) { + return mergeFrom((com.google.cloud.retail.v2.PredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PredictRequest other) { + if (other == com.google.cloud.retail.v2.PredictRequest.getDefaultInstance()) return this; + if (!other.getPlacement().isEmpty()) { + placement_ = other.placement_; + onChanged(); + } + if (other.hasUserEvent()) { + mergeUserEvent(other.getUserEvent()); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + internalGetMutableParams().mergeFrom(other.internalGetParams()); + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PredictRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.PredictRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object placement_ = ""; + /** + * + * + *
+     * Required. Full resource name of the format:
+     * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+     * The id of the recommendation engine placement. This id is used to identify
+     * the set of models that will be used to make the prediction.
+     * We currently support three placements with the following IDs by default:
+     * * `shopping_cart`: Predicts products frequently bought together with one or
+     *   more  products in the same shopping session. Commonly displayed after
+     *   `add-to-cart` events, on product detail pages, or on the shopping cart
+     *   page.
+     * * `home_page`: Predicts the next product that a user will most likely
+     *   engage with or purchase based on the shopping or viewing history of the
+     *   specified `userId` or `visitorId`. For example - Recommendations for you.
+     * * `product_detail`: Predicts the next product that a user will most likely
+     *   engage with or purchase. The prediction is based on the shopping or
+     *   viewing history of the specified `userId` or `visitorId` and its
+     *   relevance to a specified `CatalogItem`. Typically used on product detail
+     *   pages. For example - More products like this.
+     * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+     *   the specified `userId` or `visitorId`, most recent ones first. Returns
+     *   nothing if neither of them has viewed any products yet. For example -
+     *   Recently viewed.
+     * The full list of available placements can be seen at
+     * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+     * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The placement. + */ + public java.lang.String getPlacement() { + java.lang.Object ref = placement_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + placement_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of the format:
+     * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+     * The id of the recommendation engine placement. This id is used to identify
+     * the set of models that will be used to make the prediction.
+     * We currently support three placements with the following IDs by default:
+     * * `shopping_cart`: Predicts products frequently bought together with one or
+     *   more  products in the same shopping session. Commonly displayed after
+     *   `add-to-cart` events, on product detail pages, or on the shopping cart
+     *   page.
+     * * `home_page`: Predicts the next product that a user will most likely
+     *   engage with or purchase based on the shopping or viewing history of the
+     *   specified `userId` or `visitorId`. For example - Recommendations for you.
+     * * `product_detail`: Predicts the next product that a user will most likely
+     *   engage with or purchase. The prediction is based on the shopping or
+     *   viewing history of the specified `userId` or `visitorId` and its
+     *   relevance to a specified `CatalogItem`. Typically used on product detail
+     *   pages. For example - More products like this.
+     * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+     *   the specified `userId` or `visitorId`, most recent ones first. Returns
+     *   nothing if neither of them has viewed any products yet. For example -
+     *   Recently viewed.
+     * The full list of available placements can be seen at
+     * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+     * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for placement. + */ + public com.google.protobuf.ByteString getPlacementBytes() { + java.lang.Object ref = placement_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + placement_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of the format:
+     * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+     * The id of the recommendation engine placement. This id is used to identify
+     * the set of models that will be used to make the prediction.
+     * We currently support three placements with the following IDs by default:
+     * * `shopping_cart`: Predicts products frequently bought together with one or
+     *   more  products in the same shopping session. Commonly displayed after
+     *   `add-to-cart` events, on product detail pages, or on the shopping cart
+     *   page.
+     * * `home_page`: Predicts the next product that a user will most likely
+     *   engage with or purchase based on the shopping or viewing history of the
+     *   specified `userId` or `visitorId`. For example - Recommendations for you.
+     * * `product_detail`: Predicts the next product that a user will most likely
+     *   engage with or purchase. The prediction is based on the shopping or
+     *   viewing history of the specified `userId` or `visitorId` and its
+     *   relevance to a specified `CatalogItem`. Typically used on product detail
+     *   pages. For example - More products like this.
+     * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+     *   the specified `userId` or `visitorId`, most recent ones first. Returns
+     *   nothing if neither of them has viewed any products yet. For example -
+     *   Recently viewed.
+     * The full list of available placements can be seen at
+     * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+     * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The placement to set. + * @return This builder for chaining. + */ + public Builder setPlacement(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + placement_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of the format:
+     * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+     * The id of the recommendation engine placement. This id is used to identify
+     * the set of models that will be used to make the prediction.
+     * We currently support three placements with the following IDs by default:
+     * * `shopping_cart`: Predicts products frequently bought together with one or
+     *   more  products in the same shopping session. Commonly displayed after
+     *   `add-to-cart` events, on product detail pages, or on the shopping cart
+     *   page.
+     * * `home_page`: Predicts the next product that a user will most likely
+     *   engage with or purchase based on the shopping or viewing history of the
+     *   specified `userId` or `visitorId`. For example - Recommendations for you.
+     * * `product_detail`: Predicts the next product that a user will most likely
+     *   engage with or purchase. The prediction is based on the shopping or
+     *   viewing history of the specified `userId` or `visitorId` and its
+     *   relevance to a specified `CatalogItem`. Typically used on product detail
+     *   pages. For example - More products like this.
+     * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+     *   the specified `userId` or `visitorId`, most recent ones first. Returns
+     *   nothing if neither of them has viewed any products yet. For example -
+     *   Recently viewed.
+     * The full list of available placements can be seen at
+     * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+     * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearPlacement() { + + placement_ = getDefaultInstance().getPlacement(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of the format:
+     * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+     * The id of the recommendation engine placement. This id is used to identify
+     * the set of models that will be used to make the prediction.
+     * We currently support three placements with the following IDs by default:
+     * * `shopping_cart`: Predicts products frequently bought together with one or
+     *   more  products in the same shopping session. Commonly displayed after
+     *   `add-to-cart` events, on product detail pages, or on the shopping cart
+     *   page.
+     * * `home_page`: Predicts the next product that a user will most likely
+     *   engage with or purchase based on the shopping or viewing history of the
+     *   specified `userId` or `visitorId`. For example - Recommendations for you.
+     * * `product_detail`: Predicts the next product that a user will most likely
+     *   engage with or purchase. The prediction is based on the shopping or
+     *   viewing history of the specified `userId` or `visitorId` and its
+     *   relevance to a specified `CatalogItem`. Typically used on product detail
+     *   pages. For example - More products like this.
+     * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+     *   the specified `userId` or `visitorId`, most recent ones first. Returns
+     *   nothing if neither of them has viewed any products yet. For example -
+     *   Recently viewed.
+     * The full list of available placements can be seen at
+     * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+     * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for placement to set. + * @return This builder for chaining. + */ + public Builder setPlacementBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + placement_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.UserEvent userEvent_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder> + userEventBuilder_; + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEvent field is set. + */ + public boolean hasUserEvent() { + return userEventBuilder_ != null || userEvent_ != null; + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEvent. + */ + public com.google.cloud.retail.v2.UserEvent getUserEvent() { + if (userEventBuilder_ == null) { + return userEvent_ == null + ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() + : userEvent_; + } else { + return userEventBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEvent(com.google.cloud.retail.v2.UserEvent value) { + if (userEventBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + userEvent_ = value; + onChanged(); + } else { + userEventBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEvent(com.google.cloud.retail.v2.UserEvent.Builder builderForValue) { + if (userEventBuilder_ == null) { + userEvent_ = builderForValue.build(); + onChanged(); + } else { + userEventBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeUserEvent(com.google.cloud.retail.v2.UserEvent value) { + if (userEventBuilder_ == null) { + if (userEvent_ != null) { + userEvent_ = + com.google.cloud.retail.v2.UserEvent.newBuilder(userEvent_) + .mergeFrom(value) + .buildPartial(); + } else { + userEvent_ = value; + } + onChanged(); + } else { + userEventBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearUserEvent() { + if (userEventBuilder_ == null) { + userEvent_ = null; + onChanged(); + } else { + userEvent_ = null; + userEventBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEvent.Builder getUserEventBuilder() { + + onChanged(); + return getUserEventFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder() { + if (userEventBuilder_ != null) { + return userEventBuilder_.getMessageOrBuilder(); + } else { + return userEvent_ == null + ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() + : userEvent_; + } + } + /** + * + * + *
+     * Required. Context about the user, what they are looking at and what action
+     * they took to trigger the predict request. Note that this user event detail
+     * won't be ingested to userEvent logs. Thus, a separate userEvent write
+     * request is required for event logging.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder> + getUserEventFieldBuilder() { + if (userEventBuilder_ == null) { + userEventBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder>( + getUserEvent(), getParentForChildren(), isClean()); + userEvent_ = null; + } + return userEventBuilder_; + } + + private int pageSize_; + /** + * + * + *
+     * Maximum number of results to return per page. Set this property
+     * to the number of prediction results needed. If zero, the service will
+     * choose a reasonable default. The maximum allowed value is 100. Values
+     * above 100 will be coerced to 100.
+     * 
+ * + * int32 page_size = 3; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Maximum number of results to return per page. Set this property
+     * to the number of prediction results needed. If zero, the service will
+     * choose a reasonable default. The maximum allowed value is 100. Values
+     * above 100 will be coerced to 100.
+     * 
+ * + * int32 page_size = 3; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Maximum number of results to return per page. Set this property
+     * to the number of prediction results needed. If zero, the service will
+     * choose a reasonable default. The maximum allowed value is 100. Values
+     * above 100 will be coerced to 100.
+     * 
+ * + * int32 page_size = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * The previous PredictResponse.next_page_token.
+     * 
+ * + * string page_token = 4; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The previous PredictResponse.next_page_token.
+     * 
+ * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The previous PredictResponse.next_page_token.
+     * 
+ * + * string page_token = 4; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The previous PredictResponse.next_page_token.
+     * 
+ * + * string page_token = 4; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * The previous PredictResponse.next_page_token.
+     * 
+ * + * string page_token = 4; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Filter for restricting prediction results with a length limit of 5,000
+     * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+     *  * Tag expressions. Restricts predictions to products that match all of the
+     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+     *    expression is enclosed in parentheses, and must be separated from the
+     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+     *    with a size limit of 1,000 characters.
+     *  * filterOutOfStockItems. Restricts predictions to products that do not
+     *  have a
+     *    stockState value of OUT_OF_STOCK.
+     * Examples:
+     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+     *  * filterOutOfStockItems  tag=(-"promotional")
+     *  * filterOutOfStockItems
+     * If your filter blocks all prediction results, nothing will be returned. If
+     * you want generic (unfiltered) popular products to be returned instead, set
+     * `strictFiltering` to false in `PredictRequest.params`.
+     * 
+ * + * string filter = 5; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Filter for restricting prediction results with a length limit of 5,000
+     * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+     *  * Tag expressions. Restricts predictions to products that match all of the
+     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+     *    expression is enclosed in parentheses, and must be separated from the
+     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+     *    with a size limit of 1,000 characters.
+     *  * filterOutOfStockItems. Restricts predictions to products that do not
+     *  have a
+     *    stockState value of OUT_OF_STOCK.
+     * Examples:
+     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+     *  * filterOutOfStockItems  tag=(-"promotional")
+     *  * filterOutOfStockItems
+     * If your filter blocks all prediction results, nothing will be returned. If
+     * you want generic (unfiltered) popular products to be returned instead, set
+     * `strictFiltering` to false in `PredictRequest.params`.
+     * 
+ * + * string filter = 5; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Filter for restricting prediction results with a length limit of 5,000
+     * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+     *  * Tag expressions. Restricts predictions to products that match all of the
+     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+     *    expression is enclosed in parentheses, and must be separated from the
+     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+     *    with a size limit of 1,000 characters.
+     *  * filterOutOfStockItems. Restricts predictions to products that do not
+     *  have a
+     *    stockState value of OUT_OF_STOCK.
+     * Examples:
+     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+     *  * filterOutOfStockItems  tag=(-"promotional")
+     *  * filterOutOfStockItems
+     * If your filter blocks all prediction results, nothing will be returned. If
+     * you want generic (unfiltered) popular products to be returned instead, set
+     * `strictFiltering` to false in `PredictRequest.params`.
+     * 
+ * + * string filter = 5; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Filter for restricting prediction results with a length limit of 5,000
+     * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+     *  * Tag expressions. Restricts predictions to products that match all of the
+     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+     *    expression is enclosed in parentheses, and must be separated from the
+     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+     *    with a size limit of 1,000 characters.
+     *  * filterOutOfStockItems. Restricts predictions to products that do not
+     *  have a
+     *    stockState value of OUT_OF_STOCK.
+     * Examples:
+     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+     *  * filterOutOfStockItems  tag=(-"promotional")
+     *  * filterOutOfStockItems
+     * If your filter blocks all prediction results, nothing will be returned. If
+     * you want generic (unfiltered) popular products to be returned instead, set
+     * `strictFiltering` to false in `PredictRequest.params`.
+     * 
+ * + * string filter = 5; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Filter for restricting prediction results with a length limit of 5,000
+     * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+     *  * Tag expressions. Restricts predictions to products that match all of the
+     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+     *    expression is enclosed in parentheses, and must be separated from the
+     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+     *    with a size limit of 1,000 characters.
+     *  * filterOutOfStockItems. Restricts predictions to products that do not
+     *  have a
+     *    stockState value of OUT_OF_STOCK.
+     * Examples:
+     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+     *  * filterOutOfStockItems  tag=(-"promotional")
+     *  * filterOutOfStockItems
+     * If your filter blocks all prediction results, nothing will be returned. If
+     * you want generic (unfiltered) popular products to be returned instead, set
+     * `strictFiltering` to false in `PredictRequest.params`.
+     * 
+ * + * string filter = 5; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Use validate only mode for this prediction query. If set to true, a
+     * dummy model will be used that returns arbitrary products.
+     * Note that the validate only mode should only be used for testing the API,
+     * or if the model is not ready.
+     * 
+ * + * bool validate_only = 6; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Use validate only mode for this prediction query. If set to true, a
+     * dummy model will be used that returns arbitrary products.
+     * Note that the validate only mode should only be used for testing the API,
+     * or if the model is not ready.
+     * 
+ * + * bool validate_only = 6; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Use validate only mode for this prediction query. If set to true, a
+     * dummy model will be used that returns arbitrary products.
+     * Note that the validate only mode should only be used for testing the API,
+     * or if the model is not ready.
+     * 
+ * + * bool validate_only = 6; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private com.google.protobuf.MapField params_; + + private com.google.protobuf.MapField + internalGetParams() { + if (params_ == null) { + return com.google.protobuf.MapField.emptyMapField(ParamsDefaultEntryHolder.defaultEntry); + } + return params_; + } + + private com.google.protobuf.MapField + internalGetMutableParams() { + onChanged(); + ; + if (params_ == null) { + params_ = com.google.protobuf.MapField.newMapField(ParamsDefaultEntryHolder.defaultEntry); + } + if (!params_.isMutable()) { + params_ = params_.copy(); + } + return params_; + } + + public int getParamsCount() { + return internalGetParams().getMap().size(); + } + /** + * + * + *
+     * Additional domain specific parameters for the predictions.
+     * Allowed values:
+     * * `returnProduct`: Boolean. If set to true, the associated product
+     *    object will be returned in the `results.metadata` field in the
+     *    prediction response.
+     * * `returnScore`: Boolean. If set to true, the prediction 'score'
+     *    corresponding to each returned product will be set in the
+     *    `results.metadata` field in the prediction response. The given
+     *    'score' indicates the probability of an product being clicked/purchased
+     *    given the user's context and history.
+     * * `strictFiltering`: Boolean. True by default. If set to false, the service
+     *    will return generic (unfiltered) popular products instead of empty if
+     *    your filter blocks all prediction results.
+     * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public boolean containsParams(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetParams().getMap().containsKey(key); + } + /** Use {@link #getParamsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getParams() { + return getParamsMap(); + } + /** + * + * + *
+     * Additional domain specific parameters for the predictions.
+     * Allowed values:
+     * * `returnProduct`: Boolean. If set to true, the associated product
+     *    object will be returned in the `results.metadata` field in the
+     *    prediction response.
+     * * `returnScore`: Boolean. If set to true, the prediction 'score'
+     *    corresponding to each returned product will be set in the
+     *    `results.metadata` field in the prediction response. The given
+     *    'score' indicates the probability of an product being clicked/purchased
+     *    given the user's context and history.
+     * * `strictFiltering`: Boolean. True by default. If set to false, the service
+     *    will return generic (unfiltered) popular products instead of empty if
+     *    your filter blocks all prediction results.
+     * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public java.util.Map getParamsMap() { + return internalGetParams().getMap(); + } + /** + * + * + *
+     * Additional domain specific parameters for the predictions.
+     * Allowed values:
+     * * `returnProduct`: Boolean. If set to true, the associated product
+     *    object will be returned in the `results.metadata` field in the
+     *    prediction response.
+     * * `returnScore`: Boolean. If set to true, the prediction 'score'
+     *    corresponding to each returned product will be set in the
+     *    `results.metadata` field in the prediction response. The given
+     *    'score' indicates the probability of an product being clicked/purchased
+     *    given the user's context and history.
+     * * `strictFiltering`: Boolean. True by default. If set to false, the service
+     *    will return generic (unfiltered) popular products instead of empty if
+     *    your filter blocks all prediction results.
+     * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public com.google.protobuf.Value getParamsOrDefault( + java.lang.String key, com.google.protobuf.Value defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetParams().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Additional domain specific parameters for the predictions.
+     * Allowed values:
+     * * `returnProduct`: Boolean. If set to true, the associated product
+     *    object will be returned in the `results.metadata` field in the
+     *    prediction response.
+     * * `returnScore`: Boolean. If set to true, the prediction 'score'
+     *    corresponding to each returned product will be set in the
+     *    `results.metadata` field in the prediction response. The given
+     *    'score' indicates the probability of an product being clicked/purchased
+     *    given the user's context and history.
+     * * `strictFiltering`: Boolean. True by default. If set to false, the service
+     *    will return generic (unfiltered) popular products instead of empty if
+     *    your filter blocks all prediction results.
+     * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + @java.lang.Override + public com.google.protobuf.Value getParamsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetParams().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearParams() { + internalGetMutableParams().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Additional domain specific parameters for the predictions.
+     * Allowed values:
+     * * `returnProduct`: Boolean. If set to true, the associated product
+     *    object will be returned in the `results.metadata` field in the
+     *    prediction response.
+     * * `returnScore`: Boolean. If set to true, the prediction 'score'
+     *    corresponding to each returned product will be set in the
+     *    `results.metadata` field in the prediction response. The given
+     *    'score' indicates the probability of an product being clicked/purchased
+     *    given the user's context and history.
+     * * `strictFiltering`: Boolean. True by default. If set to false, the service
+     *    will return generic (unfiltered) popular products instead of empty if
+     *    your filter blocks all prediction results.
+     * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + public Builder removeParams(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableParams().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableParams() { + return internalGetMutableParams().getMutableMap(); + } + /** + * + * + *
+     * Additional domain specific parameters for the predictions.
+     * Allowed values:
+     * * `returnProduct`: Boolean. If set to true, the associated product
+     *    object will be returned in the `results.metadata` field in the
+     *    prediction response.
+     * * `returnScore`: Boolean. If set to true, the prediction 'score'
+     *    corresponding to each returned product will be set in the
+     *    `results.metadata` field in the prediction response. The given
+     *    'score' indicates the probability of an product being clicked/purchased
+     *    given the user's context and history.
+     * * `strictFiltering`: Boolean. True by default. If set to false, the service
+     *    will return generic (unfiltered) popular products instead of empty if
+     *    your filter blocks all prediction results.
+     * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + public Builder putParams(java.lang.String key, com.google.protobuf.Value value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableParams().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Additional domain specific parameters for the predictions.
+     * Allowed values:
+     * * `returnProduct`: Boolean. If set to true, the associated product
+     *    object will be returned in the `results.metadata` field in the
+     *    prediction response.
+     * * `returnScore`: Boolean. If set to true, the prediction 'score'
+     *    corresponding to each returned product will be set in the
+     *    `results.metadata` field in the prediction response. The given
+     *    'score' indicates the probability of an product being clicked/purchased
+     *    given the user's context and history.
+     * * `strictFiltering`: Boolean. True by default. If set to false, the service
+     *    will return generic (unfiltered) popular products instead of empty if
+     *    your filter blocks all prediction results.
+     * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + public Builder putAllParams(java.util.Map values) { + internalGetMutableParams().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * The labels for the predict request.
+     *  * Label keys can contain lowercase letters, digits and hyphens, must start
+     *    with a letter, and must end with a letter or digit.
+     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+     *    must start with a letter, and must end with a letter or digit.
+     *  * No more than 64 labels can be associated with a given request.
+     * See https://goo.gl/xmQnxf for more information on and examples of labels.
+     * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * The labels for the predict request.
+     *  * Label keys can contain lowercase letters, digits and hyphens, must start
+     *    with a letter, and must end with a letter or digit.
+     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+     *    must start with a letter, and must end with a letter or digit.
+     *  * No more than 64 labels can be associated with a given request.
+     * See https://goo.gl/xmQnxf for more information on and examples of labels.
+     * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * The labels for the predict request.
+     *  * Label keys can contain lowercase letters, digits and hyphens, must start
+     *    with a letter, and must end with a letter or digit.
+     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+     *    must start with a letter, and must end with a letter or digit.
+     *  * No more than 64 labels can be associated with a given request.
+     * See https://goo.gl/xmQnxf for more information on and examples of labels.
+     * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * The labels for the predict request.
+     *  * Label keys can contain lowercase letters, digits and hyphens, must start
+     *    with a letter, and must end with a letter or digit.
+     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+     *    must start with a letter, and must end with a letter or digit.
+     *  * No more than 64 labels can be associated with a given request.
+     * See https://goo.gl/xmQnxf for more information on and examples of labels.
+     * 
+ * + * map<string, string> labels = 8; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * The labels for the predict request.
+     *  * Label keys can contain lowercase letters, digits and hyphens, must start
+     *    with a letter, and must end with a letter or digit.
+     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+     *    must start with a letter, and must end with a letter or digit.
+     *  * No more than 64 labels can be associated with a given request.
+     * See https://goo.gl/xmQnxf for more information on and examples of labels.
+     * 
+ * + * map<string, string> labels = 8; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * The labels for the predict request.
+     *  * Label keys can contain lowercase letters, digits and hyphens, must start
+     *    with a letter, and must end with a letter or digit.
+     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+     *    must start with a letter, and must end with a letter or digit.
+     *  * No more than 64 labels can be associated with a given request.
+     * See https://goo.gl/xmQnxf for more information on and examples of labels.
+     * 
+ * + * map<string, string> labels = 8; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * The labels for the predict request.
+     *  * Label keys can contain lowercase letters, digits and hyphens, must start
+     *    with a letter, and must end with a letter or digit.
+     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+     *    must start with a letter, and must end with a letter or digit.
+     *  * No more than 64 labels can be associated with a given request.
+     * See https://goo.gl/xmQnxf for more information on and examples of labels.
+     * 
+ * + * map<string, string> labels = 8; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PredictRequest) + private static final com.google.cloud.retail.v2.PredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PredictRequest(); + } + + public static com.google.cloud.retail.v2.PredictRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PredictRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PredictRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictRequestOrBuilder.java new file mode 100644 index 00000000..fad4018b --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictRequestOrBuilder.java @@ -0,0 +1,459 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/prediction_service.proto + +package com.google.cloud.retail.v2; + +public interface PredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PredictRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full resource name of the format:
+   * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+   * The id of the recommendation engine placement. This id is used to identify
+   * the set of models that will be used to make the prediction.
+   * We currently support three placements with the following IDs by default:
+   * * `shopping_cart`: Predicts products frequently bought together with one or
+   *   more  products in the same shopping session. Commonly displayed after
+   *   `add-to-cart` events, on product detail pages, or on the shopping cart
+   *   page.
+   * * `home_page`: Predicts the next product that a user will most likely
+   *   engage with or purchase based on the shopping or viewing history of the
+   *   specified `userId` or `visitorId`. For example - Recommendations for you.
+   * * `product_detail`: Predicts the next product that a user will most likely
+   *   engage with or purchase. The prediction is based on the shopping or
+   *   viewing history of the specified `userId` or `visitorId` and its
+   *   relevance to a specified `CatalogItem`. Typically used on product detail
+   *   pages. For example - More products like this.
+   * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+   *   the specified `userId` or `visitorId`, most recent ones first. Returns
+   *   nothing if neither of them has viewed any products yet. For example -
+   *   Recently viewed.
+   * The full list of available placements can be seen at
+   * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+   * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The placement. + */ + java.lang.String getPlacement(); + /** + * + * + *
+   * Required. Full resource name of the format:
+   * {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
+   * The id of the recommendation engine placement. This id is used to identify
+   * the set of models that will be used to make the prediction.
+   * We currently support three placements with the following IDs by default:
+   * * `shopping_cart`: Predicts products frequently bought together with one or
+   *   more  products in the same shopping session. Commonly displayed after
+   *   `add-to-cart` events, on product detail pages, or on the shopping cart
+   *   page.
+   * * `home_page`: Predicts the next product that a user will most likely
+   *   engage with or purchase based on the shopping or viewing history of the
+   *   specified `userId` or `visitorId`. For example - Recommendations for you.
+   * * `product_detail`: Predicts the next product that a user will most likely
+   *   engage with or purchase. The prediction is based on the shopping or
+   *   viewing history of the specified `userId` or `visitorId` and its
+   *   relevance to a specified `CatalogItem`. Typically used on product detail
+   *   pages. For example - More products like this.
+   * * `recently_viewed_default`: Returns up to 75 products recently viewed by
+   *   the specified `userId` or `visitorId`, most recent ones first. Returns
+   *   nothing if neither of them has viewed any products yet. For example -
+   *   Recently viewed.
+   * The full list of available placements can be seen at
+   * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
+   * 
+ * + * string placement = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for placement. + */ + com.google.protobuf.ByteString getPlacementBytes(); + + /** + * + * + *
+   * Required. Context about the user, what they are looking at and what action
+   * they took to trigger the predict request. Note that this user event detail
+   * won't be ingested to userEvent logs. Thus, a separate userEvent write
+   * request is required for event logging.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEvent field is set. + */ + boolean hasUserEvent(); + /** + * + * + *
+   * Required. Context about the user, what they are looking at and what action
+   * they took to trigger the predict request. Note that this user event detail
+   * won't be ingested to userEvent logs. Thus, a separate userEvent write
+   * request is required for event logging.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEvent. + */ + com.google.cloud.retail.v2.UserEvent getUserEvent(); + /** + * + * + *
+   * Required. Context about the user, what they are looking at and what action
+   * they took to trigger the predict request. Note that this user event detail
+   * won't be ingested to userEvent logs. Thus, a separate userEvent write
+   * request is required for event logging.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder(); + + /** + * + * + *
+   * Maximum number of results to return per page. Set this property
+   * to the number of prediction results needed. If zero, the service will
+   * choose a reasonable default. The maximum allowed value is 100. Values
+   * above 100 will be coerced to 100.
+   * 
+ * + * int32 page_size = 3; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * The previous PredictResponse.next_page_token.
+   * 
+ * + * string page_token = 4; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * The previous PredictResponse.next_page_token.
+   * 
+ * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Filter for restricting prediction results with a length limit of 5,000
+   * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+   *  * Tag expressions. Restricts predictions to products that match all of the
+   *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+   *    expression is enclosed in parentheses, and must be separated from the
+   *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+   *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+   *    with a size limit of 1,000 characters.
+   *  * filterOutOfStockItems. Restricts predictions to products that do not
+   *  have a
+   *    stockState value of OUT_OF_STOCK.
+   * Examples:
+   *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+   *  * filterOutOfStockItems  tag=(-"promotional")
+   *  * filterOutOfStockItems
+   * If your filter blocks all prediction results, nothing will be returned. If
+   * you want generic (unfiltered) popular products to be returned instead, set
+   * `strictFiltering` to false in `PredictRequest.params`.
+   * 
+ * + * string filter = 5; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Filter for restricting prediction results with a length limit of 5,000
+   * characters. Accepts values for tags and the `filterOutOfStockItems` flag.
+   *  * Tag expressions. Restricts predictions to products that match all of the
+   *    specified tags. Boolean operators `OR` and `NOT` are supported if the
+   *    expression is enclosed in parentheses, and must be separated from the
+   *    tag values by a space. `-"tagA"` is also supported and is equivalent to
+   *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
+   *    with a size limit of 1,000 characters.
+   *  * filterOutOfStockItems. Restricts predictions to products that do not
+   *  have a
+   *    stockState value of OUT_OF_STOCK.
+   * Examples:
+   *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
+   *  * filterOutOfStockItems  tag=(-"promotional")
+   *  * filterOutOfStockItems
+   * If your filter blocks all prediction results, nothing will be returned. If
+   * you want generic (unfiltered) popular products to be returned instead, set
+   * `strictFiltering` to false in `PredictRequest.params`.
+   * 
+ * + * string filter = 5; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); + + /** + * + * + *
+   * Use validate only mode for this prediction query. If set to true, a
+   * dummy model will be used that returns arbitrary products.
+   * Note that the validate only mode should only be used for testing the API,
+   * or if the model is not ready.
+   * 
+ * + * bool validate_only = 6; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + int getParamsCount(); + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + boolean containsParams(java.lang.String key); + /** Use {@link #getParamsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getParams(); + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + java.util.Map getParamsMap(); + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + com.google.protobuf.Value getParamsOrDefault( + java.lang.String key, com.google.protobuf.Value defaultValue); + /** + * + * + *
+   * Additional domain specific parameters for the predictions.
+   * Allowed values:
+   * * `returnProduct`: Boolean. If set to true, the associated product
+   *    object will be returned in the `results.metadata` field in the
+   *    prediction response.
+   * * `returnScore`: Boolean. If set to true, the prediction 'score'
+   *    corresponding to each returned product will be set in the
+   *    `results.metadata` field in the prediction response. The given
+   *    'score' indicates the probability of an product being clicked/purchased
+   *    given the user's context and history.
+   * * `strictFiltering`: Boolean. True by default. If set to false, the service
+   *    will return generic (unfiltered) popular products instead of empty if
+   *    your filter blocks all prediction results.
+   * 
+ * + * map<string, .google.protobuf.Value> params = 7; + */ + com.google.protobuf.Value getParamsOrThrow(java.lang.String key); + + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + int getLabelsCount(); + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * The labels for the predict request.
+   *  * Label keys can contain lowercase letters, digits and hyphens, must start
+   *    with a letter, and must end with a letter or digit.
+   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
+   *    must start with a letter, and must end with a letter or digit.
+   *  * No more than 64 labels can be associated with a given request.
+   * See https://goo.gl/xmQnxf for more information on and examples of labels.
+   * 
+ * + * map<string, string> labels = 8; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictResponse.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictResponse.java new file mode 100644 index 00000000..ad7156d8 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictResponse.java @@ -0,0 +1,2689 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/prediction_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response message for predict method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PredictResponse} + */ +public final class PredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PredictResponse) + PredictResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use PredictResponse.newBuilder() to construct. + private PredictResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PredictResponse() { + results_ = java.util.Collections.emptyList(); + attributionToken_ = ""; + missingIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PredictResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PredictResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList< + com.google.cloud.retail.v2.PredictResponse.PredictionResult>(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.retail.v2.PredictResponse.PredictionResult.parser(), + extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + attributionToken_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + missingIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + missingIds_.add(s); + break; + } + case 32: + { + validateOnly_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + missingIds_ = missingIds_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PredictResponse.class, + com.google.cloud.retail.v2.PredictResponse.Builder.class); + } + + public interface PredictionResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PredictResponse.PredictionResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * ID of the recommended product
+     * 
+ * + * string id = 1; + * + * @return The id. + */ + java.lang.String getId(); + /** + * + * + *
+     * ID of the recommended product
+     * 
+ * + * string id = 1; + * + * @return The bytes for id. + */ + com.google.protobuf.ByteString getIdBytes(); + + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + int getMetadataCount(); + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + boolean containsMetadata(java.lang.String key); + /** Use {@link #getMetadataMap()} instead. */ + @java.lang.Deprecated + java.util.Map getMetadata(); + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + java.util.Map getMetadataMap(); + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + com.google.protobuf.Value getMetadataOrDefault( + java.lang.String key, com.google.protobuf.Value defaultValue); + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + com.google.protobuf.Value getMetadataOrThrow(java.lang.String key); + } + /** + * + * + *
+   * PredictionResult represents the recommendation prediction results.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PredictResponse.PredictionResult} + */ + public static final class PredictionResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PredictResponse.PredictionResult) + PredictionResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use PredictionResult.newBuilder() to construct. + private PredictionResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PredictionResult() { + id_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PredictionResult(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PredictionResult( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + id_ = s; + break; + } + case 18: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + metadata_ = + com.google.protobuf.MapField.newMapField( + MetadataDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry + metadata__ = + input.readMessage( + MetadataDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + metadata_.getMutableMap().put(metadata__.getKey(), metadata__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 2: + return internalGetMetadata(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PredictResponse.PredictionResult.class, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder.class); + } + + public static final int ID_FIELD_NUMBER = 1; + private volatile java.lang.Object id_; + /** + * + * + *
+     * ID of the recommended product
+     * 
+ * + * string id = 1; + * + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + * + * + *
+     * ID of the recommended product
+     * 
+ * + * string id = 1; + * + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int METADATA_FIELD_NUMBER = 2; + + private static final class MetadataDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_MetadataEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.protobuf.Value.getDefaultInstance()); + } + + private com.google.protobuf.MapField metadata_; + + private com.google.protobuf.MapField + internalGetMetadata() { + if (metadata_ == null) { + return com.google.protobuf.MapField.emptyMapField(MetadataDefaultEntryHolder.defaultEntry); + } + return metadata_; + } + + public int getMetadataCount() { + return internalGetMetadata().getMap().size(); + } + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public boolean containsMetadata(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetMetadata().getMap().containsKey(key); + } + /** Use {@link #getMetadataMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getMetadata() { + return getMetadataMap(); + } + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public java.util.Map getMetadataMap() { + return internalGetMetadata().getMap(); + } + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public com.google.protobuf.Value getMetadataOrDefault( + java.lang.String key, com.google.protobuf.Value defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetMetadata().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Additional product metadata / annotations.
+     * Possible values:
+     * * `product`: JSON representation of the product. Will be set if
+     *   `returnProduct` is set to true in `PredictRequest.params`.
+     * * `score`: Prediction score in double value. Will be set if
+     *   `returnScore` is set to true in `PredictRequest.params`.
+     * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public com.google.protobuf.Value getMetadataOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetMetadata().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetMetadata(), MetadataDefaultEntryHolder.defaultEntry, 2); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_); + } + for (java.util.Map.Entry entry : + internalGetMetadata().getMap().entrySet()) { + com.google.protobuf.MapEntry metadata__ = + MetadataDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, metadata__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PredictResponse.PredictionResult)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PredictResponse.PredictionResult other = + (com.google.cloud.retail.v2.PredictResponse.PredictionResult) obj; + + if (!getId().equals(other.getId())) return false; + if (!internalGetMetadata().equals(other.internalGetMetadata())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + if (!internalGetMetadata().getMap().isEmpty()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + internalGetMetadata().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.PredictResponse.PredictionResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * PredictionResult represents the recommendation prediction results.
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PredictResponse.PredictionResult} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PredictResponse.PredictionResult) + com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 2: + return internalGetMetadata(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 2: + return internalGetMutableMetadata(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PredictResponse.PredictionResult.class, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PredictResponse.PredictionResult.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + id_ = ""; + + internalGetMutableMetadata().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse.PredictionResult + getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse.PredictionResult build() { + com.google.cloud.retail.v2.PredictResponse.PredictionResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse.PredictionResult buildPartial() { + com.google.cloud.retail.v2.PredictResponse.PredictionResult result = + new com.google.cloud.retail.v2.PredictResponse.PredictionResult(this); + int from_bitField0_ = bitField0_; + result.id_ = id_; + result.metadata_ = internalGetMetadata(); + result.metadata_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PredictResponse.PredictionResult) { + return mergeFrom((com.google.cloud.retail.v2.PredictResponse.PredictionResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PredictResponse.PredictionResult other) { + if (other + == com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance()) + return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + onChanged(); + } + internalGetMutableMetadata().mergeFrom(other.internalGetMetadata()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PredictResponse.PredictionResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.PredictResponse.PredictionResult) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object id_ = ""; + /** + * + * + *
+       * ID of the recommended product
+       * 
+ * + * string id = 1; + * + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * ID of the recommended product
+       * 
+ * + * string id = 1; + * + * @return The bytes for id. + */ + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * ID of the recommended product
+       * 
+ * + * string id = 1; + * + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + id_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * ID of the recommended product
+       * 
+ * + * string id = 1; + * + * @return This builder for chaining. + */ + public Builder clearId() { + + id_ = getDefaultInstance().getId(); + onChanged(); + return this; + } + /** + * + * + *
+       * ID of the recommended product
+       * 
+ * + * string id = 1; + * + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + id_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.MapField metadata_; + + private com.google.protobuf.MapField + internalGetMetadata() { + if (metadata_ == null) { + return com.google.protobuf.MapField.emptyMapField( + MetadataDefaultEntryHolder.defaultEntry); + } + return metadata_; + } + + private com.google.protobuf.MapField + internalGetMutableMetadata() { + onChanged(); + ; + if (metadata_ == null) { + metadata_ = + com.google.protobuf.MapField.newMapField(MetadataDefaultEntryHolder.defaultEntry); + } + if (!metadata_.isMutable()) { + metadata_ = metadata_.copy(); + } + return metadata_; + } + + public int getMetadataCount() { + return internalGetMetadata().getMap().size(); + } + /** + * + * + *
+       * Additional product metadata / annotations.
+       * Possible values:
+       * * `product`: JSON representation of the product. Will be set if
+       *   `returnProduct` is set to true in `PredictRequest.params`.
+       * * `score`: Prediction score in double value. Will be set if
+       *   `returnScore` is set to true in `PredictRequest.params`.
+       * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public boolean containsMetadata(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetMetadata().getMap().containsKey(key); + } + /** Use {@link #getMetadataMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getMetadata() { + return getMetadataMap(); + } + /** + * + * + *
+       * Additional product metadata / annotations.
+       * Possible values:
+       * * `product`: JSON representation of the product. Will be set if
+       *   `returnProduct` is set to true in `PredictRequest.params`.
+       * * `score`: Prediction score in double value. Will be set if
+       *   `returnScore` is set to true in `PredictRequest.params`.
+       * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public java.util.Map getMetadataMap() { + return internalGetMetadata().getMap(); + } + /** + * + * + *
+       * Additional product metadata / annotations.
+       * Possible values:
+       * * `product`: JSON representation of the product. Will be set if
+       *   `returnProduct` is set to true in `PredictRequest.params`.
+       * * `score`: Prediction score in double value. Will be set if
+       *   `returnScore` is set to true in `PredictRequest.params`.
+       * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public com.google.protobuf.Value getMetadataOrDefault( + java.lang.String key, com.google.protobuf.Value defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetMetadata().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+       * Additional product metadata / annotations.
+       * Possible values:
+       * * `product`: JSON representation of the product. Will be set if
+       *   `returnProduct` is set to true in `PredictRequest.params`.
+       * * `score`: Prediction score in double value. Will be set if
+       *   `returnScore` is set to true in `PredictRequest.params`.
+       * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + @java.lang.Override + public com.google.protobuf.Value getMetadataOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetMetadata().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearMetadata() { + internalGetMutableMetadata().getMutableMap().clear(); + return this; + } + /** + * + * + *
+       * Additional product metadata / annotations.
+       * Possible values:
+       * * `product`: JSON representation of the product. Will be set if
+       *   `returnProduct` is set to true in `PredictRequest.params`.
+       * * `score`: Prediction score in double value. Will be set if
+       *   `returnScore` is set to true in `PredictRequest.params`.
+       * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + public Builder removeMetadata(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableMetadata().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableMetadata() { + return internalGetMutableMetadata().getMutableMap(); + } + /** + * + * + *
+       * Additional product metadata / annotations.
+       * Possible values:
+       * * `product`: JSON representation of the product. Will be set if
+       *   `returnProduct` is set to true in `PredictRequest.params`.
+       * * `score`: Prediction score in double value. Will be set if
+       *   `returnScore` is set to true in `PredictRequest.params`.
+       * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + public Builder putMetadata(java.lang.String key, com.google.protobuf.Value value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableMetadata().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+       * Additional product metadata / annotations.
+       * Possible values:
+       * * `product`: JSON representation of the product. Will be set if
+       *   `returnProduct` is set to true in `PredictRequest.params`.
+       * * `score`: Prediction score in double value. Will be set if
+       *   `returnScore` is set to true in `PredictRequest.params`.
+       * 
+ * + * map<string, .google.protobuf.Value> metadata = 2; + */ + public Builder putAllMetadata( + java.util.Map values) { + internalGetMutableMetadata().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PredictResponse.PredictionResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PredictResponse.PredictionResult) + private static final com.google.cloud.retail.v2.PredictResponse.PredictionResult + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PredictResponse.PredictionResult(); + } + + public static com.google.cloud.retail.v2.PredictResponse.PredictionResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PredictionResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PredictionResult(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse.PredictionResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int RESULTS_FIELD_NUMBER = 1; + private java.util.List results_; + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + @java.lang.Override + public java.util.List + getResultsList() { + return results_; + } + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + @java.lang.Override + public java.util.List< + ? extends com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + @java.lang.Override + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse.PredictionResult getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder getResultsOrBuilder( + int index) { + return results_.get(index); + } + + public static final int ATTRIBUTION_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object attributionToken_; + /** + * + * + *
+   * A unique attribution token. This should be included in the
+   * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+   * recommendation, which enables accurate attribution of recommendation model
+   * performance.
+   * 
+ * + * string attribution_token = 2; + * + * @return The attributionToken. + */ + @java.lang.Override + public java.lang.String getAttributionToken() { + java.lang.Object ref = attributionToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributionToken_ = s; + return s; + } + } + /** + * + * + *
+   * A unique attribution token. This should be included in the
+   * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+   * recommendation, which enables accurate attribution of recommendation model
+   * performance.
+   * 
+ * + * string attribution_token = 2; + * + * @return The bytes for attributionToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAttributionTokenBytes() { + java.lang.Object ref = attributionToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributionToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MISSING_IDS_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList missingIds_; + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @return A list containing the missingIds. + */ + public com.google.protobuf.ProtocolStringList getMissingIdsList() { + return missingIds_; + } + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @return The count of missingIds. + */ + public int getMissingIdsCount() { + return missingIds_.size(); + } + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @param index The index of the element to return. + * @return The missingIds at the given index. + */ + public java.lang.String getMissingIds(int index) { + return missingIds_.get(index); + } + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @param index The index of the value to return. + * @return The bytes of the missingIds at the given index. + */ + public com.google.protobuf.ByteString getMissingIdsBytes(int index) { + return missingIds_.getByteString(index); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * True if the validateOnly property was set in the request.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(1, results_.get(i)); + } + if (!getAttributionTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, attributionToken_); + } + for (int i = 0; i < missingIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, missingIds_.getRaw(i)); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, results_.get(i)); + } + if (!getAttributionTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, attributionToken_); + } + { + int dataSize = 0; + for (int i = 0; i < missingIds_.size(); i++) { + dataSize += computeStringSizeNoTag(missingIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getMissingIdsList().size(); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PredictResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PredictResponse other = + (com.google.cloud.retail.v2.PredictResponse) obj; + + if (!getResultsList().equals(other.getResultsList())) return false; + if (!getAttributionToken().equals(other.getAttributionToken())) return false; + if (!getMissingIdsList().equals(other.getMissingIdsList())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + hash = (37 * hash) + ATTRIBUTION_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getAttributionToken().hashCode(); + if (getMissingIdsCount() > 0) { + hash = (37 * hash) + MISSING_IDS_FIELD_NUMBER; + hash = (53 * hash) + getMissingIdsList().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PredictResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.PredictResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for predict method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PredictResponse) + com.google.cloud.retail.v2.PredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PredictResponse.class, + com.google.cloud.retail.v2.PredictResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PredictResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultsBuilder_.clear(); + } + attributionToken_ = ""; + + missingIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.PredictionServiceProto + .internal_static_google_cloud_retail_v2_PredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse build() { + com.google.cloud.retail.v2.PredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse buildPartial() { + com.google.cloud.retail.v2.PredictResponse result = + new com.google.cloud.retail.v2.PredictResponse(this); + int from_bitField0_ = bitField0_; + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + result.attributionToken_ = attributionToken_; + if (((bitField0_ & 0x00000002) != 0)) { + missingIds_ = missingIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.missingIds_ = missingIds_; + result.validateOnly_ = validateOnly_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PredictResponse) { + return mergeFrom((com.google.cloud.retail.v2.PredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PredictResponse other) { + if (other == com.google.cloud.retail.v2.PredictResponse.getDefaultInstance()) return this; + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (!other.getAttributionToken().isEmpty()) { + attributionToken_ = other.attributionToken_; + onChanged(); + } + if (!other.missingIds_.isEmpty()) { + if (missingIds_.isEmpty()) { + missingIds_ = other.missingIds_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureMissingIdsIsMutable(); + missingIds_.addAll(other.missingIds_); + } + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PredictResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.PredictResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList( + results_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.PredictResponse.PredictionResult, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder, + com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public java.util.List + getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public com.google.cloud.retail.v2.PredictResponse.PredictionResult getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder setResults( + int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder setResults( + int index, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder addResults(com.google.cloud.retail.v2.PredictResponse.PredictionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder addResults( + int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder addResults( + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder addResults( + int index, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder addAllResults( + java.lang.Iterable + values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder getResultsBuilder( + int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder getResultsOrBuilder( + int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public java.util.List< + ? extends com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder( + com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder addResultsBuilder( + int index) { + return getResultsFieldBuilder() + .addBuilder( + index, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of recommended products. The order represents the ranking (from the
+     * most relevant product to the least).
+     * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.PredictResponse.PredictionResult, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder, + com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.PredictResponse.PredictionResult, + com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder, + com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder>( + results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private java.lang.Object attributionToken_ = ""; + /** + * + * + *
+     * A unique attribution token. This should be included in the
+     * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+     * recommendation, which enables accurate attribution of recommendation model
+     * performance.
+     * 
+ * + * string attribution_token = 2; + * + * @return The attributionToken. + */ + public java.lang.String getAttributionToken() { + java.lang.Object ref = attributionToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributionToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A unique attribution token. This should be included in the
+     * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+     * recommendation, which enables accurate attribution of recommendation model
+     * performance.
+     * 
+ * + * string attribution_token = 2; + * + * @return The bytes for attributionToken. + */ + public com.google.protobuf.ByteString getAttributionTokenBytes() { + java.lang.Object ref = attributionToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributionToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A unique attribution token. This should be included in the
+     * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+     * recommendation, which enables accurate attribution of recommendation model
+     * performance.
+     * 
+ * + * string attribution_token = 2; + * + * @param value The attributionToken to set. + * @return This builder for chaining. + */ + public Builder setAttributionToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + attributionToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A unique attribution token. This should be included in the
+     * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+     * recommendation, which enables accurate attribution of recommendation model
+     * performance.
+     * 
+ * + * string attribution_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearAttributionToken() { + + attributionToken_ = getDefaultInstance().getAttributionToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A unique attribution token. This should be included in the
+     * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+     * recommendation, which enables accurate attribution of recommendation model
+     * performance.
+     * 
+ * + * string attribution_token = 2; + * + * @param value The bytes for attributionToken to set. + * @return This builder for chaining. + */ + public Builder setAttributionTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + attributionToken_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList missingIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureMissingIdsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + missingIds_ = new com.google.protobuf.LazyStringArrayList(missingIds_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @return A list containing the missingIds. + */ + public com.google.protobuf.ProtocolStringList getMissingIdsList() { + return missingIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @return The count of missingIds. + */ + public int getMissingIdsCount() { + return missingIds_.size(); + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @param index The index of the element to return. + * @return The missingIds at the given index. + */ + public java.lang.String getMissingIds(int index) { + return missingIds_.get(index); + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @param index The index of the value to return. + * @return The bytes of the missingIds at the given index. + */ + public com.google.protobuf.ByteString getMissingIdsBytes(int index) { + return missingIds_.getByteString(index); + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @param index The index to set the value at. + * @param value The missingIds to set. + * @return This builder for chaining. + */ + public Builder setMissingIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMissingIdsIsMutable(); + missingIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @param value The missingIds to add. + * @return This builder for chaining. + */ + public Builder addMissingIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMissingIdsIsMutable(); + missingIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @param values The missingIds to add. + * @return This builder for chaining. + */ + public Builder addAllMissingIds(java.lang.Iterable values) { + ensureMissingIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, missingIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @return This builder for chaining. + */ + public Builder clearMissingIds() { + missingIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * IDs of products in the request that were missing from the inventory.
+     * 
+ * + * repeated string missing_ids = 3; + * + * @param value The bytes of the missingIds to add. + * @return This builder for chaining. + */ + public Builder addMissingIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureMissingIdsIsMutable(); + missingIds_.add(value); + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * True if the validateOnly property was set in the request.
+     * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * True if the validateOnly property was set in the request.
+     * 
+ * + * bool validate_only = 4; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * True if the validateOnly property was set in the request.
+     * 
+ * + * bool validate_only = 4; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PredictResponse) + private static final com.google.cloud.retail.v2.PredictResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PredictResponse(); + } + + public static com.google.cloud.retail.v2.PredictResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PredictResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PredictResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictResponseOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictResponseOrBuilder.java new file mode 100644 index 00000000..0a086b7a --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictResponseOrBuilder.java @@ -0,0 +1,178 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/prediction_service.proto + +package com.google.cloud.retail.v2; + +public interface PredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PredictResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + com.google.cloud.retail.v2.PredictResponse.PredictionResult getResults(int index); + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + int getResultsCount(); + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * A list of recommended products. The order represents the ranking (from the
+   * most relevant product to the least).
+   * 
+ * + * repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1; + */ + com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder getResultsOrBuilder( + int index); + + /** + * + * + *
+   * A unique attribution token. This should be included in the
+   * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+   * recommendation, which enables accurate attribution of recommendation model
+   * performance.
+   * 
+ * + * string attribution_token = 2; + * + * @return The attributionToken. + */ + java.lang.String getAttributionToken(); + /** + * + * + *
+   * A unique attribution token. This should be included in the
+   * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
+   * recommendation, which enables accurate attribution of recommendation model
+   * performance.
+   * 
+ * + * string attribution_token = 2; + * + * @return The bytes for attributionToken. + */ + com.google.protobuf.ByteString getAttributionTokenBytes(); + + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @return A list containing the missingIds. + */ + java.util.List getMissingIdsList(); + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @return The count of missingIds. + */ + int getMissingIdsCount(); + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @param index The index of the element to return. + * @return The missingIds at the given index. + */ + java.lang.String getMissingIds(int index); + /** + * + * + *
+   * IDs of products in the request that were missing from the inventory.
+   * 
+ * + * repeated string missing_ids = 3; + * + * @param index The index of the value to return. + * @return The bytes of the missingIds at the given index. + */ + com.google.protobuf.ByteString getMissingIdsBytes(int index); + + /** + * + * + *
+   * True if the validateOnly property was set in the request.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictionServiceProto.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictionServiceProto.java new file mode 100644 index 00000000..dbd1beae --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PredictionServiceProto.java @@ -0,0 +1,185 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/prediction_service.proto + +package com.google.cloud.retail.v2; + +public final class PredictionServiceProto { + private PredictionServiceProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PredictRequest_ParamsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PredictRequest_ParamsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PredictRequest_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PredictRequest_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PredictResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_MetadataEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_MetadataEntry_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n/google/cloud/retail/v2/prediction_serv" + + "ice.proto\022\026google.cloud.retail.v2\032\034googl" + + "e/api/annotations.proto\032\027google/api/clie" + + "nt.proto\032\037google/api/field_behavior.prot" + + "o\032\'google/cloud/retail/v2/user_event.pro" + + "to\032\034google/protobuf/struct.proto\"\260\003\n\016Pre" + + "dictRequest\022\026\n\tplacement\030\001 \001(\tB\003\340A\002\022:\n\nu" + + "ser_event\030\002 \001(\0132!.google.cloud.retail.v2" + + ".UserEventB\003\340A\002\022\021\n\tpage_size\030\003 \001(\005\022\022\n\npa" + + "ge_token\030\004 \001(\t\022\016\n\006filter\030\005 \001(\t\022\025\n\rvalida" + + "te_only\030\006 \001(\010\022B\n\006params\030\007 \003(\01322.google.c" + + "loud.retail.v2.PredictRequest.ParamsEntr" + + "y\022B\n\006labels\030\010 \003(\01322.google.cloud.retail." + + "v2.PredictRequest.LabelsEntry\032E\n\013ParamsE" + + "ntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.googl" + + "e.protobuf.Value:\0028\001\032-\n\013LabelsEntry\022\013\n\003k" + + "ey\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\347\002\n\017PredictR" + + "esponse\022I\n\007results\030\001 \003(\01328.google.cloud." + + "retail.v2.PredictResponse.PredictionResu" + + "lt\022\031\n\021attribution_token\030\002 \001(\t\022\023\n\013missing" + + "_ids\030\003 \003(\t\022\025\n\rvalidate_only\030\004 \001(\010\032\301\001\n\020Pr" + + "edictionResult\022\n\n\002id\030\001 \001(\t\022X\n\010metadata\030\002" + + " \003(\0132F.google.cloud.retail.v2.PredictRes" + + "ponse.PredictionResult.MetadataEntry\032G\n\r" + + "MetadataEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(" + + "\0132\026.google.protobuf.Value:\0028\0012\216\002\n\021Predic" + + "tionService\022\255\001\n\007Predict\022&.google.cloud.r" + + "etail.v2.PredictRequest\032\'.google.cloud.r" + + "etail.v2.PredictResponse\"Q\202\323\344\223\002K\"F/v2/{p" + + "lacement=projects/*/locations/*/catalogs" + + "/*/placements/*}:predict:\001*\032I\312A\025retail.g" + + "oogleapis.com\322A.https://www.googleapis.c" + + "om/auth/cloud-platformB\313\001\n\032com.google.cl" + + "oud.retail.v2B\026PredictionServiceProtoP\001Z" + + " + * The price information of a [Product][google.cloud.retail.v2.Product]. + * + * + * Protobuf type {@code google.cloud.retail.v2.PriceInfo} + */ +public final class PriceInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PriceInfo) + PriceInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use PriceInfo.newBuilder() to construct. + private PriceInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PriceInfo() { + currencyCode_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PriceInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PriceInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + currencyCode_ = s; + break; + } + case 21: + { + price_ = input.readFloat(); + break; + } + case 29: + { + originalPrice_ = input.readFloat(); + break; + } + case 37: + { + cost_ = input.readFloat(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_PriceInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_PriceInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PriceInfo.class, + com.google.cloud.retail.v2.PriceInfo.Builder.class); + } + + public static final int CURRENCY_CODE_FIELD_NUMBER = 1; + private volatile java.lang.Object currencyCode_; + /** + * + * + *
+   * The 3-letter currency code defined in [ISO
+   * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+   * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+   * error is returned.
+   * 
+ * + * string currency_code = 1; + * + * @return The currencyCode. + */ + @java.lang.Override + public java.lang.String getCurrencyCode() { + java.lang.Object ref = currencyCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + currencyCode_ = s; + return s; + } + } + /** + * + * + *
+   * The 3-letter currency code defined in [ISO
+   * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+   * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+   * error is returned.
+   * 
+ * + * string currency_code = 1; + * + * @return The bytes for currencyCode. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCurrencyCodeBytes() { + java.lang.Object ref = currencyCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + currencyCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PRICE_FIELD_NUMBER = 2; + private float price_; + /** + * + * + *
+   * Price of the product.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371). Schema.org
+   * property [Offer.priceSpecification](https://schema.org/priceSpecification).
+   * 
+ * + * float price = 2; + * + * @return The price. + */ + @java.lang.Override + public float getPrice() { + return price_; + } + + public static final int ORIGINAL_PRICE_FIELD_NUMBER = 3; + private float originalPrice_; + /** + * + * + *
+   * Price of the product without any discount. If zero, by default set to be
+   * the [price][google.cloud.retail.v2.PriceInfo.price].
+   * 
+ * + * float original_price = 3; + * + * @return The originalPrice. + */ + @java.lang.Override + public float getOriginalPrice() { + return originalPrice_; + } + + public static final int COST_FIELD_NUMBER = 4; + private float cost_; + /** + * + * + *
+   * The costs associated with the sale of a particular product. Used for gross
+   * profit reporting.
+   * * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
+   * [cost][google.cloud.retail.v2.PriceInfo.cost]
+   * Google Merchant Center property
+   * [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
+   * 
+ * + * float cost = 4; + * + * @return The cost. + */ + @java.lang.Override + public float getCost() { + return cost_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getCurrencyCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, currencyCode_); + } + if (price_ != 0F) { + output.writeFloat(2, price_); + } + if (originalPrice_ != 0F) { + output.writeFloat(3, originalPrice_); + } + if (cost_ != 0F) { + output.writeFloat(4, cost_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getCurrencyCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, currencyCode_); + } + if (price_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, price_); + } + if (originalPrice_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(3, originalPrice_); + } + if (cost_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, cost_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PriceInfo)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PriceInfo other = (com.google.cloud.retail.v2.PriceInfo) obj; + + if (!getCurrencyCode().equals(other.getCurrencyCode())) return false; + if (java.lang.Float.floatToIntBits(getPrice()) + != java.lang.Float.floatToIntBits(other.getPrice())) return false; + if (java.lang.Float.floatToIntBits(getOriginalPrice()) + != java.lang.Float.floatToIntBits(other.getOriginalPrice())) return false; + if (java.lang.Float.floatToIntBits(getCost()) + != java.lang.Float.floatToIntBits(other.getCost())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + CURRENCY_CODE_FIELD_NUMBER; + hash = (53 * hash) + getCurrencyCode().hashCode(); + hash = (37 * hash) + PRICE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getPrice()); + hash = (37 * hash) + ORIGINAL_PRICE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getOriginalPrice()); + hash = (37 * hash) + COST_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getCost()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PriceInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PriceInfo parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PriceInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.PriceInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The price information of a [Product][google.cloud.retail.v2.Product].
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PriceInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PriceInfo) + com.google.cloud.retail.v2.PriceInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_PriceInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_PriceInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PriceInfo.class, + com.google.cloud.retail.v2.PriceInfo.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PriceInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + currencyCode_ = ""; + + price_ = 0F; + + originalPrice_ = 0F; + + cost_ = 0F; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_PriceInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PriceInfo getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PriceInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PriceInfo build() { + com.google.cloud.retail.v2.PriceInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PriceInfo buildPartial() { + com.google.cloud.retail.v2.PriceInfo result = new com.google.cloud.retail.v2.PriceInfo(this); + result.currencyCode_ = currencyCode_; + result.price_ = price_; + result.originalPrice_ = originalPrice_; + result.cost_ = cost_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PriceInfo) { + return mergeFrom((com.google.cloud.retail.v2.PriceInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PriceInfo other) { + if (other == com.google.cloud.retail.v2.PriceInfo.getDefaultInstance()) return this; + if (!other.getCurrencyCode().isEmpty()) { + currencyCode_ = other.currencyCode_; + onChanged(); + } + if (other.getPrice() != 0F) { + setPrice(other.getPrice()); + } + if (other.getOriginalPrice() != 0F) { + setOriginalPrice(other.getOriginalPrice()); + } + if (other.getCost() != 0F) { + setCost(other.getCost()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PriceInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.PriceInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object currencyCode_ = ""; + /** + * + * + *
+     * The 3-letter currency code defined in [ISO
+     * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+     * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+     * error is returned.
+     * 
+ * + * string currency_code = 1; + * + * @return The currencyCode. + */ + public java.lang.String getCurrencyCode() { + java.lang.Object ref = currencyCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + currencyCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The 3-letter currency code defined in [ISO
+     * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+     * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+     * error is returned.
+     * 
+ * + * string currency_code = 1; + * + * @return The bytes for currencyCode. + */ + public com.google.protobuf.ByteString getCurrencyCodeBytes() { + java.lang.Object ref = currencyCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + currencyCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The 3-letter currency code defined in [ISO
+     * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+     * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+     * error is returned.
+     * 
+ * + * string currency_code = 1; + * + * @param value The currencyCode to set. + * @return This builder for chaining. + */ + public Builder setCurrencyCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + currencyCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The 3-letter currency code defined in [ISO
+     * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+     * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+     * error is returned.
+     * 
+ * + * string currency_code = 1; + * + * @return This builder for chaining. + */ + public Builder clearCurrencyCode() { + + currencyCode_ = getDefaultInstance().getCurrencyCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * The 3-letter currency code defined in [ISO
+     * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+     * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+     * error is returned.
+     * 
+ * + * string currency_code = 1; + * + * @param value The bytes for currencyCode to set. + * @return This builder for chaining. + */ + public Builder setCurrencyCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + currencyCode_ = value; + onChanged(); + return this; + } + + private float price_; + /** + * + * + *
+     * Price of the product.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371). Schema.org
+     * property [Offer.priceSpecification](https://schema.org/priceSpecification).
+     * 
+ * + * float price = 2; + * + * @return The price. + */ + @java.lang.Override + public float getPrice() { + return price_; + } + /** + * + * + *
+     * Price of the product.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371). Schema.org
+     * property [Offer.priceSpecification](https://schema.org/priceSpecification).
+     * 
+ * + * float price = 2; + * + * @param value The price to set. + * @return This builder for chaining. + */ + public Builder setPrice(float value) { + + price_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Price of the product.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371). Schema.org
+     * property [Offer.priceSpecification](https://schema.org/priceSpecification).
+     * 
+ * + * float price = 2; + * + * @return This builder for chaining. + */ + public Builder clearPrice() { + + price_ = 0F; + onChanged(); + return this; + } + + private float originalPrice_; + /** + * + * + *
+     * Price of the product without any discount. If zero, by default set to be
+     * the [price][google.cloud.retail.v2.PriceInfo.price].
+     * 
+ * + * float original_price = 3; + * + * @return The originalPrice. + */ + @java.lang.Override + public float getOriginalPrice() { + return originalPrice_; + } + /** + * + * + *
+     * Price of the product without any discount. If zero, by default set to be
+     * the [price][google.cloud.retail.v2.PriceInfo.price].
+     * 
+ * + * float original_price = 3; + * + * @param value The originalPrice to set. + * @return This builder for chaining. + */ + public Builder setOriginalPrice(float value) { + + originalPrice_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Price of the product without any discount. If zero, by default set to be
+     * the [price][google.cloud.retail.v2.PriceInfo.price].
+     * 
+ * + * float original_price = 3; + * + * @return This builder for chaining. + */ + public Builder clearOriginalPrice() { + + originalPrice_ = 0F; + onChanged(); + return this; + } + + private float cost_; + /** + * + * + *
+     * The costs associated with the sale of a particular product. Used for gross
+     * profit reporting.
+     * * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
+     * [cost][google.cloud.retail.v2.PriceInfo.cost]
+     * Google Merchant Center property
+     * [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
+     * 
+ * + * float cost = 4; + * + * @return The cost. + */ + @java.lang.Override + public float getCost() { + return cost_; + } + /** + * + * + *
+     * The costs associated with the sale of a particular product. Used for gross
+     * profit reporting.
+     * * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
+     * [cost][google.cloud.retail.v2.PriceInfo.cost]
+     * Google Merchant Center property
+     * [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
+     * 
+ * + * float cost = 4; + * + * @param value The cost to set. + * @return This builder for chaining. + */ + public Builder setCost(float value) { + + cost_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The costs associated with the sale of a particular product. Used for gross
+     * profit reporting.
+     * * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
+     * [cost][google.cloud.retail.v2.PriceInfo.cost]
+     * Google Merchant Center property
+     * [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
+     * 
+ * + * float cost = 4; + * + * @return This builder for chaining. + */ + public Builder clearCost() { + + cost_ = 0F; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PriceInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PriceInfo) + private static final com.google.cloud.retail.v2.PriceInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PriceInfo(); + } + + public static com.google.cloud.retail.v2.PriceInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PriceInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PriceInfo(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PriceInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PriceInfoOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PriceInfoOrBuilder.java new file mode 100644 index 00000000..d8b05141 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PriceInfoOrBuilder.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +public interface PriceInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PriceInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The 3-letter currency code defined in [ISO
+   * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+   * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+   * error is returned.
+   * 
+ * + * string currency_code = 1; + * + * @return The currencyCode. + */ + java.lang.String getCurrencyCode(); + /** + * + * + *
+   * The 3-letter currency code defined in [ISO
+   * 4217](https://www.iso.org/iso-4217-currency-codes.html).
+   * If this field is an unrecognizable currency code, an INVALID_ARGUMENT
+   * error is returned.
+   * 
+ * + * string currency_code = 1; + * + * @return The bytes for currencyCode. + */ + com.google.protobuf.ByteString getCurrencyCodeBytes(); + + /** + * + * + *
+   * Price of the product.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371). Schema.org
+   * property [Offer.priceSpecification](https://schema.org/priceSpecification).
+   * 
+ * + * float price = 2; + * + * @return The price. + */ + float getPrice(); + + /** + * + * + *
+   * Price of the product without any discount. If zero, by default set to be
+   * the [price][google.cloud.retail.v2.PriceInfo.price].
+   * 
+ * + * float original_price = 3; + * + * @return The originalPrice. + */ + float getOriginalPrice(); + + /** + * + * + *
+   * The costs associated with the sale of a particular product. Used for gross
+   * profit reporting.
+   * * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
+   * [cost][google.cloud.retail.v2.PriceInfo.cost]
+   * Google Merchant Center property
+   * [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
+   * 
+ * + * float cost = 4; + * + * @return The cost. + */ + float getCost(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Product.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Product.java new file mode 100644 index 00000000..4c5175c9 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Product.java @@ -0,0 +1,5543 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Product captures all metadata information of items to be recommended or
+ * searched.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Product} + */ +public final class Product extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Product) + ProductOrBuilder { + private static final long serialVersionUID = 0L; + // Use Product.newBuilder() to construct. + private Product(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Product() { + name_ = ""; + id_ = ""; + type_ = 0; + primaryProductId_ = ""; + categories_ = com.google.protobuf.LazyStringArrayList.EMPTY; + title_ = ""; + description_ = ""; + tags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + availability_ = 0; + uri_ = ""; + images_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Product(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Product( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + id_ = s; + break; + } + case 24: + { + int rawValue = input.readEnum(); + + type_ = rawValue; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + primaryProductId_ = s; + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + categories_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + categories_.add(s); + break; + } + case 66: + { + java.lang.String s = input.readStringRequireUtf8(); + + title_ = s; + break; + } + case 82: + { + java.lang.String s = input.readStringRequireUtf8(); + + description_ = s; + break; + } + case 98: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + attributes_ = + com.google.protobuf.MapField.newMapField( + AttributesDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + attributes__ = + input.readMessage( + AttributesDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + attributes_.getMutableMap().put(attributes__.getKey(), attributes__.getValue()); + break; + } + case 106: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + tags_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + tags_.add(s); + break; + } + case 114: + { + com.google.cloud.retail.v2.PriceInfo.Builder subBuilder = null; + if (priceInfo_ != null) { + subBuilder = priceInfo_.toBuilder(); + } + priceInfo_ = + input.readMessage( + com.google.cloud.retail.v2.PriceInfo.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(priceInfo_); + priceInfo_ = subBuilder.buildPartial(); + } + + break; + } + case 146: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (availableTime_ != null) { + subBuilder = availableTime_.toBuilder(); + } + availableTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(availableTime_); + availableTime_ = subBuilder.buildPartial(); + } + + break; + } + case 152: + { + int rawValue = input.readEnum(); + + availability_ = rawValue; + break; + } + case 162: + { + com.google.protobuf.Int32Value.Builder subBuilder = null; + if (availableQuantity_ != null) { + subBuilder = availableQuantity_.toBuilder(); + } + availableQuantity_ = + input.readMessage(com.google.protobuf.Int32Value.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(availableQuantity_); + availableQuantity_ = subBuilder.buildPartial(); + } + + break; + } + case 178: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + case 186: + { + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + images_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + images_.add( + input.readMessage(com.google.cloud.retail.v2.Image.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + categories_ = categories_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + tags_ = tags_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + images_ = java.util.Collections.unmodifiableList(images_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductProto + .internal_static_google_cloud_retail_v2_Product_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductProto + .internal_static_google_cloud_retail_v2_Product_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Product.class, + com.google.cloud.retail.v2.Product.Builder.class); + } + + /** + * + * + *
+   * The type of this product.
+   * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.Product.Type} + */ + public enum Type implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value. Default to
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if unset.
+     * 
+ * + * TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * The primary type.
+     * As the primary unit for predicting, indexing and search serving, a
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] is grouped with multiple
+     * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s.
+     * 
+ * + * PRIMARY = 1; + */ + PRIMARY(1), + /** + * + * + *
+     * The variant type.
+     * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s usually share some common
+     * attributes on the same
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s, but they have variant
+     * attributes like different colors, sizes and prices, etc.
+     * 
+ * + * VARIANT = 2; + */ + VARIANT(2), + /** + * + * + *
+     * The collection type. Collection products are bundled
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s or
+     * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s that are sold together, such
+     * as a jewelry set with necklaces, earrings and rings, etc.
+     * 
+ * + * COLLECTION = 3; + */ + COLLECTION(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value. Default to
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if unset.
+     * 
+ * + * TYPE_UNSPECIFIED = 0; + */ + public static final int TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The primary type.
+     * As the primary unit for predicting, indexing and search serving, a
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] is grouped with multiple
+     * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s.
+     * 
+ * + * PRIMARY = 1; + */ + public static final int PRIMARY_VALUE = 1; + /** + * + * + *
+     * The variant type.
+     * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s usually share some common
+     * attributes on the same
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s, but they have variant
+     * attributes like different colors, sizes and prices, etc.
+     * 
+ * + * VARIANT = 2; + */ + public static final int VARIANT_VALUE = 2; + /** + * + * + *
+     * The collection type. Collection products are bundled
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s or
+     * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s that are sold together, such
+     * as a jewelry set with necklaces, earrings and rings, etc.
+     * 
+ * + * COLLECTION = 3; + */ + public static final int COLLECTION_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Type valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Type forNumber(int value) { + switch (value) { + case 0: + return TYPE_UNSPECIFIED; + case 1: + return PRIMARY; + case 2: + return VARIANT; + case 3: + return COLLECTION; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Type findValueByNumber(int number) { + return Type.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.Product.getDescriptor().getEnumTypes().get(0); + } + + private static final Type[] VALUES = values(); + + public static Type valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Type(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.Product.Type) + } + + /** + * + * + *
+   * Product availability. If this field is unspecified, the product is
+   * assumed to be in stock.
+   * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.Product.Availability} + */ + public enum Availability implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default product availability. Default to
+     * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
+     * if unset.
+     * 
+ * + * AVAILABILITY_UNSPECIFIED = 0; + */ + AVAILABILITY_UNSPECIFIED(0), + /** + * + * + *
+     * Product in stock.
+     * 
+ * + * IN_STOCK = 1; + */ + IN_STOCK(1), + /** + * + * + *
+     * Product out of stock.
+     * 
+ * + * OUT_OF_STOCK = 2; + */ + OUT_OF_STOCK(2), + /** + * + * + *
+     * Product that is in pre-order state.
+     * 
+ * + * PREORDER = 3; + */ + PREORDER(3), + /** + * + * + *
+     * Product that is back-ordered (i.e. temporarily out of stock).
+     * 
+ * + * BACKORDER = 4; + */ + BACKORDER(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default product availability. Default to
+     * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
+     * if unset.
+     * 
+ * + * AVAILABILITY_UNSPECIFIED = 0; + */ + public static final int AVAILABILITY_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Product in stock.
+     * 
+ * + * IN_STOCK = 1; + */ + public static final int IN_STOCK_VALUE = 1; + /** + * + * + *
+     * Product out of stock.
+     * 
+ * + * OUT_OF_STOCK = 2; + */ + public static final int OUT_OF_STOCK_VALUE = 2; + /** + * + * + *
+     * Product that is in pre-order state.
+     * 
+ * + * PREORDER = 3; + */ + public static final int PREORDER_VALUE = 3; + /** + * + * + *
+     * Product that is back-ordered (i.e. temporarily out of stock).
+     * 
+ * + * BACKORDER = 4; + */ + public static final int BACKORDER_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Availability valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Availability forNumber(int value) { + switch (value) { + case 0: + return AVAILABILITY_UNSPECIFIED; + case 1: + return IN_STOCK; + case 2: + return OUT_OF_STOCK; + case 3: + return PREORDER; + case 4: + return BACKORDER; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Availability findValueByNumber(int number) { + return Availability.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.Product.getDescriptor().getEnumTypes().get(1); + } + + private static final Availability[] VALUES = values(); + + public static Availability valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Availability(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.Product.Availability) + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Immutable. Full resource name of the product, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+   * The branch ID must be "default_branch".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. Full resource name of the product, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+   * The branch ID must be "default_branch".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ID_FIELD_NUMBER = 2; + private volatile java.lang.Object id_; + /** + * + * + *
+   * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+   * the final component of [name][google.cloud.retail.v2.Product.name]. For
+   * example, this field is "id_1", if
+   * [name][google.cloud.retail.v2.Product.name] is
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+   * Property [Product.sku](https://schema.org/sku).
+   * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+   * the final component of [name][google.cloud.retail.v2.Product.name]. For
+   * example, this field is "id_1", if
+   * [name][google.cloud.retail.v2.Product.name] is
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+   * Property [Product.sku](https://schema.org/sku).
+   * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TYPE_FIELD_NUMBER = 3; + private int type_; + /** + * + * + *
+   * Immutable. The type of the product. This field is output-only.
+   * 
+ * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The enum numeric value on the wire for type. + */ + @java.lang.Override + public int getTypeValue() { + return type_; + } + /** + * + * + *
+   * Immutable. The type of the product. This field is output-only.
+   * 
+ * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The type. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product.Type getType() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.Product.Type result = + com.google.cloud.retail.v2.Product.Type.valueOf(type_); + return result == null ? com.google.cloud.retail.v2.Product.Type.UNRECOGNIZED : result; + } + + public static final int PRIMARY_PRODUCT_ID_FIELD_NUMBER = 4; + private volatile java.lang.Object primaryProductId_; + /** + * + * + *
+   * Variant group identifier. Must be an
+   * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+   * this product. Otherwise, an error is thrown.
+   * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+   * set to the same value as [id][google.cloud.retail.v2.Product.id].
+   * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+   * be empty. A maximum of 2,000 products are allowed to share the same
+   * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * Google Merchant Center Property
+   * [item_group_id](https://support.google.com/merchants/answer/6324507).
+   * Schema.org Property
+   * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+   * This field must be enabled before it can be used. [Learn
+   * more](/recommendations-ai/docs/catalog#item-group-id).
+   * 
+ * + * string primary_product_id = 4; + * + * @return The primaryProductId. + */ + @java.lang.Override + public java.lang.String getPrimaryProductId() { + java.lang.Object ref = primaryProductId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + primaryProductId_ = s; + return s; + } + } + /** + * + * + *
+   * Variant group identifier. Must be an
+   * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+   * this product. Otherwise, an error is thrown.
+   * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+   * set to the same value as [id][google.cloud.retail.v2.Product.id].
+   * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+   * be empty. A maximum of 2,000 products are allowed to share the same
+   * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * Google Merchant Center Property
+   * [item_group_id](https://support.google.com/merchants/answer/6324507).
+   * Schema.org Property
+   * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+   * This field must be enabled before it can be used. [Learn
+   * more](/recommendations-ai/docs/catalog#item-group-id).
+   * 
+ * + * string primary_product_id = 4; + * + * @return The bytes for primaryProductId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPrimaryProductIdBytes() { + java.lang.Object ref = primaryProductId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + primaryProductId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CATEGORIES_FIELD_NUMBER = 7; + private com.google.protobuf.LazyStringList categories_; + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @return A list containing the categories. + */ + public com.google.protobuf.ProtocolStringList getCategoriesList() { + return categories_; + } + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @return The count of categories. + */ + public int getCategoriesCount() { + return categories_.size(); + } + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @param index The index of the element to return. + * @return The categories at the given index. + */ + public java.lang.String getCategories(int index) { + return categories_.get(index); + } + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @param index The index of the value to return. + * @return The bytes of the categories at the given index. + */ + public com.google.protobuf.ByteString getCategoriesBytes(int index) { + return categories_.getByteString(index); + } + + public static final int TITLE_FIELD_NUMBER = 8; + private volatile java.lang.Object title_; + /** + * + * + *
+   * Required. Product title.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+   * property [Product.name](https://schema.org/name).
+   * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The title. + */ + @java.lang.Override + public java.lang.String getTitle() { + java.lang.Object ref = title_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + title_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Product title.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+   * property [Product.name](https://schema.org/name).
+   * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for title. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTitleBytes() { + java.lang.Object ref = title_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + title_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 10; + private volatile java.lang.Object description_; + /** + * + * + *
+   * Product description.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [description](https://support.google.com/merchants/answer/6324468).
+   * schema.org property [Product.description](https://schema.org/description).
+   * 
+ * + * string description = 10; + * + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + * + * + *
+   * Product description.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [description](https://support.google.com/merchants/answer/6324468).
+   * schema.org property [Product.description](https://schema.org/description).
+   * 
+ * + * string description = 10; + * + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ATTRIBUTES_FIELD_NUMBER = 12; + + private static final class AttributesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.retail.v2.ProductProto + .internal_static_google_cloud_retail_v2_Product_AttributesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.retail.v2.CustomAttribute.getDefaultInstance()); + } + + private com.google.protobuf.MapField + attributes_; + + private com.google.protobuf.MapField + internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField(AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); + } + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public boolean containsAttributes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetAttributes().getMap().containsKey(key); + } + /** Use {@link #getAttributesMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getAttributes() { + return getAttributesMap(); + } + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public java.util.Map + getAttributesMap() { + return internalGetAttributes().getMap(); + } + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int TAGS_FIELD_NUMBER = 13; + private com.google.protobuf.LazyStringList tags_; + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @return A list containing the tags. + */ + public com.google.protobuf.ProtocolStringList getTagsList() { + return tags_; + } + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @return The count of tags. + */ + public int getTagsCount() { + return tags_.size(); + } + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @param index The index of the element to return. + * @return The tags at the given index. + */ + public java.lang.String getTags(int index) { + return tags_.get(index); + } + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + public com.google.protobuf.ByteString getTagsBytes(int index) { + return tags_.getByteString(index); + } + + public static final int PRICE_INFO_FIELD_NUMBER = 14; + private com.google.cloud.retail.v2.PriceInfo priceInfo_; + /** + * + * + *
+   * Product price and cost information.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371).
+   * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + * + * @return Whether the priceInfo field is set. + */ + @java.lang.Override + public boolean hasPriceInfo() { + return priceInfo_ != null; + } + /** + * + * + *
+   * Product price and cost information.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371).
+   * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + * + * @return The priceInfo. + */ + @java.lang.Override + public com.google.cloud.retail.v2.PriceInfo getPriceInfo() { + return priceInfo_ == null + ? com.google.cloud.retail.v2.PriceInfo.getDefaultInstance() + : priceInfo_; + } + /** + * + * + *
+   * Product price and cost information.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371).
+   * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + @java.lang.Override + public com.google.cloud.retail.v2.PriceInfoOrBuilder getPriceInfoOrBuilder() { + return getPriceInfo(); + } + + public static final int AVAILABLE_TIME_FIELD_NUMBER = 18; + private com.google.protobuf.Timestamp availableTime_; + /** + * + * + *
+   * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+   * available recommendation and search.
+   * 
+ * + * .google.protobuf.Timestamp available_time = 18; + * + * @return Whether the availableTime field is set. + */ + @java.lang.Override + public boolean hasAvailableTime() { + return availableTime_ != null; + } + /** + * + * + *
+   * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+   * available recommendation and search.
+   * 
+ * + * .google.protobuf.Timestamp available_time = 18; + * + * @return The availableTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getAvailableTime() { + return availableTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : availableTime_; + } + /** + * + * + *
+   * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+   * available recommendation and search.
+   * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getAvailableTimeOrBuilder() { + return getAvailableTime(); + } + + public static final int AVAILABILITY_FIELD_NUMBER = 19; + private int availability_; + /** + * + * + *
+   * The online availability of the [Product][google.cloud.retail.v2.Product].
+   * Default to
+   * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+   * Google Merchant Center Property
+   * [availability](https://support.google.com/merchants/answer/6324448).
+   * Schema.org Property [Offer.availability](https://schema.org/availability).
+   * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @return The enum numeric value on the wire for availability. + */ + @java.lang.Override + public int getAvailabilityValue() { + return availability_; + } + /** + * + * + *
+   * The online availability of the [Product][google.cloud.retail.v2.Product].
+   * Default to
+   * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+   * Google Merchant Center Property
+   * [availability](https://support.google.com/merchants/answer/6324448).
+   * Schema.org Property [Offer.availability](https://schema.org/availability).
+   * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @return The availability. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product.Availability getAvailability() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.Product.Availability result = + com.google.cloud.retail.v2.Product.Availability.valueOf(availability_); + return result == null ? com.google.cloud.retail.v2.Product.Availability.UNRECOGNIZED : result; + } + + public static final int AVAILABLE_QUANTITY_FIELD_NUMBER = 20; + private com.google.protobuf.Int32Value availableQuantity_; + /** + * + * + *
+   * The available quantity of the item.
+   * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + * + * @return Whether the availableQuantity field is set. + */ + @java.lang.Override + public boolean hasAvailableQuantity() { + return availableQuantity_ != null; + } + /** + * + * + *
+   * The available quantity of the item.
+   * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + * + * @return The availableQuantity. + */ + @java.lang.Override + public com.google.protobuf.Int32Value getAvailableQuantity() { + return availableQuantity_ == null + ? com.google.protobuf.Int32Value.getDefaultInstance() + : availableQuantity_; + } + /** + * + * + *
+   * The available quantity of the item.
+   * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + @java.lang.Override + public com.google.protobuf.Int32ValueOrBuilder getAvailableQuantityOrBuilder() { + return getAvailableQuantity(); + } + + public static final int URI_FIELD_NUMBER = 22; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * Canonical URL directly linking to the product detail page.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+   * property [Offer.url](https://schema.org/url).
+   * 
+ * + * string uri = 22; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * Canonical URL directly linking to the product detail page.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+   * property [Offer.url](https://schema.org/url).
+   * 
+ * + * string uri = 22; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int IMAGES_FIELD_NUMBER = 23; + private java.util.List images_; + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + @java.lang.Override + public java.util.List getImagesList() { + return images_; + } + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + @java.lang.Override + public java.util.List + getImagesOrBuilderList() { + return images_; + } + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + @java.lang.Override + public int getImagesCount() { + return images_.size(); + } + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Image getImages(int index) { + return images_.get(index); + } + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ImageOrBuilder getImagesOrBuilder(int index) { + return images_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, id_); + } + if (type_ != com.google.cloud.retail.v2.Product.Type.TYPE_UNSPECIFIED.getNumber()) { + output.writeEnum(3, type_); + } + if (!getPrimaryProductIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, primaryProductId_); + } + for (int i = 0; i < categories_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, categories_.getRaw(i)); + } + if (!getTitleBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, title_); + } + if (!getDescriptionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, description_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAttributes(), AttributesDefaultEntryHolder.defaultEntry, 12); + for (int i = 0; i < tags_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 13, tags_.getRaw(i)); + } + if (priceInfo_ != null) { + output.writeMessage(14, getPriceInfo()); + } + if (availableTime_ != null) { + output.writeMessage(18, getAvailableTime()); + } + if (availability_ + != com.google.cloud.retail.v2.Product.Availability.AVAILABILITY_UNSPECIFIED.getNumber()) { + output.writeEnum(19, availability_); + } + if (availableQuantity_ != null) { + output.writeMessage(20, getAvailableQuantity()); + } + if (!getUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 22, uri_); + } + for (int i = 0; i < images_.size(); i++) { + output.writeMessage(23, images_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!getIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, id_); + } + if (type_ != com.google.cloud.retail.v2.Product.Type.TYPE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, type_); + } + if (!getPrimaryProductIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, primaryProductId_); + } + { + int dataSize = 0; + for (int i = 0; i < categories_.size(); i++) { + dataSize += computeStringSizeNoTag(categories_.getRaw(i)); + } + size += dataSize; + size += 1 * getCategoriesList().size(); + } + if (!getTitleBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, title_); + } + if (!getDescriptionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, description_); + } + for (java.util.Map.Entry entry : + internalGetAttributes().getMap().entrySet()) { + com.google.protobuf.MapEntry + attributes__ = + AttributesDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, attributes__); + } + { + int dataSize = 0; + for (int i = 0; i < tags_.size(); i++) { + dataSize += computeStringSizeNoTag(tags_.getRaw(i)); + } + size += dataSize; + size += 1 * getTagsList().size(); + } + if (priceInfo_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, getPriceInfo()); + } + if (availableTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(18, getAvailableTime()); + } + if (availability_ + != com.google.cloud.retail.v2.Product.Availability.AVAILABILITY_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(19, availability_); + } + if (availableQuantity_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(20, getAvailableQuantity()); + } + if (!getUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(22, uri_); + } + for (int i = 0; i < images_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(23, images_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Product)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Product other = (com.google.cloud.retail.v2.Product) obj; + + if (!getName().equals(other.getName())) return false; + if (!getId().equals(other.getId())) return false; + if (type_ != other.type_) return false; + if (!getPrimaryProductId().equals(other.getPrimaryProductId())) return false; + if (!getCategoriesList().equals(other.getCategoriesList())) return false; + if (!getTitle().equals(other.getTitle())) return false; + if (!getDescription().equals(other.getDescription())) return false; + if (!internalGetAttributes().equals(other.internalGetAttributes())) return false; + if (!getTagsList().equals(other.getTagsList())) return false; + if (hasPriceInfo() != other.hasPriceInfo()) return false; + if (hasPriceInfo()) { + if (!getPriceInfo().equals(other.getPriceInfo())) return false; + } + if (hasAvailableTime() != other.hasAvailableTime()) return false; + if (hasAvailableTime()) { + if (!getAvailableTime().equals(other.getAvailableTime())) return false; + } + if (availability_ != other.availability_) return false; + if (hasAvailableQuantity() != other.hasAvailableQuantity()) return false; + if (hasAvailableQuantity()) { + if (!getAvailableQuantity().equals(other.getAvailableQuantity())) return false; + } + if (!getUri().equals(other.getUri())) return false; + if (!getImagesList().equals(other.getImagesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + TYPE_FIELD_NUMBER; + hash = (53 * hash) + type_; + hash = (37 * hash) + PRIMARY_PRODUCT_ID_FIELD_NUMBER; + hash = (53 * hash) + getPrimaryProductId().hashCode(); + if (getCategoriesCount() > 0) { + hash = (37 * hash) + CATEGORIES_FIELD_NUMBER; + hash = (53 * hash) + getCategoriesList().hashCode(); + } + hash = (37 * hash) + TITLE_FIELD_NUMBER; + hash = (53 * hash) + getTitle().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (!internalGetAttributes().getMap().isEmpty()) { + hash = (37 * hash) + ATTRIBUTES_FIELD_NUMBER; + hash = (53 * hash) + internalGetAttributes().hashCode(); + } + if (getTagsCount() > 0) { + hash = (37 * hash) + TAGS_FIELD_NUMBER; + hash = (53 * hash) + getTagsList().hashCode(); + } + if (hasPriceInfo()) { + hash = (37 * hash) + PRICE_INFO_FIELD_NUMBER; + hash = (53 * hash) + getPriceInfo().hashCode(); + } + if (hasAvailableTime()) { + hash = (37 * hash) + AVAILABLE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getAvailableTime().hashCode(); + } + hash = (37 * hash) + AVAILABILITY_FIELD_NUMBER; + hash = (53 * hash) + availability_; + if (hasAvailableQuantity()) { + hash = (37 * hash) + AVAILABLE_QUANTITY_FIELD_NUMBER; + hash = (53 * hash) + getAvailableQuantity().hashCode(); + } + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + if (getImagesCount() > 0) { + hash = (37 * hash) + IMAGES_FIELD_NUMBER; + hash = (53 * hash) + getImagesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Product parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Product parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Product parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Product parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Product parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Product parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Product parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Product parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Product parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Product parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Product parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Product parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Product prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Product captures all metadata information of items to be recommended or
+   * searched.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Product} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Product) + com.google.cloud.retail.v2.ProductOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductProto + .internal_static_google_cloud_retail_v2_Product_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 12: + return internalGetMutableAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductProto + .internal_static_google_cloud_retail_v2_Product_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Product.class, + com.google.cloud.retail.v2.Product.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Product.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getImagesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + id_ = ""; + + type_ = 0; + + primaryProductId_ = ""; + + categories_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + title_ = ""; + + description_ = ""; + + internalGetMutableAttributes().clear(); + tags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + if (priceInfoBuilder_ == null) { + priceInfo_ = null; + } else { + priceInfo_ = null; + priceInfoBuilder_ = null; + } + if (availableTimeBuilder_ == null) { + availableTime_ = null; + } else { + availableTime_ = null; + availableTimeBuilder_ = null; + } + availability_ = 0; + + if (availableQuantityBuilder_ == null) { + availableQuantity_ = null; + } else { + availableQuantity_ = null; + availableQuantityBuilder_ = null; + } + uri_ = ""; + + if (imagesBuilder_ == null) { + images_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + } else { + imagesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ProductProto + .internal_static_google_cloud_retail_v2_Product_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Product getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Product.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Product build() { + com.google.cloud.retail.v2.Product result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Product buildPartial() { + com.google.cloud.retail.v2.Product result = new com.google.cloud.retail.v2.Product(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.id_ = id_; + result.type_ = type_; + result.primaryProductId_ = primaryProductId_; + if (((bitField0_ & 0x00000001) != 0)) { + categories_ = categories_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.categories_ = categories_; + result.title_ = title_; + result.description_ = description_; + result.attributes_ = internalGetAttributes(); + result.attributes_.makeImmutable(); + if (((bitField0_ & 0x00000004) != 0)) { + tags_ = tags_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.tags_ = tags_; + if (priceInfoBuilder_ == null) { + result.priceInfo_ = priceInfo_; + } else { + result.priceInfo_ = priceInfoBuilder_.build(); + } + if (availableTimeBuilder_ == null) { + result.availableTime_ = availableTime_; + } else { + result.availableTime_ = availableTimeBuilder_.build(); + } + result.availability_ = availability_; + if (availableQuantityBuilder_ == null) { + result.availableQuantity_ = availableQuantity_; + } else { + result.availableQuantity_ = availableQuantityBuilder_.build(); + } + result.uri_ = uri_; + if (imagesBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + images_ = java.util.Collections.unmodifiableList(images_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.images_ = images_; + } else { + result.images_ = imagesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Product) { + return mergeFrom((com.google.cloud.retail.v2.Product) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Product other) { + if (other == com.google.cloud.retail.v2.Product.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getId().isEmpty()) { + id_ = other.id_; + onChanged(); + } + if (other.type_ != 0) { + setTypeValue(other.getTypeValue()); + } + if (!other.getPrimaryProductId().isEmpty()) { + primaryProductId_ = other.primaryProductId_; + onChanged(); + } + if (!other.categories_.isEmpty()) { + if (categories_.isEmpty()) { + categories_ = other.categories_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCategoriesIsMutable(); + categories_.addAll(other.categories_); + } + onChanged(); + } + if (!other.getTitle().isEmpty()) { + title_ = other.title_; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + onChanged(); + } + internalGetMutableAttributes().mergeFrom(other.internalGetAttributes()); + if (!other.tags_.isEmpty()) { + if (tags_.isEmpty()) { + tags_ = other.tags_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureTagsIsMutable(); + tags_.addAll(other.tags_); + } + onChanged(); + } + if (other.hasPriceInfo()) { + mergePriceInfo(other.getPriceInfo()); + } + if (other.hasAvailableTime()) { + mergeAvailableTime(other.getAvailableTime()); + } + if (other.availability_ != 0) { + setAvailabilityValue(other.getAvailabilityValue()); + } + if (other.hasAvailableQuantity()) { + mergeAvailableQuantity(other.getAvailableQuantity()); + } + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + if (imagesBuilder_ == null) { + if (!other.images_.isEmpty()) { + if (images_.isEmpty()) { + images_ = other.images_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureImagesIsMutable(); + images_.addAll(other.images_); + } + onChanged(); + } + } else { + if (!other.images_.isEmpty()) { + if (imagesBuilder_.isEmpty()) { + imagesBuilder_.dispose(); + imagesBuilder_ = null; + images_ = other.images_; + bitField0_ = (bitField0_ & ~0x00000008); + imagesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getImagesFieldBuilder() + : null; + } else { + imagesBuilder_.addAllMessages(other.images_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Product parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Product) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Immutable. Full resource name of the product, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+     * The branch ID must be "default_branch".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. Full resource name of the product, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+     * The branch ID must be "default_branch".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. Full resource name of the product, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+     * The branch ID must be "default_branch".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Full resource name of the product, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+     * The branch ID must be "default_branch".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Full resource name of the product, such as
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+     * The branch ID must be "default_branch".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object id_ = ""; + /** + * + * + *
+     * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+     * the final component of [name][google.cloud.retail.v2.Product.name]. For
+     * example, this field is "id_1", if
+     * [name][google.cloud.retail.v2.Product.name] is
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+     * Property [Product.sku](https://schema.org/sku).
+     * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+     * the final component of [name][google.cloud.retail.v2.Product.name]. For
+     * example, this field is "id_1", if
+     * [name][google.cloud.retail.v2.Product.name] is
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+     * Property [Product.sku](https://schema.org/sku).
+     * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for id. + */ + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+     * the final component of [name][google.cloud.retail.v2.Product.name]. For
+     * example, this field is "id_1", if
+     * [name][google.cloud.retail.v2.Product.name] is
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+     * Property [Product.sku](https://schema.org/sku).
+     * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + id_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+     * the final component of [name][google.cloud.retail.v2.Product.name]. For
+     * example, this field is "id_1", if
+     * [name][google.cloud.retail.v2.Product.name] is
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+     * Property [Product.sku](https://schema.org/sku).
+     * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearId() { + + id_ = getDefaultInstance().getId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+     * the final component of [name][google.cloud.retail.v2.Product.name]. For
+     * example, this field is "id_1", if
+     * [name][google.cloud.retail.v2.Product.name] is
+     * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+     * Property [Product.sku](https://schema.org/sku).
+     * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + id_ = value; + onChanged(); + return this; + } + + private int type_ = 0; + /** + * + * + *
+     * Immutable. The type of the product. This field is output-only.
+     * 
+ * + * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The enum numeric value on the wire for type. + */ + @java.lang.Override + public int getTypeValue() { + return type_; + } + /** + * + * + *
+     * Immutable. The type of the product. This field is output-only.
+     * 
+ * + * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The enum numeric value on the wire for type to set. + * @return This builder for chaining. + */ + public Builder setTypeValue(int value) { + + type_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The type of the product. This field is output-only.
+     * 
+ * + * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The type. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product.Type getType() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.Product.Type result = + com.google.cloud.retail.v2.Product.Type.valueOf(type_); + return result == null ? com.google.cloud.retail.v2.Product.Type.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Immutable. The type of the product. This field is output-only.
+     * 
+ * + * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The type to set. + * @return This builder for chaining. + */ + public Builder setType(com.google.cloud.retail.v2.Product.Type value) { + if (value == null) { + throw new NullPointerException(); + } + + type_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The type of the product. This field is output-only.
+     * 
+ * + * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return This builder for chaining. + */ + public Builder clearType() { + + type_ = 0; + onChanged(); + return this; + } + + private java.lang.Object primaryProductId_ = ""; + /** + * + * + *
+     * Variant group identifier. Must be an
+     * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+     * this product. Otherwise, an error is thrown.
+     * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+     * set to the same value as [id][google.cloud.retail.v2.Product.id].
+     * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+     * be empty. A maximum of 2,000 products are allowed to share the same
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * Google Merchant Center Property
+     * [item_group_id](https://support.google.com/merchants/answer/6324507).
+     * Schema.org Property
+     * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+     * This field must be enabled before it can be used. [Learn
+     * more](/recommendations-ai/docs/catalog#item-group-id).
+     * 
+ * + * string primary_product_id = 4; + * + * @return The primaryProductId. + */ + public java.lang.String getPrimaryProductId() { + java.lang.Object ref = primaryProductId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + primaryProductId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Variant group identifier. Must be an
+     * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+     * this product. Otherwise, an error is thrown.
+     * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+     * set to the same value as [id][google.cloud.retail.v2.Product.id].
+     * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+     * be empty. A maximum of 2,000 products are allowed to share the same
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * Google Merchant Center Property
+     * [item_group_id](https://support.google.com/merchants/answer/6324507).
+     * Schema.org Property
+     * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+     * This field must be enabled before it can be used. [Learn
+     * more](/recommendations-ai/docs/catalog#item-group-id).
+     * 
+ * + * string primary_product_id = 4; + * + * @return The bytes for primaryProductId. + */ + public com.google.protobuf.ByteString getPrimaryProductIdBytes() { + java.lang.Object ref = primaryProductId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + primaryProductId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Variant group identifier. Must be an
+     * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+     * this product. Otherwise, an error is thrown.
+     * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+     * set to the same value as [id][google.cloud.retail.v2.Product.id].
+     * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+     * be empty. A maximum of 2,000 products are allowed to share the same
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * Google Merchant Center Property
+     * [item_group_id](https://support.google.com/merchants/answer/6324507).
+     * Schema.org Property
+     * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+     * This field must be enabled before it can be used. [Learn
+     * more](/recommendations-ai/docs/catalog#item-group-id).
+     * 
+ * + * string primary_product_id = 4; + * + * @param value The primaryProductId to set. + * @return This builder for chaining. + */ + public Builder setPrimaryProductId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + primaryProductId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Variant group identifier. Must be an
+     * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+     * this product. Otherwise, an error is thrown.
+     * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+     * set to the same value as [id][google.cloud.retail.v2.Product.id].
+     * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+     * be empty. A maximum of 2,000 products are allowed to share the same
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * Google Merchant Center Property
+     * [item_group_id](https://support.google.com/merchants/answer/6324507).
+     * Schema.org Property
+     * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+     * This field must be enabled before it can be used. [Learn
+     * more](/recommendations-ai/docs/catalog#item-group-id).
+     * 
+ * + * string primary_product_id = 4; + * + * @return This builder for chaining. + */ + public Builder clearPrimaryProductId() { + + primaryProductId_ = getDefaultInstance().getPrimaryProductId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Variant group identifier. Must be an
+     * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+     * this product. Otherwise, an error is thrown.
+     * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+     * set to the same value as [id][google.cloud.retail.v2.Product.id].
+     * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+     * be empty. A maximum of 2,000 products are allowed to share the same
+     * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * Google Merchant Center Property
+     * [item_group_id](https://support.google.com/merchants/answer/6324507).
+     * Schema.org Property
+     * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+     * This field must be enabled before it can be used. [Learn
+     * more](/recommendations-ai/docs/catalog#item-group-id).
+     * 
+ * + * string primary_product_id = 4; + * + * @param value The bytes for primaryProductId to set. + * @return This builder for chaining. + */ + public Builder setPrimaryProductIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + primaryProductId_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList categories_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureCategoriesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + categories_ = new com.google.protobuf.LazyStringArrayList(categories_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @return A list containing the categories. + */ + public com.google.protobuf.ProtocolStringList getCategoriesList() { + return categories_.getUnmodifiableView(); + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @return The count of categories. + */ + public int getCategoriesCount() { + return categories_.size(); + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @param index The index of the element to return. + * @return The categories at the given index. + */ + public java.lang.String getCategories(int index) { + return categories_.get(index); + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @param index The index of the value to return. + * @return The bytes of the categories at the given index. + */ + public com.google.protobuf.ByteString getCategoriesBytes(int index) { + return categories_.getByteString(index); + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @param index The index to set the value at. + * @param value The categories to set. + * @return This builder for chaining. + */ + public Builder setCategories(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @param value The categories to add. + * @return This builder for chaining. + */ + public Builder addCategories(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @param values The categories to add. + * @return This builder for chaining. + */ + public Builder addAllCategories(java.lang.Iterable values) { + ensureCategoriesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, categories_); + onChanged(); + return this; + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @return This builder for chaining. + */ + public Builder clearCategories() { + categories_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Product categories. This field is repeated for supporting one product
+     * belonging to several parallel categories. Strongly recommended using the
+     * full path for better search / recommendation quality.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * For example, if a shoes product belongs to both
+     * ["Shoes & Accessories" -> "Shoes"] and
+     * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+     * represented as:
+     *      "categories": [
+     *        "Shoes & Accessories > Shoes",
+     *        "Sports & Fitness > Athletic Clothing > Shoes"
+     *      ]
+     * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+     * error is returned.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+     * Each value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [google_product_category][mc_google_product_category]. Schema.org property
+     * [Product.category] (https://schema.org/category).
+     * [mc_google_product_category]:
+     * https://support.google.com/merchants/answer/6324436
+     * 
+ * + * repeated string categories = 7; + * + * @param value The bytes of the categories to add. + * @return This builder for chaining. + */ + public Builder addCategoriesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureCategoriesIsMutable(); + categories_.add(value); + onChanged(); + return this; + } + + private java.lang.Object title_ = ""; + /** + * + * + *
+     * Required. Product title.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+     * property [Product.name](https://schema.org/name).
+     * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The title. + */ + public java.lang.String getTitle() { + java.lang.Object ref = title_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + title_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Product title.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+     * property [Product.name](https://schema.org/name).
+     * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for title. + */ + public com.google.protobuf.ByteString getTitleBytes() { + java.lang.Object ref = title_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + title_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Product title.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+     * property [Product.name](https://schema.org/name).
+     * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The title to set. + * @return This builder for chaining. + */ + public Builder setTitle(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + title_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Product title.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+     * property [Product.name](https://schema.org/name).
+     * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearTitle() { + + title_ = getDefaultInstance().getTitle(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Product title.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+     * property [Product.name](https://schema.org/name).
+     * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for title to set. + * @return This builder for chaining. + */ + public Builder setTitleBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + title_ = value; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + * + * + *
+     * Product description.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [description](https://support.google.com/merchants/answer/6324468).
+     * schema.org property [Product.description](https://schema.org/description).
+     * 
+ * + * string description = 10; + * + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Product description.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [description](https://support.google.com/merchants/answer/6324468).
+     * schema.org property [Product.description](https://schema.org/description).
+     * 
+ * + * string description = 10; + * + * @return The bytes for description. + */ + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Product description.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [description](https://support.google.com/merchants/answer/6324468).
+     * schema.org property [Product.description](https://schema.org/description).
+     * 
+ * + * string description = 10; + * + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + description_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Product description.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [description](https://support.google.com/merchants/answer/6324468).
+     * schema.org property [Product.description](https://schema.org/description).
+     * 
+ * + * string description = 10; + * + * @return This builder for chaining. + */ + public Builder clearDescription() { + + description_ = getDefaultInstance().getDescription(); + onChanged(); + return this; + } + /** + * + * + *
+     * Product description.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [description](https://support.google.com/merchants/answer/6324468).
+     * schema.org property [Product.description](https://schema.org/description).
+     * 
+ * + * string description = 10; + * + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + description_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + attributes_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + internalGetMutableAttributes() { + onChanged(); + ; + if (attributes_ == null) { + attributes_ = + com.google.protobuf.MapField.newMapField(AttributesDefaultEntryHolder.defaultEntry); + } + if (!attributes_.isMutable()) { + attributes_ = attributes_.copy(); + } + return attributes_; + } + + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); + } + /** + * + * + *
+     * Highly encouraged. Extra product attributes to be included. For example,
+     * for products, this could include the store name, vendor, style, color, etc.
+     * These are very strong signals for recommendation model, thus we highly
+     * recommend providing the attributes here.
+     * Features that can take on one of a limited number of possible values. Two
+     * types of features can be set are:
+     * Textual features. some examples would be the brand/maker of a product, or
+     * country of a customer. Numerical features. Some examples would be the
+     * height/weight of a product, or age of a customer.
+     * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+     * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+     * }`.
+     * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public boolean containsAttributes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetAttributes().getMap().containsKey(key); + } + /** Use {@link #getAttributesMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getAttributes() { + return getAttributesMap(); + } + /** + * + * + *
+     * Highly encouraged. Extra product attributes to be included. For example,
+     * for products, this could include the store name, vendor, style, color, etc.
+     * These are very strong signals for recommendation model, thus we highly
+     * recommend providing the attributes here.
+     * Features that can take on one of a limited number of possible values. Two
+     * types of features can be set are:
+     * Textual features. some examples would be the brand/maker of a product, or
+     * country of a customer. Numerical features. Some examples would be the
+     * height/weight of a product, or age of a customer.
+     * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+     * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+     * }`.
+     * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public java.util.Map + getAttributesMap() { + return internalGetAttributes().getMap(); + } + /** + * + * + *
+     * Highly encouraged. Extra product attributes to be included. For example,
+     * for products, this could include the store name, vendor, style, color, etc.
+     * These are very strong signals for recommendation model, thus we highly
+     * recommend providing the attributes here.
+     * Features that can take on one of a limited number of possible values. Two
+     * types of features can be set are:
+     * Textual features. some examples would be the brand/maker of a product, or
+     * country of a customer. Numerical features. Some examples would be the
+     * height/weight of a product, or age of a customer.
+     * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+     * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+     * }`.
+     * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Highly encouraged. Extra product attributes to be included. For example,
+     * for products, this could include the store name, vendor, style, color, etc.
+     * These are very strong signals for recommendation model, thus we highly
+     * recommend providing the attributes here.
+     * Features that can take on one of a limited number of possible values. Two
+     * types of features can be set are:
+     * Textual features. some examples would be the brand/maker of a product, or
+     * country of a customer. Numerical features. Some examples would be the
+     * height/weight of a product, or age of a customer.
+     * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+     * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+     * }`.
+     * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAttributes() { + internalGetMutableAttributes().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Highly encouraged. Extra product attributes to be included. For example,
+     * for products, this could include the store name, vendor, style, color, etc.
+     * These are very strong signals for recommendation model, thus we highly
+     * recommend providing the attributes here.
+     * Features that can take on one of a limited number of possible values. Two
+     * types of features can be set are:
+     * Textual features. some examples would be the brand/maker of a product, or
+     * country of a customer. Numerical features. Some examples would be the
+     * height/weight of a product, or age of a customer.
+     * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+     * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+     * }`.
+     * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + public Builder removeAttributes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableAttributes().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map + getMutableAttributes() { + return internalGetMutableAttributes().getMutableMap(); + } + /** + * + * + *
+     * Highly encouraged. Extra product attributes to be included. For example,
+     * for products, this could include the store name, vendor, style, color, etc.
+     * These are very strong signals for recommendation model, thus we highly
+     * recommend providing the attributes here.
+     * Features that can take on one of a limited number of possible values. Two
+     * types of features can be set are:
+     * Textual features. some examples would be the brand/maker of a product, or
+     * country of a customer. Numerical features. Some examples would be the
+     * height/weight of a product, or age of a customer.
+     * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+     * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+     * }`.
+     * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + public Builder putAttributes( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableAttributes().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Highly encouraged. Extra product attributes to be included. For example,
+     * for products, this could include the store name, vendor, style, color, etc.
+     * These are very strong signals for recommendation model, thus we highly
+     * recommend providing the attributes here.
+     * Features that can take on one of a limited number of possible values. Two
+     * types of features can be set are:
+     * Textual features. some examples would be the brand/maker of a product, or
+     * country of a customer. Numerical features. Some examples would be the
+     * height/weight of a product, or age of a customer.
+     * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+     * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+     * }`.
+     * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+     * error is returned.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + public Builder putAllAttributes( + java.util.Map values) { + internalGetMutableAttributes().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.LazyStringList tags_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureTagsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + tags_ = new com.google.protobuf.LazyStringArrayList(tags_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @return A list containing the tags. + */ + public com.google.protobuf.ProtocolStringList getTagsList() { + return tags_.getUnmodifiableView(); + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @return The count of tags. + */ + public int getTagsCount() { + return tags_.size(); + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @param index The index of the element to return. + * @return The tags at the given index. + */ + public java.lang.String getTags(int index) { + return tags_.get(index); + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + public com.google.protobuf.ByteString getTagsBytes(int index) { + return tags_.getByteString(index); + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @param index The index to set the value at. + * @param value The tags to set. + * @return This builder for chaining. + */ + public Builder setTags(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTagsIsMutable(); + tags_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @param value The tags to add. + * @return This builder for chaining. + */ + public Builder addTags(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTagsIsMutable(); + tags_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @param values The tags to add. + * @return This builder for chaining. + */ + public Builder addAllTags(java.lang.Iterable values) { + ensureTagsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, tags_); + onChanged(); + return this; + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @return This builder for chaining. + */ + public Builder clearTags() { + tags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Custom tags associated with the product.
+     * At most 250 values are allowed per
+     * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+     * encoded string with a length limit of 1,000 characters. Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This tag can be used for filtering recommendation results by passing the
+     * tag as part of the
+     * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+     * Google Merchant Center property
+     * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+     * 
+ * + * repeated string tags = 13; + * + * @param value The bytes of the tags to add. + * @return This builder for chaining. + */ + public Builder addTagsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTagsIsMutable(); + tags_.add(value); + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.PriceInfo priceInfo_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.PriceInfo, + com.google.cloud.retail.v2.PriceInfo.Builder, + com.google.cloud.retail.v2.PriceInfoOrBuilder> + priceInfoBuilder_; + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + * + * @return Whether the priceInfo field is set. + */ + public boolean hasPriceInfo() { + return priceInfoBuilder_ != null || priceInfo_ != null; + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + * + * @return The priceInfo. + */ + public com.google.cloud.retail.v2.PriceInfo getPriceInfo() { + if (priceInfoBuilder_ == null) { + return priceInfo_ == null + ? com.google.cloud.retail.v2.PriceInfo.getDefaultInstance() + : priceInfo_; + } else { + return priceInfoBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + public Builder setPriceInfo(com.google.cloud.retail.v2.PriceInfo value) { + if (priceInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + priceInfo_ = value; + onChanged(); + } else { + priceInfoBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + public Builder setPriceInfo(com.google.cloud.retail.v2.PriceInfo.Builder builderForValue) { + if (priceInfoBuilder_ == null) { + priceInfo_ = builderForValue.build(); + onChanged(); + } else { + priceInfoBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + public Builder mergePriceInfo(com.google.cloud.retail.v2.PriceInfo value) { + if (priceInfoBuilder_ == null) { + if (priceInfo_ != null) { + priceInfo_ = + com.google.cloud.retail.v2.PriceInfo.newBuilder(priceInfo_) + .mergeFrom(value) + .buildPartial(); + } else { + priceInfo_ = value; + } + onChanged(); + } else { + priceInfoBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + public Builder clearPriceInfo() { + if (priceInfoBuilder_ == null) { + priceInfo_ = null; + onChanged(); + } else { + priceInfo_ = null; + priceInfoBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + public com.google.cloud.retail.v2.PriceInfo.Builder getPriceInfoBuilder() { + + onChanged(); + return getPriceInfoFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + public com.google.cloud.retail.v2.PriceInfoOrBuilder getPriceInfoOrBuilder() { + if (priceInfoBuilder_ != null) { + return priceInfoBuilder_.getMessageOrBuilder(); + } else { + return priceInfo_ == null + ? com.google.cloud.retail.v2.PriceInfo.getDefaultInstance() + : priceInfo_; + } + } + /** + * + * + *
+     * Product price and cost information.
+     * Google Merchant Center property
+     * [price](https://support.google.com/merchants/answer/6324371).
+     * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.PriceInfo, + com.google.cloud.retail.v2.PriceInfo.Builder, + com.google.cloud.retail.v2.PriceInfoOrBuilder> + getPriceInfoFieldBuilder() { + if (priceInfoBuilder_ == null) { + priceInfoBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.PriceInfo, + com.google.cloud.retail.v2.PriceInfo.Builder, + com.google.cloud.retail.v2.PriceInfoOrBuilder>( + getPriceInfo(), getParentForChildren(), isClean()); + priceInfo_ = null; + } + return priceInfoBuilder_; + } + + private com.google.protobuf.Timestamp availableTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + availableTimeBuilder_; + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + * + * @return Whether the availableTime field is set. + */ + public boolean hasAvailableTime() { + return availableTimeBuilder_ != null || availableTime_ != null; + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + * + * @return The availableTime. + */ + public com.google.protobuf.Timestamp getAvailableTime() { + if (availableTimeBuilder_ == null) { + return availableTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : availableTime_; + } else { + return availableTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + public Builder setAvailableTime(com.google.protobuf.Timestamp value) { + if (availableTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + availableTime_ = value; + onChanged(); + } else { + availableTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + public Builder setAvailableTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (availableTimeBuilder_ == null) { + availableTime_ = builderForValue.build(); + onChanged(); + } else { + availableTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + public Builder mergeAvailableTime(com.google.protobuf.Timestamp value) { + if (availableTimeBuilder_ == null) { + if (availableTime_ != null) { + availableTime_ = + com.google.protobuf.Timestamp.newBuilder(availableTime_) + .mergeFrom(value) + .buildPartial(); + } else { + availableTime_ = value; + } + onChanged(); + } else { + availableTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + public Builder clearAvailableTime() { + if (availableTimeBuilder_ == null) { + availableTime_ = null; + onChanged(); + } else { + availableTime_ = null; + availableTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + public com.google.protobuf.Timestamp.Builder getAvailableTimeBuilder() { + + onChanged(); + return getAvailableTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + public com.google.protobuf.TimestampOrBuilder getAvailableTimeOrBuilder() { + if (availableTimeBuilder_ != null) { + return availableTimeBuilder_.getMessageOrBuilder(); + } else { + return availableTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : availableTime_; + } + } + /** + * + * + *
+     * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+     * available recommendation and search.
+     * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getAvailableTimeFieldBuilder() { + if (availableTimeBuilder_ == null) { + availableTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getAvailableTime(), getParentForChildren(), isClean()); + availableTime_ = null; + } + return availableTimeBuilder_; + } + + private int availability_ = 0; + /** + * + * + *
+     * The online availability of the [Product][google.cloud.retail.v2.Product].
+     * Default to
+     * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+     * Google Merchant Center Property
+     * [availability](https://support.google.com/merchants/answer/6324448).
+     * Schema.org Property [Offer.availability](https://schema.org/availability).
+     * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @return The enum numeric value on the wire for availability. + */ + @java.lang.Override + public int getAvailabilityValue() { + return availability_; + } + /** + * + * + *
+     * The online availability of the [Product][google.cloud.retail.v2.Product].
+     * Default to
+     * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+     * Google Merchant Center Property
+     * [availability](https://support.google.com/merchants/answer/6324448).
+     * Schema.org Property [Offer.availability](https://schema.org/availability).
+     * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @param value The enum numeric value on the wire for availability to set. + * @return This builder for chaining. + */ + public Builder setAvailabilityValue(int value) { + + availability_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The online availability of the [Product][google.cloud.retail.v2.Product].
+     * Default to
+     * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+     * Google Merchant Center Property
+     * [availability](https://support.google.com/merchants/answer/6324448).
+     * Schema.org Property [Offer.availability](https://schema.org/availability).
+     * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @return The availability. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product.Availability getAvailability() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.Product.Availability result = + com.google.cloud.retail.v2.Product.Availability.valueOf(availability_); + return result == null ? com.google.cloud.retail.v2.Product.Availability.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The online availability of the [Product][google.cloud.retail.v2.Product].
+     * Default to
+     * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+     * Google Merchant Center Property
+     * [availability](https://support.google.com/merchants/answer/6324448).
+     * Schema.org Property [Offer.availability](https://schema.org/availability).
+     * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @param value The availability to set. + * @return This builder for chaining. + */ + public Builder setAvailability(com.google.cloud.retail.v2.Product.Availability value) { + if (value == null) { + throw new NullPointerException(); + } + + availability_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The online availability of the [Product][google.cloud.retail.v2.Product].
+     * Default to
+     * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+     * Google Merchant Center Property
+     * [availability](https://support.google.com/merchants/answer/6324448).
+     * Schema.org Property [Offer.availability](https://schema.org/availability).
+     * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @return This builder for chaining. + */ + public Builder clearAvailability() { + + availability_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Int32Value availableQuantity_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Int32Value, + com.google.protobuf.Int32Value.Builder, + com.google.protobuf.Int32ValueOrBuilder> + availableQuantityBuilder_; + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + * + * @return Whether the availableQuantity field is set. + */ + public boolean hasAvailableQuantity() { + return availableQuantityBuilder_ != null || availableQuantity_ != null; + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + * + * @return The availableQuantity. + */ + public com.google.protobuf.Int32Value getAvailableQuantity() { + if (availableQuantityBuilder_ == null) { + return availableQuantity_ == null + ? com.google.protobuf.Int32Value.getDefaultInstance() + : availableQuantity_; + } else { + return availableQuantityBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + public Builder setAvailableQuantity(com.google.protobuf.Int32Value value) { + if (availableQuantityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + availableQuantity_ = value; + onChanged(); + } else { + availableQuantityBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + public Builder setAvailableQuantity(com.google.protobuf.Int32Value.Builder builderForValue) { + if (availableQuantityBuilder_ == null) { + availableQuantity_ = builderForValue.build(); + onChanged(); + } else { + availableQuantityBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + public Builder mergeAvailableQuantity(com.google.protobuf.Int32Value value) { + if (availableQuantityBuilder_ == null) { + if (availableQuantity_ != null) { + availableQuantity_ = + com.google.protobuf.Int32Value.newBuilder(availableQuantity_) + .mergeFrom(value) + .buildPartial(); + } else { + availableQuantity_ = value; + } + onChanged(); + } else { + availableQuantityBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + public Builder clearAvailableQuantity() { + if (availableQuantityBuilder_ == null) { + availableQuantity_ = null; + onChanged(); + } else { + availableQuantity_ = null; + availableQuantityBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + public com.google.protobuf.Int32Value.Builder getAvailableQuantityBuilder() { + + onChanged(); + return getAvailableQuantityFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + public com.google.protobuf.Int32ValueOrBuilder getAvailableQuantityOrBuilder() { + if (availableQuantityBuilder_ != null) { + return availableQuantityBuilder_.getMessageOrBuilder(); + } else { + return availableQuantity_ == null + ? com.google.protobuf.Int32Value.getDefaultInstance() + : availableQuantity_; + } + } + /** + * + * + *
+     * The available quantity of the item.
+     * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Int32Value, + com.google.protobuf.Int32Value.Builder, + com.google.protobuf.Int32ValueOrBuilder> + getAvailableQuantityFieldBuilder() { + if (availableQuantityBuilder_ == null) { + availableQuantityBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Int32Value, + com.google.protobuf.Int32Value.Builder, + com.google.protobuf.Int32ValueOrBuilder>( + getAvailableQuantity(), getParentForChildren(), isClean()); + availableQuantity_ = null; + } + return availableQuantityBuilder_; + } + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * Canonical URL directly linking to the product detail page.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+     * property [Offer.url](https://schema.org/url).
+     * 
+ * + * string uri = 22; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Canonical URL directly linking to the product detail page.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+     * property [Offer.url](https://schema.org/url).
+     * 
+ * + * string uri = 22; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Canonical URL directly linking to the product detail page.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+     * property [Offer.url](https://schema.org/url).
+     * 
+ * + * string uri = 22; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Canonical URL directly linking to the product detail page.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+     * property [Offer.url](https://schema.org/url).
+     * 
+ * + * string uri = 22; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * Canonical URL directly linking to the product detail page.
+     * This field must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Google Merchant Center property
+     * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+     * property [Offer.url](https://schema.org/url).
+     * 
+ * + * string uri = 22; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = value; + onChanged(); + return this; + } + + private java.util.List images_ = + java.util.Collections.emptyList(); + + private void ensureImagesIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + images_ = new java.util.ArrayList(images_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Image, + com.google.cloud.retail.v2.Image.Builder, + com.google.cloud.retail.v2.ImageOrBuilder> + imagesBuilder_; + + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public java.util.List getImagesList() { + if (imagesBuilder_ == null) { + return java.util.Collections.unmodifiableList(images_); + } else { + return imagesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public int getImagesCount() { + if (imagesBuilder_ == null) { + return images_.size(); + } else { + return imagesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public com.google.cloud.retail.v2.Image getImages(int index) { + if (imagesBuilder_ == null) { + return images_.get(index); + } else { + return imagesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder setImages(int index, com.google.cloud.retail.v2.Image value) { + if (imagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureImagesIsMutable(); + images_.set(index, value); + onChanged(); + } else { + imagesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder setImages(int index, com.google.cloud.retail.v2.Image.Builder builderForValue) { + if (imagesBuilder_ == null) { + ensureImagesIsMutable(); + images_.set(index, builderForValue.build()); + onChanged(); + } else { + imagesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder addImages(com.google.cloud.retail.v2.Image value) { + if (imagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureImagesIsMutable(); + images_.add(value); + onChanged(); + } else { + imagesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder addImages(int index, com.google.cloud.retail.v2.Image value) { + if (imagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureImagesIsMutable(); + images_.add(index, value); + onChanged(); + } else { + imagesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder addImages(com.google.cloud.retail.v2.Image.Builder builderForValue) { + if (imagesBuilder_ == null) { + ensureImagesIsMutable(); + images_.add(builderForValue.build()); + onChanged(); + } else { + imagesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder addImages(int index, com.google.cloud.retail.v2.Image.Builder builderForValue) { + if (imagesBuilder_ == null) { + ensureImagesIsMutable(); + images_.add(index, builderForValue.build()); + onChanged(); + } else { + imagesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder addAllImages( + java.lang.Iterable values) { + if (imagesBuilder_ == null) { + ensureImagesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, images_); + onChanged(); + } else { + imagesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder clearImages() { + if (imagesBuilder_ == null) { + images_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + imagesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public Builder removeImages(int index) { + if (imagesBuilder_ == null) { + ensureImagesIsMutable(); + images_.remove(index); + onChanged(); + } else { + imagesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public com.google.cloud.retail.v2.Image.Builder getImagesBuilder(int index) { + return getImagesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public com.google.cloud.retail.v2.ImageOrBuilder getImagesOrBuilder(int index) { + if (imagesBuilder_ == null) { + return images_.get(index); + } else { + return imagesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public java.util.List + getImagesOrBuilderList() { + if (imagesBuilder_ != null) { + return imagesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(images_); + } + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public com.google.cloud.retail.v2.Image.Builder addImagesBuilder() { + return getImagesFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.Image.getDefaultInstance()); + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public com.google.cloud.retail.v2.Image.Builder addImagesBuilder(int index) { + return getImagesFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.Image.getDefaultInstance()); + } + /** + * + * + *
+     * Product images for the product.
+     * A maximum of 300 images are allowed.
+     * Google Merchant Center property
+     * [image_link](https://support.google.com/merchants/answer/6324350).
+     * Schema.org property [Product.image](https://schema.org/image).
+     * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + public java.util.List getImagesBuilderList() { + return getImagesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Image, + com.google.cloud.retail.v2.Image.Builder, + com.google.cloud.retail.v2.ImageOrBuilder> + getImagesFieldBuilder() { + if (imagesBuilder_ == null) { + imagesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Image, + com.google.cloud.retail.v2.Image.Builder, + com.google.cloud.retail.v2.ImageOrBuilder>( + images_, ((bitField0_ & 0x00000008) != 0), getParentForChildren(), isClean()); + images_ = null; + } + return imagesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Product) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Product) + private static final com.google.cloud.retail.v2.Product DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Product(); + } + + public static com.google.cloud.retail.v2.Product getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Product parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Product(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Product getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductDetail.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductDetail.java new file mode 100644 index 00000000..1ee2338a --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductDetail.java @@ -0,0 +1,1079 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Detailed product information associated with a user event.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductDetail} + */ +public final class ProductDetail extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ProductDetail) + ProductDetailOrBuilder { + private static final long serialVersionUID = 0L; + // Use ProductDetail.newBuilder() to construct. + private ProductDetail(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ProductDetail() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ProductDetail(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ProductDetail( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.Product.Builder subBuilder = null; + if (product_ != null) { + subBuilder = product_.toBuilder(); + } + product_ = + input.readMessage(com.google.cloud.retail.v2.Product.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(product_); + product_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.Int32Value.Builder subBuilder = null; + if (quantity_ != null) { + subBuilder = quantity_.toBuilder(); + } + quantity_ = + input.readMessage(com.google.protobuf.Int32Value.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(quantity_); + quantity_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_ProductDetail_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_ProductDetail_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductDetail.class, + com.google.cloud.retail.v2.ProductDetail.Builder.class); + } + + public static final int PRODUCT_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.Product product_; + /** + * + * + *
+   * Required. [Product][google.cloud.retail.v2.Product] information.
+   * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+   * ingesting an event, all other product fields are ignored as we will look
+   * them up from the catalog.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + @java.lang.Override + public boolean hasProduct() { + return product_ != null; + } + /** + * + * + *
+   * Required. [Product][google.cloud.retail.v2.Product] information.
+   * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+   * ingesting an event, all other product fields are ignored as we will look
+   * them up from the catalog.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product getProduct() { + return product_ == null ? com.google.cloud.retail.v2.Product.getDefaultInstance() : product_; + } + /** + * + * + *
+   * Required. [Product][google.cloud.retail.v2.Product] information.
+   * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+   * ingesting an event, all other product fields are ignored as we will look
+   * them up from the catalog.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder() { + return getProduct(); + } + + public static final int QUANTITY_FIELD_NUMBER = 2; + private com.google.protobuf.Int32Value quantity_; + /** + * + * + *
+   * Quantity of the product associated with the user event.
+   * For example, this field will be 2 if two products are added to the shopping
+   * cart for `purchase-complete` event. Required for `add-to-cart` and
+   * `purchase-complete` event types.
+   * 
+ * + * .google.protobuf.Int32Value quantity = 2; + * + * @return Whether the quantity field is set. + */ + @java.lang.Override + public boolean hasQuantity() { + return quantity_ != null; + } + /** + * + * + *
+   * Quantity of the product associated with the user event.
+   * For example, this field will be 2 if two products are added to the shopping
+   * cart for `purchase-complete` event. Required for `add-to-cart` and
+   * `purchase-complete` event types.
+   * 
+ * + * .google.protobuf.Int32Value quantity = 2; + * + * @return The quantity. + */ + @java.lang.Override + public com.google.protobuf.Int32Value getQuantity() { + return quantity_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : quantity_; + } + /** + * + * + *
+   * Quantity of the product associated with the user event.
+   * For example, this field will be 2 if two products are added to the shopping
+   * cart for `purchase-complete` event. Required for `add-to-cart` and
+   * `purchase-complete` event types.
+   * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + @java.lang.Override + public com.google.protobuf.Int32ValueOrBuilder getQuantityOrBuilder() { + return getQuantity(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (product_ != null) { + output.writeMessage(1, getProduct()); + } + if (quantity_ != null) { + output.writeMessage(2, getQuantity()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (product_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getProduct()); + } + if (quantity_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getQuantity()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ProductDetail)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ProductDetail other = (com.google.cloud.retail.v2.ProductDetail) obj; + + if (hasProduct() != other.hasProduct()) return false; + if (hasProduct()) { + if (!getProduct().equals(other.getProduct())) return false; + } + if (hasQuantity() != other.hasQuantity()) return false; + if (hasQuantity()) { + if (!getQuantity().equals(other.getQuantity())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasProduct()) { + hash = (37 * hash) + PRODUCT_FIELD_NUMBER; + hash = (53 * hash) + getProduct().hashCode(); + } + if (hasQuantity()) { + hash = (37 * hash) + QUANTITY_FIELD_NUMBER; + hash = (53 * hash) + getQuantity().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductDetail parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductDetail parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductDetail parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ProductDetail prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Detailed product information associated with a user event.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductDetail} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ProductDetail) + com.google.cloud.retail.v2.ProductDetailOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_ProductDetail_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_ProductDetail_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductDetail.class, + com.google.cloud.retail.v2.ProductDetail.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ProductDetail.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (productBuilder_ == null) { + product_ = null; + } else { + product_ = null; + productBuilder_ = null; + } + if (quantityBuilder_ == null) { + quantity_ = null; + } else { + quantity_ = null; + quantityBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_ProductDetail_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductDetail getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ProductDetail.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductDetail build() { + com.google.cloud.retail.v2.ProductDetail result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductDetail buildPartial() { + com.google.cloud.retail.v2.ProductDetail result = + new com.google.cloud.retail.v2.ProductDetail(this); + if (productBuilder_ == null) { + result.product_ = product_; + } else { + result.product_ = productBuilder_.build(); + } + if (quantityBuilder_ == null) { + result.quantity_ = quantity_; + } else { + result.quantity_ = quantityBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ProductDetail) { + return mergeFrom((com.google.cloud.retail.v2.ProductDetail) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ProductDetail other) { + if (other == com.google.cloud.retail.v2.ProductDetail.getDefaultInstance()) return this; + if (other.hasProduct()) { + mergeProduct(other.getProduct()); + } + if (other.hasQuantity()) { + mergeQuantity(other.getQuantity()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ProductDetail parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ProductDetail) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.retail.v2.Product product_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + productBuilder_; + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + public boolean hasProduct() { + return productBuilder_ != null || product_ != null; + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + public com.google.cloud.retail.v2.Product getProduct() { + if (productBuilder_ == null) { + return product_ == null + ? com.google.cloud.retail.v2.Product.getDefaultInstance() + : product_; + } else { + return productBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProduct(com.google.cloud.retail.v2.Product value) { + if (productBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + product_ = value; + onChanged(); + } else { + productBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProduct(com.google.cloud.retail.v2.Product.Builder builderForValue) { + if (productBuilder_ == null) { + product_ = builderForValue.build(); + onChanged(); + } else { + productBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeProduct(com.google.cloud.retail.v2.Product value) { + if (productBuilder_ == null) { + if (product_ != null) { + product_ = + com.google.cloud.retail.v2.Product.newBuilder(product_) + .mergeFrom(value) + .buildPartial(); + } else { + product_ = value; + } + onChanged(); + } else { + productBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearProduct() { + if (productBuilder_ == null) { + product_ = null; + onChanged(); + } else { + product_ = null; + productBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Product.Builder getProductBuilder() { + + onChanged(); + return getProductFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder() { + if (productBuilder_ != null) { + return productBuilder_.getMessageOrBuilder(); + } else { + return product_ == null + ? com.google.cloud.retail.v2.Product.getDefaultInstance() + : product_; + } + } + /** + * + * + *
+     * Required. [Product][google.cloud.retail.v2.Product] information.
+     * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+     * ingesting an event, all other product fields are ignored as we will look
+     * them up from the catalog.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + getProductFieldBuilder() { + if (productBuilder_ == null) { + productBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder>( + getProduct(), getParentForChildren(), isClean()); + product_ = null; + } + return productBuilder_; + } + + private com.google.protobuf.Int32Value quantity_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Int32Value, + com.google.protobuf.Int32Value.Builder, + com.google.protobuf.Int32ValueOrBuilder> + quantityBuilder_; + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + * + * @return Whether the quantity field is set. + */ + public boolean hasQuantity() { + return quantityBuilder_ != null || quantity_ != null; + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + * + * @return The quantity. + */ + public com.google.protobuf.Int32Value getQuantity() { + if (quantityBuilder_ == null) { + return quantity_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : quantity_; + } else { + return quantityBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + public Builder setQuantity(com.google.protobuf.Int32Value value) { + if (quantityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + quantity_ = value; + onChanged(); + } else { + quantityBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + public Builder setQuantity(com.google.protobuf.Int32Value.Builder builderForValue) { + if (quantityBuilder_ == null) { + quantity_ = builderForValue.build(); + onChanged(); + } else { + quantityBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + public Builder mergeQuantity(com.google.protobuf.Int32Value value) { + if (quantityBuilder_ == null) { + if (quantity_ != null) { + quantity_ = + com.google.protobuf.Int32Value.newBuilder(quantity_).mergeFrom(value).buildPartial(); + } else { + quantity_ = value; + } + onChanged(); + } else { + quantityBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + public Builder clearQuantity() { + if (quantityBuilder_ == null) { + quantity_ = null; + onChanged(); + } else { + quantity_ = null; + quantityBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + public com.google.protobuf.Int32Value.Builder getQuantityBuilder() { + + onChanged(); + return getQuantityFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + public com.google.protobuf.Int32ValueOrBuilder getQuantityOrBuilder() { + if (quantityBuilder_ != null) { + return quantityBuilder_.getMessageOrBuilder(); + } else { + return quantity_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : quantity_; + } + } + /** + * + * + *
+     * Quantity of the product associated with the user event.
+     * For example, this field will be 2 if two products are added to the shopping
+     * cart for `purchase-complete` event. Required for `add-to-cart` and
+     * `purchase-complete` event types.
+     * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Int32Value, + com.google.protobuf.Int32Value.Builder, + com.google.protobuf.Int32ValueOrBuilder> + getQuantityFieldBuilder() { + if (quantityBuilder_ == null) { + quantityBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Int32Value, + com.google.protobuf.Int32Value.Builder, + com.google.protobuf.Int32ValueOrBuilder>( + getQuantity(), getParentForChildren(), isClean()); + quantity_ = null; + } + return quantityBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ProductDetail) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ProductDetail) + private static final com.google.cloud.retail.v2.ProductDetail DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ProductDetail(); + } + + public static com.google.cloud.retail.v2.ProductDetail getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProductDetail parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProductDetail(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductDetail getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductDetailOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductDetailOrBuilder.java new file mode 100644 index 00000000..1506b07e --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductDetailOrBuilder.java @@ -0,0 +1,116 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event.proto + +package com.google.cloud.retail.v2; + +public interface ProductDetailOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ProductDetail) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. [Product][google.cloud.retail.v2.Product] information.
+   * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+   * ingesting an event, all other product fields are ignored as we will look
+   * them up from the catalog.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + boolean hasProduct(); + /** + * + * + *
+   * Required. [Product][google.cloud.retail.v2.Product] information.
+   * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+   * ingesting an event, all other product fields are ignored as we will look
+   * them up from the catalog.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + com.google.cloud.retail.v2.Product getProduct(); + /** + * + * + *
+   * Required. [Product][google.cloud.retail.v2.Product] information.
+   * Only [Product.id][google.cloud.retail.v2.Product.id] field is used when
+   * ingesting an event, all other product fields are ignored as we will look
+   * them up from the catalog.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder(); + + /** + * + * + *
+   * Quantity of the product associated with the user event.
+   * For example, this field will be 2 if two products are added to the shopping
+   * cart for `purchase-complete` event. Required for `add-to-cart` and
+   * `purchase-complete` event types.
+   * 
+ * + * .google.protobuf.Int32Value quantity = 2; + * + * @return Whether the quantity field is set. + */ + boolean hasQuantity(); + /** + * + * + *
+   * Quantity of the product associated with the user event.
+   * For example, this field will be 2 if two products are added to the shopping
+   * cart for `purchase-complete` event. Required for `add-to-cart` and
+   * `purchase-complete` event types.
+   * 
+ * + * .google.protobuf.Int32Value quantity = 2; + * + * @return The quantity. + */ + com.google.protobuf.Int32Value getQuantity(); + /** + * + * + *
+   * Quantity of the product associated with the user event.
+   * For example, this field will be 2 if two products are added to the shopping
+   * cart for `purchase-complete` event. Required for `add-to-cart` and
+   * `purchase-complete` event types.
+   * 
+ * + * .google.protobuf.Int32Value quantity = 2; + */ + com.google.protobuf.Int32ValueOrBuilder getQuantityOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInlineSource.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInlineSource.java new file mode 100644 index 00000000..45b05923 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInlineSource.java @@ -0,0 +1,1038 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * The inline source for the input config for ImportProducts method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductInlineSource} + */ +public final class ProductInlineSource extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ProductInlineSource) + ProductInlineSourceOrBuilder { + private static final long serialVersionUID = 0L; + // Use ProductInlineSource.newBuilder() to construct. + private ProductInlineSource(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ProductInlineSource() { + products_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ProductInlineSource(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ProductInlineSource( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + products_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + products_.add( + input.readMessage( + com.google.cloud.retail.v2.Product.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + products_ = java.util.Collections.unmodifiableList(products_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInlineSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInlineSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductInlineSource.class, + com.google.cloud.retail.v2.ProductInlineSource.Builder.class); + } + + public static final int PRODUCTS_FIELD_NUMBER = 1; + private java.util.List products_; + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public java.util.List getProductsList() { + return products_; + } + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public java.util.List + getProductsOrBuilderList() { + return products_; + } + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public int getProductsCount() { + return products_.size(); + } + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product getProducts(int index) { + return products_.get(index); + } + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductOrBuilder getProductsOrBuilder(int index) { + return products_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < products_.size(); i++) { + output.writeMessage(1, products_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < products_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, products_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ProductInlineSource)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ProductInlineSource other = + (com.google.cloud.retail.v2.ProductInlineSource) obj; + + if (!getProductsList().equals(other.getProductsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getProductsCount() > 0) { + hash = (37 * hash) + PRODUCTS_FIELD_NUMBER; + hash = (53 * hash) + getProductsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductInlineSource parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ProductInlineSource prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The inline source for the input config for ImportProducts method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductInlineSource} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ProductInlineSource) + com.google.cloud.retail.v2.ProductInlineSourceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInlineSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInlineSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductInlineSource.class, + com.google.cloud.retail.v2.ProductInlineSource.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ProductInlineSource.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getProductsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (productsBuilder_ == null) { + products_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + productsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInlineSource_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSource getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSource build() { + com.google.cloud.retail.v2.ProductInlineSource result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSource buildPartial() { + com.google.cloud.retail.v2.ProductInlineSource result = + new com.google.cloud.retail.v2.ProductInlineSource(this); + int from_bitField0_ = bitField0_; + if (productsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + products_ = java.util.Collections.unmodifiableList(products_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.products_ = products_; + } else { + result.products_ = productsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ProductInlineSource) { + return mergeFrom((com.google.cloud.retail.v2.ProductInlineSource) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ProductInlineSource other) { + if (other == com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance()) return this; + if (productsBuilder_ == null) { + if (!other.products_.isEmpty()) { + if (products_.isEmpty()) { + products_ = other.products_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureProductsIsMutable(); + products_.addAll(other.products_); + } + onChanged(); + } + } else { + if (!other.products_.isEmpty()) { + if (productsBuilder_.isEmpty()) { + productsBuilder_.dispose(); + productsBuilder_ = null; + products_ = other.products_; + bitField0_ = (bitField0_ & ~0x00000001); + productsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getProductsFieldBuilder() + : null; + } else { + productsBuilder_.addAllMessages(other.products_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ProductInlineSource parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ProductInlineSource) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List products_ = + java.util.Collections.emptyList(); + + private void ensureProductsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + products_ = new java.util.ArrayList(products_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + productsBuilder_; + + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List getProductsList() { + if (productsBuilder_ == null) { + return java.util.Collections.unmodifiableList(products_); + } else { + return productsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getProductsCount() { + if (productsBuilder_ == null) { + return products_.size(); + } else { + return productsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Product getProducts(int index) { + if (productsBuilder_ == null) { + return products_.get(index); + } else { + return productsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProducts(int index, com.google.cloud.retail.v2.Product value) { + if (productsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProductsIsMutable(); + products_.set(index, value); + onChanged(); + } else { + productsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProducts( + int index, com.google.cloud.retail.v2.Product.Builder builderForValue) { + if (productsBuilder_ == null) { + ensureProductsIsMutable(); + products_.set(index, builderForValue.build()); + onChanged(); + } else { + productsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addProducts(com.google.cloud.retail.v2.Product value) { + if (productsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProductsIsMutable(); + products_.add(value); + onChanged(); + } else { + productsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addProducts(int index, com.google.cloud.retail.v2.Product value) { + if (productsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProductsIsMutable(); + products_.add(index, value); + onChanged(); + } else { + productsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addProducts(com.google.cloud.retail.v2.Product.Builder builderForValue) { + if (productsBuilder_ == null) { + ensureProductsIsMutable(); + products_.add(builderForValue.build()); + onChanged(); + } else { + productsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addProducts( + int index, com.google.cloud.retail.v2.Product.Builder builderForValue) { + if (productsBuilder_ == null) { + ensureProductsIsMutable(); + products_.add(index, builderForValue.build()); + onChanged(); + } else { + productsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addAllProducts( + java.lang.Iterable values) { + if (productsBuilder_ == null) { + ensureProductsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, products_); + onChanged(); + } else { + productsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearProducts() { + if (productsBuilder_ == null) { + products_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + productsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder removeProducts(int index) { + if (productsBuilder_ == null) { + ensureProductsIsMutable(); + products_.remove(index); + onChanged(); + } else { + productsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Product.Builder getProductsBuilder(int index) { + return getProductsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductOrBuilder getProductsOrBuilder(int index) { + if (productsBuilder_ == null) { + return products_.get(index); + } else { + return productsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getProductsOrBuilderList() { + if (productsBuilder_ != null) { + return productsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(products_); + } + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Product.Builder addProductsBuilder() { + return getProductsFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.Product.getDefaultInstance()); + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Product.Builder addProductsBuilder(int index) { + return getProductsFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.Product.getDefaultInstance()); + } + /** + * + * + *
+     * Required. A list of products to update/create. Each product must have a
+     * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+     * 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List getProductsBuilderList() { + return getProductsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + getProductsFieldBuilder() { + if (productsBuilder_ == null) { + productsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder>( + products_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + products_ = null; + } + return productsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ProductInlineSource) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ProductInlineSource) + private static final com.google.cloud.retail.v2.ProductInlineSource DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ProductInlineSource(); + } + + public static com.google.cloud.retail.v2.ProductInlineSource getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProductInlineSource parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProductInlineSource(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSource getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInlineSourceOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInlineSourceOrBuilder.java new file mode 100644 index 00000000..b9c62cb2 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInlineSourceOrBuilder.java @@ -0,0 +1,96 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ProductInlineSourceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ProductInlineSource) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getProductsList(); + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.Product getProducts(int index); + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + int getProductsCount(); + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getProductsOrBuilderList(); + /** + * + * + *
+   * Required. A list of products to update/create. Each product must have a
+   * valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
+   * 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.Product products = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ProductOrBuilder getProductsOrBuilder(int index); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInputConfig.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInputConfig.java new file mode 100644 index 00000000..dc6040fc --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInputConfig.java @@ -0,0 +1,1443 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * The input config source for products.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductInputConfig} + */ +public final class ProductInputConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ProductInputConfig) + ProductInputConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ProductInputConfig.newBuilder() to construct. + private ProductInputConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ProductInputConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ProductInputConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ProductInputConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.ProductInlineSource.Builder subBuilder = null; + if (sourceCase_ == 1) { + subBuilder = ((com.google.cloud.retail.v2.ProductInlineSource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.retail.v2.ProductInlineSource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.ProductInlineSource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 1; + break; + } + case 18: + { + com.google.cloud.retail.v2.GcsSource.Builder subBuilder = null; + if (sourceCase_ == 2) { + subBuilder = ((com.google.cloud.retail.v2.GcsSource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.retail.v2.GcsSource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.GcsSource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 2; + break; + } + case 26: + { + com.google.cloud.retail.v2.BigQuerySource.Builder subBuilder = null; + if (sourceCase_ == 3) { + subBuilder = ((com.google.cloud.retail.v2.BigQuerySource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.retail.v2.BigQuerySource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.BigQuerySource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 3; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductInputConfig.class, + com.google.cloud.retail.v2.ProductInputConfig.Builder.class); + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public enum SourceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PRODUCT_INLINE_SOURCE(1), + GCS_SOURCE(2), + BIG_QUERY_SOURCE(3), + SOURCE_NOT_SET(0); + private final int value; + + private SourceCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SourceCase valueOf(int value) { + return forNumber(value); + } + + public static SourceCase forNumber(int value) { + switch (value) { + case 1: + return PRODUCT_INLINE_SOURCE; + case 2: + return GCS_SOURCE; + case 3: + return BIG_QUERY_SOURCE; + case 0: + return SOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public static final int PRODUCT_INLINE_SOURCE_FIELD_NUMBER = 1; + /** + * + * + *
+   * The Inline source for the input content for products.
+   * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + * + * @return Whether the productInlineSource field is set. + */ + @java.lang.Override + public boolean hasProductInlineSource() { + return sourceCase_ == 1; + } + /** + * + * + *
+   * The Inline source for the input content for products.
+   * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + * + * @return The productInlineSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSource getProductInlineSource() { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.ProductInlineSource) source_; + } + return com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance(); + } + /** + * + * + *
+   * The Inline source for the input content for products.
+   * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSourceOrBuilder getProductInlineSourceOrBuilder() { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.ProductInlineSource) source_; + } + return com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance(); + } + + public static final int GCS_SOURCE_FIELD_NUMBER = 2; + /** + * + * + *
+   * Google Cloud Storage location for the input content.
+   * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + * + * @return Whether the gcsSource field is set. + */ + @java.lang.Override + public boolean hasGcsSource() { + return sourceCase_ == 2; + } + /** + * + * + *
+   * Google Cloud Storage location for the input content.
+   * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + * + * @return The gcsSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource getGcsSource() { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + /** + * + * + *
+   * Google Cloud Storage location for the input content.
+   * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + + public static final int BIG_QUERY_SOURCE_FIELD_NUMBER = 3; + /** + * + * + *
+   * BigQuery input source.
+   * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + * + * @return Whether the bigQuerySource field is set. + */ + @java.lang.Override + public boolean hasBigQuerySource() { + return sourceCase_ == 3; + } + /** + * + * + *
+   * BigQuery input source.
+   * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + * + * @return The bigQuerySource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource getBigQuerySource() { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + /** + * + * + *
+   * BigQuery input source.
+   * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySourceOrBuilder getBigQuerySourceOrBuilder() { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (sourceCase_ == 1) { + output.writeMessage(1, (com.google.cloud.retail.v2.ProductInlineSource) source_); + } + if (sourceCase_ == 2) { + output.writeMessage(2, (com.google.cloud.retail.v2.GcsSource) source_); + } + if (sourceCase_ == 3) { + output.writeMessage(3, (com.google.cloud.retail.v2.BigQuerySource) source_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sourceCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.cloud.retail.v2.ProductInlineSource) source_); + } + if (sourceCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.retail.v2.GcsSource) source_); + } + if (sourceCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.cloud.retail.v2.BigQuerySource) source_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ProductInputConfig)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ProductInputConfig other = + (com.google.cloud.retail.v2.ProductInputConfig) obj; + + if (!getSourceCase().equals(other.getSourceCase())) return false; + switch (sourceCase_) { + case 1: + if (!getProductInlineSource().equals(other.getProductInlineSource())) return false; + break; + case 2: + if (!getGcsSource().equals(other.getGcsSource())) return false; + break; + case 3: + if (!getBigQuerySource().equals(other.getBigQuerySource())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (sourceCase_) { + case 1: + hash = (37 * hash) + PRODUCT_INLINE_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getProductInlineSource().hashCode(); + break; + case 2: + hash = (37 * hash) + GCS_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getGcsSource().hashCode(); + break; + case 3: + hash = (37 * hash) + BIG_QUERY_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getBigQuerySource().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductInputConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ProductInputConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The input config source for products.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductInputConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ProductInputConfig) + com.google.cloud.retail.v2.ProductInputConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductInputConfig.class, + com.google.cloud.retail.v2.ProductInputConfig.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ProductInputConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + sourceCase_ = 0; + source_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_ProductInputConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInputConfig getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ProductInputConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInputConfig build() { + com.google.cloud.retail.v2.ProductInputConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInputConfig buildPartial() { + com.google.cloud.retail.v2.ProductInputConfig result = + new com.google.cloud.retail.v2.ProductInputConfig(this); + if (sourceCase_ == 1) { + if (productInlineSourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = productInlineSourceBuilder_.build(); + } + } + if (sourceCase_ == 2) { + if (gcsSourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = gcsSourceBuilder_.build(); + } + } + if (sourceCase_ == 3) { + if (bigQuerySourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = bigQuerySourceBuilder_.build(); + } + } + result.sourceCase_ = sourceCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ProductInputConfig) { + return mergeFrom((com.google.cloud.retail.v2.ProductInputConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ProductInputConfig other) { + if (other == com.google.cloud.retail.v2.ProductInputConfig.getDefaultInstance()) return this; + switch (other.getSourceCase()) { + case PRODUCT_INLINE_SOURCE: + { + mergeProductInlineSource(other.getProductInlineSource()); + break; + } + case GCS_SOURCE: + { + mergeGcsSource(other.getGcsSource()); + break; + } + case BIG_QUERY_SOURCE: + { + mergeBigQuerySource(other.getBigQuerySource()); + break; + } + case SOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ProductInputConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ProductInputConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public Builder clearSource() { + sourceCase_ = 0; + source_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductInlineSource, + com.google.cloud.retail.v2.ProductInlineSource.Builder, + com.google.cloud.retail.v2.ProductInlineSourceOrBuilder> + productInlineSourceBuilder_; + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + * + * @return Whether the productInlineSource field is set. + */ + @java.lang.Override + public boolean hasProductInlineSource() { + return sourceCase_ == 1; + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + * + * @return The productInlineSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSource getProductInlineSource() { + if (productInlineSourceBuilder_ == null) { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.ProductInlineSource) source_; + } + return com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance(); + } else { + if (sourceCase_ == 1) { + return productInlineSourceBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + public Builder setProductInlineSource(com.google.cloud.retail.v2.ProductInlineSource value) { + if (productInlineSourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + productInlineSourceBuilder_.setMessage(value); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + public Builder setProductInlineSource( + com.google.cloud.retail.v2.ProductInlineSource.Builder builderForValue) { + if (productInlineSourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + productInlineSourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + public Builder mergeProductInlineSource(com.google.cloud.retail.v2.ProductInlineSource value) { + if (productInlineSourceBuilder_ == null) { + if (sourceCase_ == 1 + && source_ != com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance()) { + source_ = + com.google.cloud.retail.v2.ProductInlineSource.newBuilder( + (com.google.cloud.retail.v2.ProductInlineSource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 1) { + productInlineSourceBuilder_.mergeFrom(value); + } + productInlineSourceBuilder_.setMessage(value); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + public Builder clearProductInlineSource() { + if (productInlineSourceBuilder_ == null) { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + } + productInlineSourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + public com.google.cloud.retail.v2.ProductInlineSource.Builder getProductInlineSourceBuilder() { + return getProductInlineSourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductInlineSourceOrBuilder + getProductInlineSourceOrBuilder() { + if ((sourceCase_ == 1) && (productInlineSourceBuilder_ != null)) { + return productInlineSourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.ProductInlineSource) source_; + } + return com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * The Inline source for the input content for products.
+     * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductInlineSource, + com.google.cloud.retail.v2.ProductInlineSource.Builder, + com.google.cloud.retail.v2.ProductInlineSourceOrBuilder> + getProductInlineSourceFieldBuilder() { + if (productInlineSourceBuilder_ == null) { + if (!(sourceCase_ == 1)) { + source_ = com.google.cloud.retail.v2.ProductInlineSource.getDefaultInstance(); + } + productInlineSourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ProductInlineSource, + com.google.cloud.retail.v2.ProductInlineSource.Builder, + com.google.cloud.retail.v2.ProductInlineSourceOrBuilder>( + (com.google.cloud.retail.v2.ProductInlineSource) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 1; + onChanged(); + ; + return productInlineSourceBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.GcsSource, + com.google.cloud.retail.v2.GcsSource.Builder, + com.google.cloud.retail.v2.GcsSourceOrBuilder> + gcsSourceBuilder_; + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + * + * @return Whether the gcsSource field is set. + */ + @java.lang.Override + public boolean hasGcsSource() { + return sourceCase_ == 2; + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + * + * @return The gcsSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource getGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } else { + if (sourceCase_ == 2) { + return gcsSourceBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + public Builder setGcsSource(com.google.cloud.retail.v2.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + public Builder setGcsSource(com.google.cloud.retail.v2.GcsSource.Builder builderForValue) { + if (gcsSourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + gcsSourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + public Builder mergeGcsSource(com.google.cloud.retail.v2.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2 + && source_ != com.google.cloud.retail.v2.GcsSource.getDefaultInstance()) { + source_ = + com.google.cloud.retail.v2.GcsSource.newBuilder( + (com.google.cloud.retail.v2.GcsSource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 2) { + gcsSourceBuilder_.mergeFrom(value); + } + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + public Builder clearGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + } + gcsSourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + public com.google.cloud.retail.v2.GcsSource.Builder getGcsSourceBuilder() { + return getGcsSourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if ((sourceCase_ == 2) && (gcsSourceBuilder_ != null)) { + return gcsSourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Google Cloud Storage location for the input content.
+     * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.GcsSource, + com.google.cloud.retail.v2.GcsSource.Builder, + com.google.cloud.retail.v2.GcsSourceOrBuilder> + getGcsSourceFieldBuilder() { + if (gcsSourceBuilder_ == null) { + if (!(sourceCase_ == 2)) { + source_ = com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + gcsSourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.GcsSource, + com.google.cloud.retail.v2.GcsSource.Builder, + com.google.cloud.retail.v2.GcsSourceOrBuilder>( + (com.google.cloud.retail.v2.GcsSource) source_, getParentForChildren(), isClean()); + source_ = null; + } + sourceCase_ = 2; + onChanged(); + ; + return gcsSourceBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.BigQuerySource, + com.google.cloud.retail.v2.BigQuerySource.Builder, + com.google.cloud.retail.v2.BigQuerySourceOrBuilder> + bigQuerySourceBuilder_; + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + * + * @return Whether the bigQuerySource field is set. + */ + @java.lang.Override + public boolean hasBigQuerySource() { + return sourceCase_ == 3; + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + * + * @return The bigQuerySource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource getBigQuerySource() { + if (bigQuerySourceBuilder_ == null) { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } else { + if (sourceCase_ == 3) { + return bigQuerySourceBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + public Builder setBigQuerySource(com.google.cloud.retail.v2.BigQuerySource value) { + if (bigQuerySourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + bigQuerySourceBuilder_.setMessage(value); + } + sourceCase_ = 3; + return this; + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + public Builder setBigQuerySource( + com.google.cloud.retail.v2.BigQuerySource.Builder builderForValue) { + if (bigQuerySourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + bigQuerySourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 3; + return this; + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + public Builder mergeBigQuerySource(com.google.cloud.retail.v2.BigQuerySource value) { + if (bigQuerySourceBuilder_ == null) { + if (sourceCase_ == 3 + && source_ != com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance()) { + source_ = + com.google.cloud.retail.v2.BigQuerySource.newBuilder( + (com.google.cloud.retail.v2.BigQuerySource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 3) { + bigQuerySourceBuilder_.mergeFrom(value); + } + bigQuerySourceBuilder_.setMessage(value); + } + sourceCase_ = 3; + return this; + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + public Builder clearBigQuerySource() { + if (bigQuerySourceBuilder_ == null) { + if (sourceCase_ == 3) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 3) { + sourceCase_ = 0; + source_ = null; + } + bigQuerySourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + public com.google.cloud.retail.v2.BigQuerySource.Builder getBigQuerySourceBuilder() { + return getBigQuerySourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySourceOrBuilder getBigQuerySourceOrBuilder() { + if ((sourceCase_ == 3) && (bigQuerySourceBuilder_ != null)) { + return bigQuerySourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + } + /** + * + * + *
+     * BigQuery input source.
+     * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.BigQuerySource, + com.google.cloud.retail.v2.BigQuerySource.Builder, + com.google.cloud.retail.v2.BigQuerySourceOrBuilder> + getBigQuerySourceFieldBuilder() { + if (bigQuerySourceBuilder_ == null) { + if (!(sourceCase_ == 3)) { + source_ = com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + bigQuerySourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.BigQuerySource, + com.google.cloud.retail.v2.BigQuerySource.Builder, + com.google.cloud.retail.v2.BigQuerySourceOrBuilder>( + (com.google.cloud.retail.v2.BigQuerySource) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 3; + onChanged(); + ; + return bigQuerySourceBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ProductInputConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ProductInputConfig) + private static final com.google.cloud.retail.v2.ProductInputConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ProductInputConfig(); + } + + public static com.google.cloud.retail.v2.ProductInputConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProductInputConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProductInputConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductInputConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInputConfigOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInputConfigOrBuilder.java new file mode 100644 index 00000000..6d3c05b2 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductInputConfigOrBuilder.java @@ -0,0 +1,132 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface ProductInputConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ProductInputConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The Inline source for the input content for products.
+   * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + * + * @return Whether the productInlineSource field is set. + */ + boolean hasProductInlineSource(); + /** + * + * + *
+   * The Inline source for the input content for products.
+   * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + * + * @return The productInlineSource. + */ + com.google.cloud.retail.v2.ProductInlineSource getProductInlineSource(); + /** + * + * + *
+   * The Inline source for the input content for products.
+   * 
+ * + * .google.cloud.retail.v2.ProductInlineSource product_inline_source = 1; + */ + com.google.cloud.retail.v2.ProductInlineSourceOrBuilder getProductInlineSourceOrBuilder(); + + /** + * + * + *
+   * Google Cloud Storage location for the input content.
+   * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + * + * @return Whether the gcsSource field is set. + */ + boolean hasGcsSource(); + /** + * + * + *
+   * Google Cloud Storage location for the input content.
+   * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + * + * @return The gcsSource. + */ + com.google.cloud.retail.v2.GcsSource getGcsSource(); + /** + * + * + *
+   * Google Cloud Storage location for the input content.
+   * 
+ * + * .google.cloud.retail.v2.GcsSource gcs_source = 2; + */ + com.google.cloud.retail.v2.GcsSourceOrBuilder getGcsSourceOrBuilder(); + + /** + * + * + *
+   * BigQuery input source.
+   * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + * + * @return Whether the bigQuerySource field is set. + */ + boolean hasBigQuerySource(); + /** + * + * + *
+   * BigQuery input source.
+   * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + * + * @return The bigQuerySource. + */ + com.google.cloud.retail.v2.BigQuerySource getBigQuerySource(); + /** + * + * + *
+   * BigQuery input source.
+   * 
+ * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3; + */ + com.google.cloud.retail.v2.BigQuerySourceOrBuilder getBigQuerySourceOrBuilder(); + + public com.google.cloud.retail.v2.ProductInputConfig.SourceCase getSourceCase(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductLevelConfig.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductLevelConfig.java new file mode 100644 index 00000000..66e50e0f --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductLevelConfig.java @@ -0,0 +1,1070 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Configures what level the product should be uploaded with regards to
+ * how users will be send events and how predictions will be made.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductLevelConfig} + */ +public final class ProductLevelConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ProductLevelConfig) + ProductLevelConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ProductLevelConfig.newBuilder() to construct. + private ProductLevelConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ProductLevelConfig() { + ingestionProductType_ = ""; + merchantCenterProductIdField_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ProductLevelConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ProductLevelConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + ingestionProductType_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + merchantCenterProductIdField_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_ProductLevelConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_ProductLevelConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductLevelConfig.class, + com.google.cloud.retail.v2.ProductLevelConfig.Builder.class); + } + + public static final int INGESTION_PRODUCT_TYPE_FIELD_NUMBER = 1; + private volatile java.lang.Object ingestionProductType_; + /** + * + * + *
+   * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+   * ingested into the catalog. Acceptable values are:
+   * * `primary` (default): You can only ingest
+   * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   *   [Product][google.cloud.retail.v2.Product]s. This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   can only be empty or set to the same value as
+   *   [Product.id][google.cloud.retail.v2.Product.id].
+   * * `variant`: You can only ingest
+   * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+   * [Product][google.cloud.retail.v2.Product]s.
+   *   This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   cannot be empty.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `variant` and
+   * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+   * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string ingestion_product_type = 1; + * + * @return The ingestionProductType. + */ + @java.lang.Override + public java.lang.String getIngestionProductType() { + java.lang.Object ref = ingestionProductType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + ingestionProductType_ = s; + return s; + } + } + /** + * + * + *
+   * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+   * ingested into the catalog. Acceptable values are:
+   * * `primary` (default): You can only ingest
+   * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   *   [Product][google.cloud.retail.v2.Product]s. This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   can only be empty or set to the same value as
+   *   [Product.id][google.cloud.retail.v2.Product.id].
+   * * `variant`: You can only ingest
+   * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+   * [Product][google.cloud.retail.v2.Product]s.
+   *   This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   cannot be empty.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `variant` and
+   * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+   * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string ingestion_product_type = 1; + * + * @return The bytes for ingestionProductType. + */ + @java.lang.Override + public com.google.protobuf.ByteString getIngestionProductTypeBytes() { + java.lang.Object ref = ingestionProductType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + ingestionProductType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MERCHANT_CENTER_PRODUCT_ID_FIELD_FIELD_NUMBER = 2; + private volatile java.lang.Object merchantCenterProductIdField_; + /** + * + * + *
+   * Which field of [Merchant Center
+   * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+   * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+   * values are:
+   * * `offerId` (default): Import `offerId` as the product ID.
+   * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+   *   API will choose one item from the ones with the same `itemGroupId`, and
+   *   use it to represent the item group.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `itemGroupId` and
+   * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+   * is `variant`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string merchant_center_product_id_field = 2; + * + * @return The merchantCenterProductIdField. + */ + @java.lang.Override + public java.lang.String getMerchantCenterProductIdField() { + java.lang.Object ref = merchantCenterProductIdField_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + merchantCenterProductIdField_ = s; + return s; + } + } + /** + * + * + *
+   * Which field of [Merchant Center
+   * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+   * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+   * values are:
+   * * `offerId` (default): Import `offerId` as the product ID.
+   * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+   *   API will choose one item from the ones with the same `itemGroupId`, and
+   *   use it to represent the item group.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `itemGroupId` and
+   * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+   * is `variant`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string merchant_center_product_id_field = 2; + * + * @return The bytes for merchantCenterProductIdField. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMerchantCenterProductIdFieldBytes() { + java.lang.Object ref = merchantCenterProductIdField_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + merchantCenterProductIdField_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getIngestionProductTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, ingestionProductType_); + } + if (!getMerchantCenterProductIdFieldBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, merchantCenterProductIdField_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getIngestionProductTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, ingestionProductType_); + } + if (!getMerchantCenterProductIdFieldBytes().isEmpty()) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize( + 2, merchantCenterProductIdField_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ProductLevelConfig)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ProductLevelConfig other = + (com.google.cloud.retail.v2.ProductLevelConfig) obj; + + if (!getIngestionProductType().equals(other.getIngestionProductType())) return false; + if (!getMerchantCenterProductIdField().equals(other.getMerchantCenterProductIdField())) + return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + INGESTION_PRODUCT_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getIngestionProductType().hashCode(); + hash = (37 * hash) + MERCHANT_CENTER_PRODUCT_ID_FIELD_FIELD_NUMBER; + hash = (53 * hash) + getMerchantCenterProductIdField().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ProductLevelConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configures what level the product should be uploaded with regards to
+   * how users will be send events and how predictions will be made.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ProductLevelConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ProductLevelConfig) + com.google.cloud.retail.v2.ProductLevelConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_ProductLevelConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_ProductLevelConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ProductLevelConfig.class, + com.google.cloud.retail.v2.ProductLevelConfig.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ProductLevelConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + ingestionProductType_ = ""; + + merchantCenterProductIdField_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_ProductLevelConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductLevelConfig getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ProductLevelConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductLevelConfig build() { + com.google.cloud.retail.v2.ProductLevelConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductLevelConfig buildPartial() { + com.google.cloud.retail.v2.ProductLevelConfig result = + new com.google.cloud.retail.v2.ProductLevelConfig(this); + result.ingestionProductType_ = ingestionProductType_; + result.merchantCenterProductIdField_ = merchantCenterProductIdField_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ProductLevelConfig) { + return mergeFrom((com.google.cloud.retail.v2.ProductLevelConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ProductLevelConfig other) { + if (other == com.google.cloud.retail.v2.ProductLevelConfig.getDefaultInstance()) return this; + if (!other.getIngestionProductType().isEmpty()) { + ingestionProductType_ = other.ingestionProductType_; + onChanged(); + } + if (!other.getMerchantCenterProductIdField().isEmpty()) { + merchantCenterProductIdField_ = other.merchantCenterProductIdField_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ProductLevelConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ProductLevelConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object ingestionProductType_ = ""; + /** + * + * + *
+     * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+     * ingested into the catalog. Acceptable values are:
+     * * `primary` (default): You can only ingest
+     * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     *   [Product][google.cloud.retail.v2.Product]s. This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   can only be empty or set to the same value as
+     *   [Product.id][google.cloud.retail.v2.Product.id].
+     * * `variant`: You can only ingest
+     * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s.
+     *   This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   cannot be empty.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `variant` and
+     * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+     * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string ingestion_product_type = 1; + * + * @return The ingestionProductType. + */ + public java.lang.String getIngestionProductType() { + java.lang.Object ref = ingestionProductType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + ingestionProductType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+     * ingested into the catalog. Acceptable values are:
+     * * `primary` (default): You can only ingest
+     * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     *   [Product][google.cloud.retail.v2.Product]s. This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   can only be empty or set to the same value as
+     *   [Product.id][google.cloud.retail.v2.Product.id].
+     * * `variant`: You can only ingest
+     * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s.
+     *   This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   cannot be empty.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `variant` and
+     * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+     * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string ingestion_product_type = 1; + * + * @return The bytes for ingestionProductType. + */ + public com.google.protobuf.ByteString getIngestionProductTypeBytes() { + java.lang.Object ref = ingestionProductType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + ingestionProductType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+     * ingested into the catalog. Acceptable values are:
+     * * `primary` (default): You can only ingest
+     * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     *   [Product][google.cloud.retail.v2.Product]s. This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   can only be empty or set to the same value as
+     *   [Product.id][google.cloud.retail.v2.Product.id].
+     * * `variant`: You can only ingest
+     * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s.
+     *   This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   cannot be empty.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `variant` and
+     * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+     * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string ingestion_product_type = 1; + * + * @param value The ingestionProductType to set. + * @return This builder for chaining. + */ + public Builder setIngestionProductType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + ingestionProductType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+     * ingested into the catalog. Acceptable values are:
+     * * `primary` (default): You can only ingest
+     * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     *   [Product][google.cloud.retail.v2.Product]s. This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   can only be empty or set to the same value as
+     *   [Product.id][google.cloud.retail.v2.Product.id].
+     * * `variant`: You can only ingest
+     * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s.
+     *   This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   cannot be empty.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `variant` and
+     * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+     * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string ingestion_product_type = 1; + * + * @return This builder for chaining. + */ + public Builder clearIngestionProductType() { + + ingestionProductType_ = getDefaultInstance().getIngestionProductType(); + onChanged(); + return this; + } + /** + * + * + *
+     * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+     * ingested into the catalog. Acceptable values are:
+     * * `primary` (default): You can only ingest
+     * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+     *   [Product][google.cloud.retail.v2.Product]s. This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   can only be empty or set to the same value as
+     *   [Product.id][google.cloud.retail.v2.Product.id].
+     * * `variant`: You can only ingest
+     * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+     * [Product][google.cloud.retail.v2.Product]s.
+     *   This means
+     *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+     *   cannot be empty.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `variant` and
+     * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+     * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string ingestion_product_type = 1; + * + * @param value The bytes for ingestionProductType to set. + * @return This builder for chaining. + */ + public Builder setIngestionProductTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + ingestionProductType_ = value; + onChanged(); + return this; + } + + private java.lang.Object merchantCenterProductIdField_ = ""; + /** + * + * + *
+     * Which field of [Merchant Center
+     * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+     * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+     * values are:
+     * * `offerId` (default): Import `offerId` as the product ID.
+     * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+     *   API will choose one item from the ones with the same `itemGroupId`, and
+     *   use it to represent the item group.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `itemGroupId` and
+     * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+     * is `variant`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string merchant_center_product_id_field = 2; + * + * @return The merchantCenterProductIdField. + */ + public java.lang.String getMerchantCenterProductIdField() { + java.lang.Object ref = merchantCenterProductIdField_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + merchantCenterProductIdField_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Which field of [Merchant Center
+     * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+     * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+     * values are:
+     * * `offerId` (default): Import `offerId` as the product ID.
+     * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+     *   API will choose one item from the ones with the same `itemGroupId`, and
+     *   use it to represent the item group.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `itemGroupId` and
+     * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+     * is `variant`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string merchant_center_product_id_field = 2; + * + * @return The bytes for merchantCenterProductIdField. + */ + public com.google.protobuf.ByteString getMerchantCenterProductIdFieldBytes() { + java.lang.Object ref = merchantCenterProductIdField_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + merchantCenterProductIdField_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Which field of [Merchant Center
+     * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+     * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+     * values are:
+     * * `offerId` (default): Import `offerId` as the product ID.
+     * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+     *   API will choose one item from the ones with the same `itemGroupId`, and
+     *   use it to represent the item group.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `itemGroupId` and
+     * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+     * is `variant`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string merchant_center_product_id_field = 2; + * + * @param value The merchantCenterProductIdField to set. + * @return This builder for chaining. + */ + public Builder setMerchantCenterProductIdField(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + merchantCenterProductIdField_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Which field of [Merchant Center
+     * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+     * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+     * values are:
+     * * `offerId` (default): Import `offerId` as the product ID.
+     * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+     *   API will choose one item from the ones with the same `itemGroupId`, and
+     *   use it to represent the item group.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `itemGroupId` and
+     * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+     * is `variant`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string merchant_center_product_id_field = 2; + * + * @return This builder for chaining. + */ + public Builder clearMerchantCenterProductIdField() { + + merchantCenterProductIdField_ = getDefaultInstance().getMerchantCenterProductIdField(); + onChanged(); + return this; + } + /** + * + * + *
+     * Which field of [Merchant Center
+     * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+     * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+     * values are:
+     * * `offerId` (default): Import `offerId` as the product ID.
+     * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+     *   API will choose one item from the ones with the same `itemGroupId`, and
+     *   use it to represent the item group.
+     * If this field is set to an invalid value other than these, an
+     * INVALID_ARGUMENT error is returned.
+     * If this field is `itemGroupId` and
+     * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+     * is `variant`, an INVALID_ARGUMENT error is returned.
+     * See [Using catalog
+     * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+     * details.
+     * 
+ * + * string merchant_center_product_id_field = 2; + * + * @param value The bytes for merchantCenterProductIdField to set. + * @return This builder for chaining. + */ + public Builder setMerchantCenterProductIdFieldBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + merchantCenterProductIdField_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ProductLevelConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ProductLevelConfig) + private static final com.google.cloud.retail.v2.ProductLevelConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ProductLevelConfig(); + } + + public static com.google.cloud.retail.v2.ProductLevelConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProductLevelConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProductLevelConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ProductLevelConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductLevelConfigOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductLevelConfigOrBuilder.java new file mode 100644 index 00000000..333d97f0 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductLevelConfigOrBuilder.java @@ -0,0 +1,147 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +public interface ProductLevelConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ProductLevelConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+   * ingested into the catalog. Acceptable values are:
+   * * `primary` (default): You can only ingest
+   * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   *   [Product][google.cloud.retail.v2.Product]s. This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   can only be empty or set to the same value as
+   *   [Product.id][google.cloud.retail.v2.Product.id].
+   * * `variant`: You can only ingest
+   * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+   * [Product][google.cloud.retail.v2.Product]s.
+   *   This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   cannot be empty.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `variant` and
+   * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+   * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string ingestion_product_type = 1; + * + * @return The ingestionProductType. + */ + java.lang.String getIngestionProductType(); + /** + * + * + *
+   * The type of [Product][google.cloud.retail.v2.Product]s allowed to be
+   * ingested into the catalog. Acceptable values are:
+   * * `primary` (default): You can only ingest
+   * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   *   [Product][google.cloud.retail.v2.Product]s. This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   can only be empty or set to the same value as
+   *   [Product.id][google.cloud.retail.v2.Product.id].
+   * * `variant`: You can only ingest
+   * [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
+   * [Product][google.cloud.retail.v2.Product]s.
+   *   This means
+   *   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
+   *   cannot be empty.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `variant` and
+   * [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
+   * is `itemGroupId`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string ingestion_product_type = 1; + * + * @return The bytes for ingestionProductType. + */ + com.google.protobuf.ByteString getIngestionProductTypeBytes(); + + /** + * + * + *
+   * Which field of [Merchant Center
+   * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+   * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+   * values are:
+   * * `offerId` (default): Import `offerId` as the product ID.
+   * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+   *   API will choose one item from the ones with the same `itemGroupId`, and
+   *   use it to represent the item group.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `itemGroupId` and
+   * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+   * is `variant`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string merchant_center_product_id_field = 2; + * + * @return The merchantCenterProductIdField. + */ + java.lang.String getMerchantCenterProductIdField(); + /** + * + * + *
+   * Which field of [Merchant Center
+   * Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
+   * imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
+   * values are:
+   * * `offerId` (default): Import `offerId` as the product ID.
+   * * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
+   *   API will choose one item from the ones with the same `itemGroupId`, and
+   *   use it to represent the item group.
+   * If this field is set to an invalid value other than these, an
+   * INVALID_ARGUMENT error is returned.
+   * If this field is `itemGroupId` and
+   * [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
+   * is `variant`, an INVALID_ARGUMENT error is returned.
+   * See [Using catalog
+   * levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more
+   * details.
+   * 
+ * + * string merchant_center_product_id_field = 2; + * + * @return The bytes for merchantCenterProductIdField. + */ + com.google.protobuf.ByteString getMerchantCenterProductIdFieldBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductName.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductName.java new file mode 100644 index 00000000..7f2594e9 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductName.java @@ -0,0 +1,298 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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.google.cloud.retail.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ProductName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_CATALOG_BRANCH_PRODUCT = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String catalog; + private final String branch; + private final String product; + + @Deprecated + protected ProductName() { + project = null; + location = null; + catalog = null; + branch = null; + product = null; + } + + private ProductName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + catalog = Preconditions.checkNotNull(builder.getCatalog()); + branch = Preconditions.checkNotNull(builder.getBranch()); + product = Preconditions.checkNotNull(builder.getProduct()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getBranch() { + return branch; + } + + public String getProduct() { + return product; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ProductName of( + String project, String location, String catalog, String branch, String product) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setBranch(branch) + .setProduct(product) + .build(); + } + + public static String format( + String project, String location, String catalog, String branch, String product) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setBranch(branch) + .setProduct(product) + .build() + .toString(); + } + + public static ProductName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_CATALOG_BRANCH_PRODUCT.validatedMatch( + formattedString, "ProductName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("catalog"), + matchMap.get("branch"), + matchMap.get("product")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ProductName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_CATALOG_BRANCH_PRODUCT.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (catalog != null) { + fieldMapBuilder.put("catalog", catalog); + } + if (branch != null) { + fieldMapBuilder.put("branch", branch); + } + if (product != null) { + fieldMapBuilder.put("product", product); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_CATALOG_BRANCH_PRODUCT.instantiate( + "project", + project, + "location", + location, + "catalog", + catalog, + "branch", + branch, + "product", + product); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProductName that = ((ProductName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.catalog, that.catalog) + && Objects.equals(this.branch, that.branch) + && Objects.equals(this.product, that.product); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(catalog); + h *= 1000003; + h ^= Objects.hashCode(branch); + h *= 1000003; + h ^= Objects.hashCode(product); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}. + */ + public static class Builder { + private String project; + private String location; + private String catalog; + private String branch; + private String product; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getBranch() { + return branch; + } + + public String getProduct() { + return product; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setCatalog(String catalog) { + this.catalog = catalog; + return this; + } + + public Builder setBranch(String branch) { + this.branch = branch; + return this; + } + + public Builder setProduct(String product) { + this.product = product; + return this; + } + + private Builder(ProductName productName) { + project = productName.project; + location = productName.location; + catalog = productName.catalog; + branch = productName.branch; + product = productName.product; + } + + public ProductName build() { + return new ProductName(this); + } + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductOrBuilder.java new file mode 100644 index 00000000..08ff517b --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductOrBuilder.java @@ -0,0 +1,874 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product.proto + +package com.google.cloud.retail.v2; + +public interface ProductOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Product) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Immutable. Full resource name of the product, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+   * The branch ID must be "default_branch".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Immutable. Full resource name of the product, such as
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id".
+   * The branch ID must be "default_branch".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+   * the final component of [name][google.cloud.retail.v2.Product.name]. For
+   * example, this field is "id_1", if
+   * [name][google.cloud.retail.v2.Product.name] is
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+   * Property [Product.sku](https://schema.org/sku).
+   * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The id. + */ + java.lang.String getId(); + /** + * + * + *
+   * Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
+   * the final component of [name][google.cloud.retail.v2.Product.name]. For
+   * example, this field is "id_1", if
+   * [name][google.cloud.retail.v2.Product.name] is
+   * "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1".
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [id](https://support.google.com/merchants/answer/6324405). Schema.org
+   * Property [Product.sku](https://schema.org/sku).
+   * 
+ * + * string id = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for id. + */ + com.google.protobuf.ByteString getIdBytes(); + + /** + * + * + *
+   * Immutable. The type of the product. This field is output-only.
+   * 
+ * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The enum numeric value on the wire for type. + */ + int getTypeValue(); + /** + * + * + *
+   * Immutable. The type of the product. This field is output-only.
+   * 
+ * + * .google.cloud.retail.v2.Product.Type type = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The type. + */ + com.google.cloud.retail.v2.Product.Type getType(); + + /** + * + * + *
+   * Variant group identifier. Must be an
+   * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+   * this product. Otherwise, an error is thrown.
+   * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+   * set to the same value as [id][google.cloud.retail.v2.Product.id].
+   * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+   * be empty. A maximum of 2,000 products are allowed to share the same
+   * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * Google Merchant Center Property
+   * [item_group_id](https://support.google.com/merchants/answer/6324507).
+   * Schema.org Property
+   * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+   * This field must be enabled before it can be used. [Learn
+   * more](/recommendations-ai/docs/catalog#item-group-id).
+   * 
+ * + * string primary_product_id = 4; + * + * @return The primaryProductId. + */ + java.lang.String getPrimaryProductId(); + /** + * + * + *
+   * Variant group identifier. Must be an
+   * [id][google.cloud.retail.v2.Product.id], with the same parent branch with
+   * this product. Otherwise, an error is thrown.
+   * For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
+   * set to the same value as [id][google.cloud.retail.v2.Product.id].
+   * For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
+   * be empty. A maximum of 2,000 products are allowed to share the same
+   * [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * Google Merchant Center Property
+   * [item_group_id](https://support.google.com/merchants/answer/6324507).
+   * Schema.org Property
+   * [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
+   * This field must be enabled before it can be used. [Learn
+   * more](/recommendations-ai/docs/catalog#item-group-id).
+   * 
+ * + * string primary_product_id = 4; + * + * @return The bytes for primaryProductId. + */ + com.google.protobuf.ByteString getPrimaryProductIdBytes(); + + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @return A list containing the categories. + */ + java.util.List getCategoriesList(); + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @return The count of categories. + */ + int getCategoriesCount(); + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @param index The index of the element to return. + * @return The categories at the given index. + */ + java.lang.String getCategories(int index); + /** + * + * + *
+   * Product categories. This field is repeated for supporting one product
+   * belonging to several parallel categories. Strongly recommended using the
+   * full path for better search / recommendation quality.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * For example, if a shoes product belongs to both
+   * ["Shoes & Accessories" -> "Shoes"] and
+   * ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
+   * represented as:
+   *      "categories": [
+   *        "Shoes & Accessories > Shoes",
+   *        "Sports & Fitness > Athletic Clothing > Shoes"
+   *      ]
+   * Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
+   * [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
+   * error is returned.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. Empty values are not allowed.
+   * Each value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [google_product_category][mc_google_product_category]. Schema.org property
+   * [Product.category] (https://schema.org/category).
+   * [mc_google_product_category]:
+   * https://support.google.com/merchants/answer/6324436
+   * 
+ * + * repeated string categories = 7; + * + * @param index The index of the value to return. + * @return The bytes of the categories at the given index. + */ + com.google.protobuf.ByteString getCategoriesBytes(int index); + + /** + * + * + *
+   * Required. Product title.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+   * property [Product.name](https://schema.org/name).
+   * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The title. + */ + java.lang.String getTitle(); + /** + * + * + *
+   * Required. Product title.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [title](https://support.google.com/merchants/answer/6324415). Schema.org
+   * property [Product.name](https://schema.org/name).
+   * 
+ * + * string title = 8 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for title. + */ + com.google.protobuf.ByteString getTitleBytes(); + + /** + * + * + *
+   * Product description.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [description](https://support.google.com/merchants/answer/6324468).
+   * schema.org property [Product.description](https://schema.org/description).
+   * 
+ * + * string description = 10; + * + * @return The description. + */ + java.lang.String getDescription(); + /** + * + * + *
+   * Product description.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [description](https://support.google.com/merchants/answer/6324468).
+   * schema.org property [Product.description](https://schema.org/description).
+   * 
+ * + * string description = 10; + * + * @return The bytes for description. + */ + com.google.protobuf.ByteString getDescriptionBytes(); + + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + int getAttributesCount(); + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + boolean containsAttributes(java.lang.String key); + /** Use {@link #getAttributesMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAttributes(); + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + java.util.Map getAttributesMap(); + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute defaultValue); + /** + * + * + *
+   * Highly encouraged. Extra product attributes to be included. For example,
+   * for products, this could include the store name, vendor, style, color, etc.
+   * These are very strong signals for recommendation model, thus we highly
+   * recommend providing the attributes here.
+   * Features that can take on one of a limited number of possible values. Two
+   * types of features can be set are:
+   * Textual features. some examples would be the brand/maker of a product, or
+   * country of a customer. Numerical features. Some examples would be the
+   * height/weight of a product, or age of a customer.
+   * For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
+   * "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
+   * }`.
+   * A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT
+   * error is returned.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 12; + */ + com.google.cloud.retail.v2.CustomAttribute getAttributesOrThrow(java.lang.String key); + + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @return A list containing the tags. + */ + java.util.List getTagsList(); + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @return The count of tags. + */ + int getTagsCount(); + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @param index The index of the element to return. + * @return The tags at the given index. + */ + java.lang.String getTags(int index); + /** + * + * + *
+   * Custom tags associated with the product.
+   * At most 250 values are allowed per
+   * [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
+   * encoded string with a length limit of 1,000 characters. Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This tag can be used for filtering recommendation results by passing the
+   * tag as part of the
+   * [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
+   * Google Merchant Center property
+   * [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
+   * 
+ * + * repeated string tags = 13; + * + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + com.google.protobuf.ByteString getTagsBytes(int index); + + /** + * + * + *
+   * Product price and cost information.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371).
+   * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + * + * @return Whether the priceInfo field is set. + */ + boolean hasPriceInfo(); + /** + * + * + *
+   * Product price and cost information.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371).
+   * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + * + * @return The priceInfo. + */ + com.google.cloud.retail.v2.PriceInfo getPriceInfo(); + /** + * + * + *
+   * Product price and cost information.
+   * Google Merchant Center property
+   * [price](https://support.google.com/merchants/answer/6324371).
+   * 
+ * + * .google.cloud.retail.v2.PriceInfo price_info = 14; + */ + com.google.cloud.retail.v2.PriceInfoOrBuilder getPriceInfoOrBuilder(); + + /** + * + * + *
+   * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+   * available recommendation and search.
+   * 
+ * + * .google.protobuf.Timestamp available_time = 18; + * + * @return Whether the availableTime field is set. + */ + boolean hasAvailableTime(); + /** + * + * + *
+   * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+   * available recommendation and search.
+   * 
+ * + * .google.protobuf.Timestamp available_time = 18; + * + * @return The availableTime. + */ + com.google.protobuf.Timestamp getAvailableTime(); + /** + * + * + *
+   * The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
+   * available recommendation and search.
+   * 
+ * + * .google.protobuf.Timestamp available_time = 18; + */ + com.google.protobuf.TimestampOrBuilder getAvailableTimeOrBuilder(); + + /** + * + * + *
+   * The online availability of the [Product][google.cloud.retail.v2.Product].
+   * Default to
+   * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+   * Google Merchant Center Property
+   * [availability](https://support.google.com/merchants/answer/6324448).
+   * Schema.org Property [Offer.availability](https://schema.org/availability).
+   * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @return The enum numeric value on the wire for availability. + */ + int getAvailabilityValue(); + /** + * + * + *
+   * The online availability of the [Product][google.cloud.retail.v2.Product].
+   * Default to
+   * [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
+   * Google Merchant Center Property
+   * [availability](https://support.google.com/merchants/answer/6324448).
+   * Schema.org Property [Offer.availability](https://schema.org/availability).
+   * 
+ * + * .google.cloud.retail.v2.Product.Availability availability = 19; + * + * @return The availability. + */ + com.google.cloud.retail.v2.Product.Availability getAvailability(); + + /** + * + * + *
+   * The available quantity of the item.
+   * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + * + * @return Whether the availableQuantity field is set. + */ + boolean hasAvailableQuantity(); + /** + * + * + *
+   * The available quantity of the item.
+   * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + * + * @return The availableQuantity. + */ + com.google.protobuf.Int32Value getAvailableQuantity(); + /** + * + * + *
+   * The available quantity of the item.
+   * 
+ * + * .google.protobuf.Int32Value available_quantity = 20; + */ + com.google.protobuf.Int32ValueOrBuilder getAvailableQuantityOrBuilder(); + + /** + * + * + *
+   * Canonical URL directly linking to the product detail page.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+   * property [Offer.url](https://schema.org/url).
+   * 
+ * + * string uri = 22; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * Canonical URL directly linking to the product detail page.
+   * This field must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Google Merchant Center property
+   * [link](https://support.google.com/merchants/answer/6324416). Schema.org
+   * property [Offer.url](https://schema.org/url).
+   * 
+ * + * string uri = 22; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + java.util.List getImagesList(); + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + com.google.cloud.retail.v2.Image getImages(int index); + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + int getImagesCount(); + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + java.util.List getImagesOrBuilderList(); + /** + * + * + *
+   * Product images for the product.
+   * A maximum of 300 images are allowed.
+   * Google Merchant Center property
+   * [image_link](https://support.google.com/merchants/answer/6324350).
+   * Schema.org property [Product.image](https://schema.org/image).
+   * 
+ * + * repeated .google.cloud.retail.v2.Image images = 23; + */ + com.google.cloud.retail.v2.ImageOrBuilder getImagesOrBuilder(int index); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductProto.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductProto.java new file mode 100644 index 00000000..55d05752 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductProto.java @@ -0,0 +1,147 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product.proto + +package com.google.cloud.retail.v2; + +public final class ProductProto { + private ProductProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_Product_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_Product_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_Product_AttributesEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_Product_AttributesEntry_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n$google/cloud/retail/v2/product.proto\022\026" + + "google.cloud.retail.v2\032\034google/api/annot" + + "ations.proto\032\037google/api/field_behavior." + + "proto\032\031google/api/resource.proto\032#google" + + "/cloud/retail/v2/common.proto\032 google/pr" + + "otobuf/field_mask.proto\032\037google/protobuf" + + "/timestamp.proto\032\036google/protobuf/wrappe" + + "rs.proto\"\314\007\n\007Product\022\021\n\004name\030\001 \001(\tB\003\340A\005\022" + + "\017\n\002id\030\002 \001(\tB\003\340A\005\0227\n\004type\030\003 \001(\0162$.google." + + "cloud.retail.v2.Product.TypeB\003\340A\005\022\032\n\022pri" + + "mary_product_id\030\004 \001(\t\022\022\n\ncategories\030\007 \003(" + + "\t\022\022\n\005title\030\010 \001(\tB\003\340A\002\022\023\n\013description\030\n \001" + + "(\t\022C\n\nattributes\030\014 \003(\0132/.google.cloud.re" + + "tail.v2.Product.AttributesEntry\022\014\n\004tags\030" + + "\r \003(\t\0225\n\nprice_info\030\016 \001(\0132!.google.cloud" + + ".retail.v2.PriceInfo\0222\n\016available_time\030\022" + + " \001(\0132\032.google.protobuf.Timestamp\022B\n\014avai" + + "lability\030\023 \001(\0162,.google.cloud.retail.v2." + + "Product.Availability\0227\n\022available_quanti" + + "ty\030\024 \001(\0132\033.google.protobuf.Int32Value\022\013\n" + + "\003uri\030\026 \001(\t\022-\n\006images\030\027 \003(\0132\035.google.clou" + + "d.retail.v2.Image\032Z\n\017AttributesEntry\022\013\n\003" + + "key\030\001 \001(\t\0226\n\005value\030\002 \001(\0132\'.google.cloud." + + "retail.v2.CustomAttribute:\0028\001\"F\n\004Type\022\024\n" + + "\020TYPE_UNSPECIFIED\020\000\022\013\n\007PRIMARY\020\001\022\013\n\007VARI" + + "ANT\020\002\022\016\n\nCOLLECTION\020\003\"i\n\014Availability\022\034\n" + + "\030AVAILABILITY_UNSPECIFIED\020\000\022\014\n\010IN_STOCK\020" + + "\001\022\020\n\014OUT_OF_STOCK\020\002\022\014\n\010PREORDER\020\003\022\r\n\tBAC" + + "KORDER\020\004:\204\001\352A\200\001\n\035retail.googleapis.com/P" + + "roduct\022_projects/{project}/locations/{lo" + + "cation}/catalogs/{catalog}/branches/{bra" + + "nch}/products/{product}B\260\002\n\032com.google.c" + + "loud.retail.v2B\014ProductProtoP\001Z + * A transaction represents the entire purchase transaction. + * + * + * Protobuf type {@code google.cloud.retail.v2.PurchaseTransaction} + */ +public final class PurchaseTransaction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PurchaseTransaction) + PurchaseTransactionOrBuilder { + private static final long serialVersionUID = 0L; + // Use PurchaseTransaction.newBuilder() to construct. + private PurchaseTransaction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PurchaseTransaction() { + id_ = ""; + currencyCode_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PurchaseTransaction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PurchaseTransaction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + id_ = s; + break; + } + case 21: + { + revenue_ = input.readFloat(); + break; + } + case 29: + { + tax_ = input.readFloat(); + break; + } + case 37: + { + cost_ = input.readFloat(); + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + currencyCode_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_PurchaseTransaction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_PurchaseTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurchaseTransaction.class, + com.google.cloud.retail.v2.PurchaseTransaction.Builder.class); + } + + public static final int ID_FIELD_NUMBER = 1; + private volatile java.lang.Object id_; + /** + * + * + *
+   * The transaction ID with a length limit of 128 characters.
+   * 
+ * + * string id = 1; + * + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + * + * + *
+   * The transaction ID with a length limit of 128 characters.
+   * 
+ * + * string id = 1; + * + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REVENUE_FIELD_NUMBER = 2; + private float revenue_; + /** + * + * + *
+   * Required. Total non-zero revenue or grand total associated with the
+   * transaction. This value include shipping, tax, or other adjustments to
+   * total revenue that you want to include as part of your revenue
+   * calculations.
+   * 
+ * + * float revenue = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The revenue. + */ + @java.lang.Override + public float getRevenue() { + return revenue_; + } + + public static final int TAX_FIELD_NUMBER = 3; + private float tax_; + /** + * + * + *
+   * All the taxes associated with the transaction.
+   * 
+ * + * float tax = 3; + * + * @return The tax. + */ + @java.lang.Override + public float getTax() { + return tax_; + } + + public static final int COST_FIELD_NUMBER = 4; + private float cost_; + /** + * + * + *
+   * All the costs associated with the products. These can be manufacturing
+   * costs, shipping expenses not borne by the end user, or any other costs,
+   * such that:
+   * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
+   * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
+   * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
+   * 
+ * + * float cost = 4; + * + * @return The cost. + */ + @java.lang.Override + public float getCost() { + return cost_; + } + + public static final int CURRENCY_CODE_FIELD_NUMBER = 5; + private volatile java.lang.Object currencyCode_; + /** + * + * + *
+   * Required. Currency code. Use three-character ISO-4217 code.
+   * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The currencyCode. + */ + @java.lang.Override + public java.lang.String getCurrencyCode() { + java.lang.Object ref = currencyCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + currencyCode_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Currency code. Use three-character ISO-4217 code.
+   * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for currencyCode. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCurrencyCodeBytes() { + java.lang.Object ref = currencyCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + currencyCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_); + } + if (revenue_ != 0F) { + output.writeFloat(2, revenue_); + } + if (tax_ != 0F) { + output.writeFloat(3, tax_); + } + if (cost_ != 0F) { + output.writeFloat(4, cost_); + } + if (!getCurrencyCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, currencyCode_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_); + } + if (revenue_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, revenue_); + } + if (tax_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(3, tax_); + } + if (cost_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, cost_); + } + if (!getCurrencyCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, currencyCode_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PurchaseTransaction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PurchaseTransaction other = + (com.google.cloud.retail.v2.PurchaseTransaction) obj; + + if (!getId().equals(other.getId())) return false; + if (java.lang.Float.floatToIntBits(getRevenue()) + != java.lang.Float.floatToIntBits(other.getRevenue())) return false; + if (java.lang.Float.floatToIntBits(getTax()) != java.lang.Float.floatToIntBits(other.getTax())) + return false; + if (java.lang.Float.floatToIntBits(getCost()) + != java.lang.Float.floatToIntBits(other.getCost())) return false; + if (!getCurrencyCode().equals(other.getCurrencyCode())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + REVENUE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getRevenue()); + hash = (37 * hash) + TAX_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getTax()); + hash = (37 * hash) + COST_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getCost()); + hash = (37 * hash) + CURRENCY_CODE_FIELD_NUMBER; + hash = (53 * hash) + getCurrencyCode().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.PurchaseTransaction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A transaction represents the entire purchase transaction.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PurchaseTransaction} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PurchaseTransaction) + com.google.cloud.retail.v2.PurchaseTransactionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_PurchaseTransaction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_PurchaseTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurchaseTransaction.class, + com.google.cloud.retail.v2.PurchaseTransaction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PurchaseTransaction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + id_ = ""; + + revenue_ = 0F; + + tax_ = 0F; + + cost_ = 0F; + + currencyCode_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_PurchaseTransaction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurchaseTransaction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PurchaseTransaction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurchaseTransaction build() { + com.google.cloud.retail.v2.PurchaseTransaction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurchaseTransaction buildPartial() { + com.google.cloud.retail.v2.PurchaseTransaction result = + new com.google.cloud.retail.v2.PurchaseTransaction(this); + result.id_ = id_; + result.revenue_ = revenue_; + result.tax_ = tax_; + result.cost_ = cost_; + result.currencyCode_ = currencyCode_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PurchaseTransaction) { + return mergeFrom((com.google.cloud.retail.v2.PurchaseTransaction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PurchaseTransaction other) { + if (other == com.google.cloud.retail.v2.PurchaseTransaction.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + onChanged(); + } + if (other.getRevenue() != 0F) { + setRevenue(other.getRevenue()); + } + if (other.getTax() != 0F) { + setTax(other.getTax()); + } + if (other.getCost() != 0F) { + setCost(other.getCost()); + } + if (!other.getCurrencyCode().isEmpty()) { + currencyCode_ = other.currencyCode_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PurchaseTransaction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.PurchaseTransaction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object id_ = ""; + /** + * + * + *
+     * The transaction ID with a length limit of 128 characters.
+     * 
+ * + * string id = 1; + * + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The transaction ID with a length limit of 128 characters.
+     * 
+ * + * string id = 1; + * + * @return The bytes for id. + */ + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The transaction ID with a length limit of 128 characters.
+     * 
+ * + * string id = 1; + * + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + id_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The transaction ID with a length limit of 128 characters.
+     * 
+ * + * string id = 1; + * + * @return This builder for chaining. + */ + public Builder clearId() { + + id_ = getDefaultInstance().getId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The transaction ID with a length limit of 128 characters.
+     * 
+ * + * string id = 1; + * + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + id_ = value; + onChanged(); + return this; + } + + private float revenue_; + /** + * + * + *
+     * Required. Total non-zero revenue or grand total associated with the
+     * transaction. This value include shipping, tax, or other adjustments to
+     * total revenue that you want to include as part of your revenue
+     * calculations.
+     * 
+ * + * float revenue = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The revenue. + */ + @java.lang.Override + public float getRevenue() { + return revenue_; + } + /** + * + * + *
+     * Required. Total non-zero revenue or grand total associated with the
+     * transaction. This value include shipping, tax, or other adjustments to
+     * total revenue that you want to include as part of your revenue
+     * calculations.
+     * 
+ * + * float revenue = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The revenue to set. + * @return This builder for chaining. + */ + public Builder setRevenue(float value) { + + revenue_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Total non-zero revenue or grand total associated with the
+     * transaction. This value include shipping, tax, or other adjustments to
+     * total revenue that you want to include as part of your revenue
+     * calculations.
+     * 
+ * + * float revenue = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearRevenue() { + + revenue_ = 0F; + onChanged(); + return this; + } + + private float tax_; + /** + * + * + *
+     * All the taxes associated with the transaction.
+     * 
+ * + * float tax = 3; + * + * @return The tax. + */ + @java.lang.Override + public float getTax() { + return tax_; + } + /** + * + * + *
+     * All the taxes associated with the transaction.
+     * 
+ * + * float tax = 3; + * + * @param value The tax to set. + * @return This builder for chaining. + */ + public Builder setTax(float value) { + + tax_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * All the taxes associated with the transaction.
+     * 
+ * + * float tax = 3; + * + * @return This builder for chaining. + */ + public Builder clearTax() { + + tax_ = 0F; + onChanged(); + return this; + } + + private float cost_; + /** + * + * + *
+     * All the costs associated with the products. These can be manufacturing
+     * costs, shipping expenses not borne by the end user, or any other costs,
+     * such that:
+     * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
+     * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
+     * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
+     * 
+ * + * float cost = 4; + * + * @return The cost. + */ + @java.lang.Override + public float getCost() { + return cost_; + } + /** + * + * + *
+     * All the costs associated with the products. These can be manufacturing
+     * costs, shipping expenses not borne by the end user, or any other costs,
+     * such that:
+     * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
+     * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
+     * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
+     * 
+ * + * float cost = 4; + * + * @param value The cost to set. + * @return This builder for chaining. + */ + public Builder setCost(float value) { + + cost_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * All the costs associated with the products. These can be manufacturing
+     * costs, shipping expenses not borne by the end user, or any other costs,
+     * such that:
+     * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
+     * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
+     * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
+     * 
+ * + * float cost = 4; + * + * @return This builder for chaining. + */ + public Builder clearCost() { + + cost_ = 0F; + onChanged(); + return this; + } + + private java.lang.Object currencyCode_ = ""; + /** + * + * + *
+     * Required. Currency code. Use three-character ISO-4217 code.
+     * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The currencyCode. + */ + public java.lang.String getCurrencyCode() { + java.lang.Object ref = currencyCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + currencyCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Currency code. Use three-character ISO-4217 code.
+     * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for currencyCode. + */ + public com.google.protobuf.ByteString getCurrencyCodeBytes() { + java.lang.Object ref = currencyCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + currencyCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Currency code. Use three-character ISO-4217 code.
+     * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The currencyCode to set. + * @return This builder for chaining. + */ + public Builder setCurrencyCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + currencyCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Currency code. Use three-character ISO-4217 code.
+     * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearCurrencyCode() { + + currencyCode_ = getDefaultInstance().getCurrencyCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Currency code. Use three-character ISO-4217 code.
+     * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for currencyCode to set. + * @return This builder for chaining. + */ + public Builder setCurrencyCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + currencyCode_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PurchaseTransaction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PurchaseTransaction) + private static final com.google.cloud.retail.v2.PurchaseTransaction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PurchaseTransaction(); + } + + public static com.google.cloud.retail.v2.PurchaseTransaction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PurchaseTransaction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PurchaseTransaction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurchaseTransaction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurchaseTransactionOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurchaseTransactionOrBuilder.java new file mode 100644 index 00000000..efe6341b --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurchaseTransactionOrBuilder.java @@ -0,0 +1,122 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event.proto + +package com.google.cloud.retail.v2; + +public interface PurchaseTransactionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PurchaseTransaction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The transaction ID with a length limit of 128 characters.
+   * 
+ * + * string id = 1; + * + * @return The id. + */ + java.lang.String getId(); + /** + * + * + *
+   * The transaction ID with a length limit of 128 characters.
+   * 
+ * + * string id = 1; + * + * @return The bytes for id. + */ + com.google.protobuf.ByteString getIdBytes(); + + /** + * + * + *
+   * Required. Total non-zero revenue or grand total associated with the
+   * transaction. This value include shipping, tax, or other adjustments to
+   * total revenue that you want to include as part of your revenue
+   * calculations.
+   * 
+ * + * float revenue = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The revenue. + */ + float getRevenue(); + + /** + * + * + *
+   * All the taxes associated with the transaction.
+   * 
+ * + * float tax = 3; + * + * @return The tax. + */ + float getTax(); + + /** + * + * + *
+   * All the costs associated with the products. These can be manufacturing
+   * costs, shipping expenses not borne by the end user, or any other costs,
+   * such that:
+   * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
+   * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
+   * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
+   * 
+ * + * float cost = 4; + * + * @return The cost. + */ + float getCost(); + + /** + * + * + *
+   * Required. Currency code. Use three-character ISO-4217 code.
+   * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The currencyCode. + */ + java.lang.String getCurrencyCode(); + /** + * + * + *
+   * Required. Currency code. Use three-character ISO-4217 code.
+   * 
+ * + * string currency_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for currencyCode. + */ + com.google.protobuf.ByteString getCurrencyCodeBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeConfigProto.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeConfigProto.java new file mode 100644 index 00000000..2d2a67ea --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeConfigProto.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/purge_config.proto + +package com.google.cloud.retail.v2; + +public final class PurgeConfigProto { + private PurgeConfigProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PurgeMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PurgeMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PurgeUserEventsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PurgeUserEventsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PurgeUserEventsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PurgeUserEventsResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n)google/cloud/retail/v2/purge_config.pr" + + "oto\022\026google.cloud.retail.v2\032\034google/api/" + + "annotations.proto\032\037google/api/field_beha" + + "vior.proto\"\017\n\rPurgeMetadata\"Q\n\026PurgeUser" + + "EventsRequest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022\023\n\006fi" + + "lter\030\002 \001(\tB\003\340A\002\022\r\n\005force\030\003 \001(\010\"6\n\027PurgeU" + + "serEventsResponse\022\033\n\023purged_events_count" + + "\030\001 \001(\003B\305\001\n\032com.google.cloud.retail.v2B\020P" + + "urgeConfigProtoP\001Z + * Metadata related to the progress of the Purge operation. + * This will be returned by the google.longrunning.Operation.metadata field. + * + * + * Protobuf type {@code google.cloud.retail.v2.PurgeMetadata} + */ +public final class PurgeMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PurgeMetadata) + PurgeMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use PurgeMetadata.newBuilder() to construct. + private PurgeMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PurgeMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PurgeMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PurgeMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurgeMetadata.class, + com.google.cloud.retail.v2.PurgeMetadata.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PurgeMetadata)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PurgeMetadata other = (com.google.cloud.retail.v2.PurgeMetadata) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.PurgeMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata related to the progress of the Purge operation.
+   * This will be returned by the google.longrunning.Operation.metadata field.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PurgeMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PurgeMetadata) + com.google.cloud.retail.v2.PurgeMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurgeMetadata.class, + com.google.cloud.retail.v2.PurgeMetadata.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PurgeMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeMetadata getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PurgeMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeMetadata build() { + com.google.cloud.retail.v2.PurgeMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeMetadata buildPartial() { + com.google.cloud.retail.v2.PurgeMetadata result = + new com.google.cloud.retail.v2.PurgeMetadata(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PurgeMetadata) { + return mergeFrom((com.google.cloud.retail.v2.PurgeMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PurgeMetadata other) { + if (other == com.google.cloud.retail.v2.PurgeMetadata.getDefaultInstance()) return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PurgeMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.PurgeMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PurgeMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PurgeMetadata) + private static final com.google.cloud.retail.v2.PurgeMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PurgeMetadata(); + } + + public static com.google.cloud.retail.v2.PurgeMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PurgeMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PurgeMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeMetadataOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeMetadataOrBuilder.java new file mode 100644 index 00000000..e9635670 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeMetadataOrBuilder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/purge_config.proto + +package com.google.cloud.retail.v2; + +public interface PurgeMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PurgeMetadata) + com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsRequest.java new file mode 100644 index 00000000..3dc4d338 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsRequest.java @@ -0,0 +1,1053 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/purge_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for PurgeUserEvents method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PurgeUserEventsRequest} + */ +public final class PurgeUserEventsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PurgeUserEventsRequest) + PurgeUserEventsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use PurgeUserEventsRequest.newBuilder() to construct. + private PurgeUserEventsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PurgeUserEventsRequest() { + parent_ = ""; + filter_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PurgeUserEventsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PurgeUserEventsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + case 24: + { + force_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurgeUserEventsRequest.class, + com.google.cloud.retail.v2.PurgeUserEventsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The resource name of the catalog under which the events are
+   * created. The format is
+   * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the catalog under which the events are
+   * created. The format is
+   * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 2; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Required. The filter string to specify the events to be deleted with a
+   * length limit of 5,000 characters. Empty string filter is not allowed. The
+   * eligible fields for filtering are:
+   * * `eventType`: Double quoted
+   * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+   * * `eventTime`: in ISO 8601 "zulu" format.
+   * * `visitorId`: Double quoted string. Specifying this will delete all
+   *   events associated with a visitor.
+   * * `userId`: Double quoted string. Specifying this will delete all events
+   *   associated with a user.
+   * Examples:
+   * * Deleting all events in a time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z"
+   *   eventTime < "2012-04-23T18:30:43.511Z"`
+   * * Deleting specific eventType in time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+   * * Deleting all events for a specific visitor:
+   *   `visitorId = "visitor1024"`
+   * The filtering fields are assumed to have an implicit AND.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The filter string to specify the events to be deleted with a
+   * length limit of 5,000 characters. Empty string filter is not allowed. The
+   * eligible fields for filtering are:
+   * * `eventType`: Double quoted
+   * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+   * * `eventTime`: in ISO 8601 "zulu" format.
+   * * `visitorId`: Double quoted string. Specifying this will delete all
+   *   events associated with a visitor.
+   * * `userId`: Double quoted string. Specifying this will delete all events
+   *   associated with a user.
+   * Examples:
+   * * Deleting all events in a time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z"
+   *   eventTime < "2012-04-23T18:30:43.511Z"`
+   * * Deleting specific eventType in time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+   * * Deleting all events for a specific visitor:
+   *   `visitorId = "visitor1024"`
+   * The filtering fields are assumed to have an implicit AND.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FORCE_FIELD_NUMBER = 3; + private boolean force_; + /** + * + * + *
+   * Actually perform the purge.
+   * If `force` is set to false, the method will return the expected purge count
+   * without deleting any user events.
+   * 
+ * + * bool force = 3; + * + * @return The force. + */ + @java.lang.Override + public boolean getForce() { + return force_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!getFilterBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); + } + if (force_ != false) { + output.writeBool(3, force_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!getFilterBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_); + } + if (force_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, force_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PurgeUserEventsRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PurgeUserEventsRequest other = + (com.google.cloud.retail.v2.PurgeUserEventsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (getForce() != other.getForce()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (37 * hash) + FORCE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getForce()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.PurgeUserEventsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for PurgeUserEvents method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PurgeUserEventsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PurgeUserEventsRequest) + com.google.cloud.retail.v2.PurgeUserEventsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurgeUserEventsRequest.class, + com.google.cloud.retail.v2.PurgeUserEventsRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PurgeUserEventsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + filter_ = ""; + + force_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PurgeUserEventsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsRequest build() { + com.google.cloud.retail.v2.PurgeUserEventsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsRequest buildPartial() { + com.google.cloud.retail.v2.PurgeUserEventsRequest result = + new com.google.cloud.retail.v2.PurgeUserEventsRequest(this); + result.parent_ = parent_; + result.filter_ = filter_; + result.force_ = force_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PurgeUserEventsRequest) { + return mergeFrom((com.google.cloud.retail.v2.PurgeUserEventsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PurgeUserEventsRequest other) { + if (other == com.google.cloud.retail.v2.PurgeUserEventsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + if (other.getForce() != false) { + setForce(other.getForce()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PurgeUserEventsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.PurgeUserEventsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The resource name of the catalog under which the events are
+     * created. The format is
+     * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the catalog under which the events are
+     * created. The format is
+     * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the catalog under which the events are
+     * created. The format is
+     * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the catalog under which the events are
+     * created. The format is
+     * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the catalog under which the events are
+     * created. The format is
+     * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Required. The filter string to specify the events to be deleted with a
+     * length limit of 5,000 characters. Empty string filter is not allowed. The
+     * eligible fields for filtering are:
+     * * `eventType`: Double quoted
+     * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+     * * `eventTime`: in ISO 8601 "zulu" format.
+     * * `visitorId`: Double quoted string. Specifying this will delete all
+     *   events associated with a visitor.
+     * * `userId`: Double quoted string. Specifying this will delete all events
+     *   associated with a user.
+     * Examples:
+     * * Deleting all events in a time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z"
+     *   eventTime < "2012-04-23T18:30:43.511Z"`
+     * * Deleting specific eventType in time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+     * * Deleting all events for a specific visitor:
+     *   `visitorId = "visitor1024"`
+     * The filtering fields are assumed to have an implicit AND.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The filter string to specify the events to be deleted with a
+     * length limit of 5,000 characters. Empty string filter is not allowed. The
+     * eligible fields for filtering are:
+     * * `eventType`: Double quoted
+     * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+     * * `eventTime`: in ISO 8601 "zulu" format.
+     * * `visitorId`: Double quoted string. Specifying this will delete all
+     *   events associated with a visitor.
+     * * `userId`: Double quoted string. Specifying this will delete all events
+     *   associated with a user.
+     * Examples:
+     * * Deleting all events in a time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z"
+     *   eventTime < "2012-04-23T18:30:43.511Z"`
+     * * Deleting specific eventType in time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+     * * Deleting all events for a specific visitor:
+     *   `visitorId = "visitor1024"`
+     * The filtering fields are assumed to have an implicit AND.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The filter string to specify the events to be deleted with a
+     * length limit of 5,000 characters. Empty string filter is not allowed. The
+     * eligible fields for filtering are:
+     * * `eventType`: Double quoted
+     * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+     * * `eventTime`: in ISO 8601 "zulu" format.
+     * * `visitorId`: Double quoted string. Specifying this will delete all
+     *   events associated with a visitor.
+     * * `userId`: Double quoted string. Specifying this will delete all events
+     *   associated with a user.
+     * Examples:
+     * * Deleting all events in a time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z"
+     *   eventTime < "2012-04-23T18:30:43.511Z"`
+     * * Deleting specific eventType in time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+     * * Deleting all events for a specific visitor:
+     *   `visitorId = "visitor1024"`
+     * The filtering fields are assumed to have an implicit AND.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The filter string to specify the events to be deleted with a
+     * length limit of 5,000 characters. Empty string filter is not allowed. The
+     * eligible fields for filtering are:
+     * * `eventType`: Double quoted
+     * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+     * * `eventTime`: in ISO 8601 "zulu" format.
+     * * `visitorId`: Double quoted string. Specifying this will delete all
+     *   events associated with a visitor.
+     * * `userId`: Double quoted string. Specifying this will delete all events
+     *   associated with a user.
+     * Examples:
+     * * Deleting all events in a time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z"
+     *   eventTime < "2012-04-23T18:30:43.511Z"`
+     * * Deleting specific eventType in time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+     * * Deleting all events for a specific visitor:
+     *   `visitorId = "visitor1024"`
+     * The filtering fields are assumed to have an implicit AND.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The filter string to specify the events to be deleted with a
+     * length limit of 5,000 characters. Empty string filter is not allowed. The
+     * eligible fields for filtering are:
+     * * `eventType`: Double quoted
+     * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+     * * `eventTime`: in ISO 8601 "zulu" format.
+     * * `visitorId`: Double quoted string. Specifying this will delete all
+     *   events associated with a visitor.
+     * * `userId`: Double quoted string. Specifying this will delete all events
+     *   associated with a user.
+     * Examples:
+     * * Deleting all events in a time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z"
+     *   eventTime < "2012-04-23T18:30:43.511Z"`
+     * * Deleting specific eventType in time range:
+     *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+     * * Deleting all events for a specific visitor:
+     *   `visitorId = "visitor1024"`
+     * The filtering fields are assumed to have an implicit AND.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + private boolean force_; + /** + * + * + *
+     * Actually perform the purge.
+     * If `force` is set to false, the method will return the expected purge count
+     * without deleting any user events.
+     * 
+ * + * bool force = 3; + * + * @return The force. + */ + @java.lang.Override + public boolean getForce() { + return force_; + } + /** + * + * + *
+     * Actually perform the purge.
+     * If `force` is set to false, the method will return the expected purge count
+     * without deleting any user events.
+     * 
+ * + * bool force = 3; + * + * @param value The force to set. + * @return This builder for chaining. + */ + public Builder setForce(boolean value) { + + force_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Actually perform the purge.
+     * If `force` is set to false, the method will return the expected purge count
+     * without deleting any user events.
+     * 
+ * + * bool force = 3; + * + * @return This builder for chaining. + */ + public Builder clearForce() { + + force_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PurgeUserEventsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PurgeUserEventsRequest) + private static final com.google.cloud.retail.v2.PurgeUserEventsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PurgeUserEventsRequest(); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PurgeUserEventsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PurgeUserEventsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsRequestOrBuilder.java new file mode 100644 index 00000000..c1df01e5 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsRequestOrBuilder.java @@ -0,0 +1,130 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/purge_config.proto + +package com.google.cloud.retail.v2; + +public interface PurgeUserEventsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PurgeUserEventsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the catalog under which the events are
+   * created. The format is
+   * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The resource name of the catalog under which the events are
+   * created. The format is
+   * "projects/${projectId}/locations/global/catalogs/${catalogId}"
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The filter string to specify the events to be deleted with a
+   * length limit of 5,000 characters. Empty string filter is not allowed. The
+   * eligible fields for filtering are:
+   * * `eventType`: Double quoted
+   * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+   * * `eventTime`: in ISO 8601 "zulu" format.
+   * * `visitorId`: Double quoted string. Specifying this will delete all
+   *   events associated with a visitor.
+   * * `userId`: Double quoted string. Specifying this will delete all events
+   *   associated with a user.
+   * Examples:
+   * * Deleting all events in a time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z"
+   *   eventTime < "2012-04-23T18:30:43.511Z"`
+   * * Deleting specific eventType in time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+   * * Deleting all events for a specific visitor:
+   *   `visitorId = "visitor1024"`
+   * The filtering fields are assumed to have an implicit AND.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Required. The filter string to specify the events to be deleted with a
+   * length limit of 5,000 characters. Empty string filter is not allowed. The
+   * eligible fields for filtering are:
+   * * `eventType`: Double quoted
+   * [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
+   * * `eventTime`: in ISO 8601 "zulu" format.
+   * * `visitorId`: Double quoted string. Specifying this will delete all
+   *   events associated with a visitor.
+   * * `userId`: Double quoted string. Specifying this will delete all events
+   *   associated with a user.
+   * Examples:
+   * * Deleting all events in a time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z"
+   *   eventTime < "2012-04-23T18:30:43.511Z"`
+   * * Deleting specific eventType in time range:
+   *   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
+   * * Deleting all events for a specific visitor:
+   *   `visitorId = "visitor1024"`
+   * The filtering fields are assumed to have an implicit AND.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); + + /** + * + * + *
+   * Actually perform the purge.
+   * If `force` is set to false, the method will return the expected purge count
+   * without deleting any user events.
+   * 
+ * + * bool force = 3; + * + * @return The force. + */ + boolean getForce(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsResponse.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsResponse.java new file mode 100644 index 00000000..296f0b5a --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsResponse.java @@ -0,0 +1,550 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/purge_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response of the PurgeUserEventsRequest. If the long running operation is
+ * successfully done, then this message is returned by the
+ * google.longrunning.Operations.response field.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PurgeUserEventsResponse} + */ +public final class PurgeUserEventsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PurgeUserEventsResponse) + PurgeUserEventsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use PurgeUserEventsResponse.newBuilder() to construct. + private PurgeUserEventsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PurgeUserEventsResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PurgeUserEventsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PurgeUserEventsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + purgedEventsCount_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurgeUserEventsResponse.class, + com.google.cloud.retail.v2.PurgeUserEventsResponse.Builder.class); + } + + public static final int PURGED_EVENTS_COUNT_FIELD_NUMBER = 1; + private long purgedEventsCount_; + /** + * + * + *
+   * The total count of events purged as a result of the operation.
+   * 
+ * + * int64 purged_events_count = 1; + * + * @return The purgedEventsCount. + */ + @java.lang.Override + public long getPurgedEventsCount() { + return purgedEventsCount_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (purgedEventsCount_ != 0L) { + output.writeInt64(1, purgedEventsCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (purgedEventsCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, purgedEventsCount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.PurgeUserEventsResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.PurgeUserEventsResponse other = + (com.google.cloud.retail.v2.PurgeUserEventsResponse) obj; + + if (getPurgedEventsCount() != other.getPurgedEventsCount()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PURGED_EVENTS_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getPurgedEventsCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.PurgeUserEventsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response of the PurgeUserEventsRequest. If the long running operation is
+   * successfully done, then this message is returned by the
+   * google.longrunning.Operations.response field.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.PurgeUserEventsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PurgeUserEventsResponse) + com.google.cloud.retail.v2.PurgeUserEventsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.PurgeUserEventsResponse.class, + com.google.cloud.retail.v2.PurgeUserEventsResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.PurgeUserEventsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + purgedEventsCount_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.PurgeConfigProto + .internal_static_google_cloud_retail_v2_PurgeUserEventsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.PurgeUserEventsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsResponse build() { + com.google.cloud.retail.v2.PurgeUserEventsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsResponse buildPartial() { + com.google.cloud.retail.v2.PurgeUserEventsResponse result = + new com.google.cloud.retail.v2.PurgeUserEventsResponse(this); + result.purgedEventsCount_ = purgedEventsCount_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.PurgeUserEventsResponse) { + return mergeFrom((com.google.cloud.retail.v2.PurgeUserEventsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.PurgeUserEventsResponse other) { + if (other == com.google.cloud.retail.v2.PurgeUserEventsResponse.getDefaultInstance()) + return this; + if (other.getPurgedEventsCount() != 0L) { + setPurgedEventsCount(other.getPurgedEventsCount()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.PurgeUserEventsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.PurgeUserEventsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long purgedEventsCount_; + /** + * + * + *
+     * The total count of events purged as a result of the operation.
+     * 
+ * + * int64 purged_events_count = 1; + * + * @return The purgedEventsCount. + */ + @java.lang.Override + public long getPurgedEventsCount() { + return purgedEventsCount_; + } + /** + * + * + *
+     * The total count of events purged as a result of the operation.
+     * 
+ * + * int64 purged_events_count = 1; + * + * @param value The purgedEventsCount to set. + * @return This builder for chaining. + */ + public Builder setPurgedEventsCount(long value) { + + purgedEventsCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The total count of events purged as a result of the operation.
+     * 
+ * + * int64 purged_events_count = 1; + * + * @return This builder for chaining. + */ + public Builder clearPurgedEventsCount() { + + purgedEventsCount_ = 0L; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PurgeUserEventsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PurgeUserEventsResponse) + private static final com.google.cloud.retail.v2.PurgeUserEventsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PurgeUserEventsResponse(); + } + + public static com.google.cloud.retail.v2.PurgeUserEventsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PurgeUserEventsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PurgeUserEventsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.PurgeUserEventsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsResponseOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsResponseOrBuilder.java new file mode 100644 index 00000000..7a72eaf9 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/PurgeUserEventsResponseOrBuilder.java @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/purge_config.proto + +package com.google.cloud.retail.v2; + +public interface PurgeUserEventsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PurgeUserEventsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The total count of events purged as a result of the operation.
+   * 
+ * + * int64 purged_events_count = 1; + * + * @return The purgedEventsCount. + */ + long getPurgedEventsCount(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsMetadata.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsMetadata.java new file mode 100644 index 00000000..a1e50aba --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsMetadata.java @@ -0,0 +1,456 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Metadata for RejoinUserEvents method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RejoinUserEventsMetadata} + */ +public final class RejoinUserEventsMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.RejoinUserEventsMetadata) + RejoinUserEventsMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use RejoinUserEventsMetadata.newBuilder() to construct. + private RejoinUserEventsMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RejoinUserEventsMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RejoinUserEventsMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RejoinUserEventsMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RejoinUserEventsMetadata.class, + com.google.cloud.retail.v2.RejoinUserEventsMetadata.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.RejoinUserEventsMetadata)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.RejoinUserEventsMetadata other = + (com.google.cloud.retail.v2.RejoinUserEventsMetadata) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.RejoinUserEventsMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata for RejoinUserEvents method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RejoinUserEventsMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.RejoinUserEventsMetadata) + com.google.cloud.retail.v2.RejoinUserEventsMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RejoinUserEventsMetadata.class, + com.google.cloud.retail.v2.RejoinUserEventsMetadata.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.RejoinUserEventsMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsMetadata getDefaultInstanceForType() { + return com.google.cloud.retail.v2.RejoinUserEventsMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsMetadata build() { + com.google.cloud.retail.v2.RejoinUserEventsMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsMetadata buildPartial() { + com.google.cloud.retail.v2.RejoinUserEventsMetadata result = + new com.google.cloud.retail.v2.RejoinUserEventsMetadata(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.RejoinUserEventsMetadata) { + return mergeFrom((com.google.cloud.retail.v2.RejoinUserEventsMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.RejoinUserEventsMetadata other) { + if (other == com.google.cloud.retail.v2.RejoinUserEventsMetadata.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.RejoinUserEventsMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.RejoinUserEventsMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.RejoinUserEventsMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.RejoinUserEventsMetadata) + private static final com.google.cloud.retail.v2.RejoinUserEventsMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.RejoinUserEventsMetadata(); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RejoinUserEventsMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RejoinUserEventsMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsMetadataOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsMetadataOrBuilder.java new file mode 100644 index 00000000..feb2c632 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsMetadataOrBuilder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +public interface RejoinUserEventsMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.RejoinUserEventsMetadata) + com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsRequest.java new file mode 100644 index 00000000..ebc79962 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsRequest.java @@ -0,0 +1,1013 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for RejoinUserEvents method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RejoinUserEventsRequest} + */ +public final class RejoinUserEventsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.RejoinUserEventsRequest) + RejoinUserEventsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use RejoinUserEventsRequest.newBuilder() to construct. + private RejoinUserEventsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RejoinUserEventsRequest() { + parent_ = ""; + userEventRejoinScope_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RejoinUserEventsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RejoinUserEventsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + int rawValue = input.readEnum(); + + userEventRejoinScope_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RejoinUserEventsRequest.class, + com.google.cloud.retail.v2.RejoinUserEventsRequest.Builder.class); + } + + /** + * + * + *
+   * The scope of user events to be rejoined with the latest product catalog.
+   * If the rejoining aims at reducing number of unjoined events, set
+   * UserEventRejoinScope to UNJOINED_EVENTS.
+   * If the rejoining aims at correcting product catalog information in joined
+   * events, set UserEventRejoinScope to JOINED_EVENTS.
+   * If all events needs to be rejoined, set UserEventRejoinScope to
+   * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED.
+   * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} + */ + public enum UserEventRejoinScope implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Rejoin all events with the latest product catalog, including both joined
+     * events and unjoined events.
+     * 
+ * + * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0; + */ + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED(0), + /** + * + * + *
+     * Only rejoin joined events with the latest product catalog.
+     * 
+ * + * JOINED_EVENTS = 1; + */ + JOINED_EVENTS(1), + /** + * + * + *
+     * Only rejoin unjoined events with the latest product catalog.
+     * 
+ * + * UNJOINED_EVENTS = 2; + */ + UNJOINED_EVENTS(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Rejoin all events with the latest product catalog, including both joined
+     * events and unjoined events.
+     * 
+ * + * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0; + */ + public static final int USER_EVENT_REJOIN_SCOPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Only rejoin joined events with the latest product catalog.
+     * 
+ * + * JOINED_EVENTS = 1; + */ + public static final int JOINED_EVENTS_VALUE = 1; + /** + * + * + *
+     * Only rejoin unjoined events with the latest product catalog.
+     * 
+ * + * UNJOINED_EVENTS = 2; + */ + public static final int UNJOINED_EVENTS_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static UserEventRejoinScope valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static UserEventRejoinScope forNumber(int value) { + switch (value) { + case 0: + return USER_EVENT_REJOIN_SCOPE_UNSPECIFIED; + case 1: + return JOINED_EVENTS; + case 2: + return UNJOINED_EVENTS; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public UserEventRejoinScope findValueByNumber(int number) { + return UserEventRejoinScope.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.RejoinUserEventsRequest.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final UserEventRejoinScope[] VALUES = values(); + + public static UserEventRejoinScope valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private UserEventRejoinScope(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope) + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USER_EVENT_REJOIN_SCOPE_FIELD_NUMBER = 2; + private int userEventRejoinScope_; + /** + * + * + *
+   * The type of the user event rejoin to define the scope and range of the user
+   * events to be rejoined with the latest product catalog. Defaults to
+   * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+   * invalid integer value.
+   * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @return The enum numeric value on the wire for userEventRejoinScope. + */ + @java.lang.Override + public int getUserEventRejoinScopeValue() { + return userEventRejoinScope_; + } + /** + * + * + *
+   * The type of the user event rejoin to define the scope and range of the user
+   * events to be rejoined with the latest product catalog. Defaults to
+   * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+   * invalid integer value.
+   * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @return The userEventRejoinScope. + */ + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope + getUserEventRejoinScope() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope result = + com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope.valueOf( + userEventRejoinScope_); + return result == null + ? com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (userEventRejoinScope_ + != com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope + .USER_EVENT_REJOIN_SCOPE_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, userEventRejoinScope_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (userEventRejoinScope_ + != com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope + .USER_EVENT_REJOIN_SCOPE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, userEventRejoinScope_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.RejoinUserEventsRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.RejoinUserEventsRequest other = + (com.google.cloud.retail.v2.RejoinUserEventsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (userEventRejoinScope_ != other.userEventRejoinScope_) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + USER_EVENT_REJOIN_SCOPE_FIELD_NUMBER; + hash = (53 * hash) + userEventRejoinScope_; + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.RejoinUserEventsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for RejoinUserEvents method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RejoinUserEventsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.RejoinUserEventsRequest) + com.google.cloud.retail.v2.RejoinUserEventsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RejoinUserEventsRequest.class, + com.google.cloud.retail.v2.RejoinUserEventsRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.RejoinUserEventsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + userEventRejoinScope_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.RejoinUserEventsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsRequest build() { + com.google.cloud.retail.v2.RejoinUserEventsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsRequest buildPartial() { + com.google.cloud.retail.v2.RejoinUserEventsRequest result = + new com.google.cloud.retail.v2.RejoinUserEventsRequest(this); + result.parent_ = parent_; + result.userEventRejoinScope_ = userEventRejoinScope_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.RejoinUserEventsRequest) { + return mergeFrom((com.google.cloud.retail.v2.RejoinUserEventsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.RejoinUserEventsRequest other) { + if (other == com.google.cloud.retail.v2.RejoinUserEventsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.userEventRejoinScope_ != 0) { + setUserEventRejoinScopeValue(other.getUserEventRejoinScopeValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.RejoinUserEventsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.RejoinUserEventsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int userEventRejoinScope_ = 0; + /** + * + * + *
+     * The type of the user event rejoin to define the scope and range of the user
+     * events to be rejoined with the latest product catalog. Defaults to
+     * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+     * invalid integer value.
+     * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @return The enum numeric value on the wire for userEventRejoinScope. + */ + @java.lang.Override + public int getUserEventRejoinScopeValue() { + return userEventRejoinScope_; + } + /** + * + * + *
+     * The type of the user event rejoin to define the scope and range of the user
+     * events to be rejoined with the latest product catalog. Defaults to
+     * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+     * invalid integer value.
+     * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @param value The enum numeric value on the wire for userEventRejoinScope to set. + * @return This builder for chaining. + */ + public Builder setUserEventRejoinScopeValue(int value) { + + userEventRejoinScope_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The type of the user event rejoin to define the scope and range of the user
+     * events to be rejoined with the latest product catalog. Defaults to
+     * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+     * invalid integer value.
+     * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @return The userEventRejoinScope. + */ + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope + getUserEventRejoinScope() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope result = + com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope.valueOf( + userEventRejoinScope_); + return result == null + ? com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The type of the user event rejoin to define the scope and range of the user
+     * events to be rejoined with the latest product catalog. Defaults to
+     * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+     * invalid integer value.
+     * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @param value The userEventRejoinScope to set. + * @return This builder for chaining. + */ + public Builder setUserEventRejoinScope( + com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope value) { + if (value == null) { + throw new NullPointerException(); + } + + userEventRejoinScope_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The type of the user event rejoin to define the scope and range of the user
+     * events to be rejoined with the latest product catalog. Defaults to
+     * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+     * invalid integer value.
+     * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @return This builder for chaining. + */ + public Builder clearUserEventRejoinScope() { + + userEventRejoinScope_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.RejoinUserEventsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.RejoinUserEventsRequest) + private static final com.google.cloud.retail.v2.RejoinUserEventsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.RejoinUserEventsRequest(); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RejoinUserEventsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RejoinUserEventsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsRequestOrBuilder.java new file mode 100644 index 00000000..8d829165 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsRequestOrBuilder.java @@ -0,0 +1,87 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +public interface RejoinUserEventsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.RejoinUserEventsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The type of the user event rejoin to define the scope and range of the user
+   * events to be rejoined with the latest product catalog. Defaults to
+   * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+   * invalid integer value.
+   * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @return The enum numeric value on the wire for userEventRejoinScope. + */ + int getUserEventRejoinScopeValue(); + /** + * + * + *
+   * The type of the user event rejoin to define the scope and range of the user
+   * events to be rejoined with the latest product catalog. Defaults to
+   * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
+   * invalid integer value.
+   * 
+ * + * + * .google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope user_event_rejoin_scope = 2; + * + * + * @return The userEventRejoinScope. + */ + com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope getUserEventRejoinScope(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsResponse.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsResponse.java new file mode 100644 index 00000000..ce4c0f16 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsResponse.java @@ -0,0 +1,546 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response message for RejoinUserEvents method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RejoinUserEventsResponse} + */ +public final class RejoinUserEventsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.RejoinUserEventsResponse) + RejoinUserEventsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use RejoinUserEventsResponse.newBuilder() to construct. + private RejoinUserEventsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RejoinUserEventsResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RejoinUserEventsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RejoinUserEventsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + rejoinedUserEventsCount_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RejoinUserEventsResponse.class, + com.google.cloud.retail.v2.RejoinUserEventsResponse.Builder.class); + } + + public static final int REJOINED_USER_EVENTS_COUNT_FIELD_NUMBER = 1; + private long rejoinedUserEventsCount_; + /** + * + * + *
+   * Number of user events that were joined with latest product catalog.
+   * 
+ * + * int64 rejoined_user_events_count = 1; + * + * @return The rejoinedUserEventsCount. + */ + @java.lang.Override + public long getRejoinedUserEventsCount() { + return rejoinedUserEventsCount_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (rejoinedUserEventsCount_ != 0L) { + output.writeInt64(1, rejoinedUserEventsCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (rejoinedUserEventsCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, rejoinedUserEventsCount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.RejoinUserEventsResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.RejoinUserEventsResponse other = + (com.google.cloud.retail.v2.RejoinUserEventsResponse) obj; + + if (getRejoinedUserEventsCount() != other.getRejoinedUserEventsCount()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + REJOINED_USER_EVENTS_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getRejoinedUserEventsCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.RejoinUserEventsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for RejoinUserEvents method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RejoinUserEventsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.RejoinUserEventsResponse) + com.google.cloud.retail.v2.RejoinUserEventsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RejoinUserEventsResponse.class, + com.google.cloud.retail.v2.RejoinUserEventsResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.RejoinUserEventsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + rejoinedUserEventsCount_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_RejoinUserEventsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.RejoinUserEventsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsResponse build() { + com.google.cloud.retail.v2.RejoinUserEventsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsResponse buildPartial() { + com.google.cloud.retail.v2.RejoinUserEventsResponse result = + new com.google.cloud.retail.v2.RejoinUserEventsResponse(this); + result.rejoinedUserEventsCount_ = rejoinedUserEventsCount_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.RejoinUserEventsResponse) { + return mergeFrom((com.google.cloud.retail.v2.RejoinUserEventsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.RejoinUserEventsResponse other) { + if (other == com.google.cloud.retail.v2.RejoinUserEventsResponse.getDefaultInstance()) + return this; + if (other.getRejoinedUserEventsCount() != 0L) { + setRejoinedUserEventsCount(other.getRejoinedUserEventsCount()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.RejoinUserEventsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.RejoinUserEventsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long rejoinedUserEventsCount_; + /** + * + * + *
+     * Number of user events that were joined with latest product catalog.
+     * 
+ * + * int64 rejoined_user_events_count = 1; + * + * @return The rejoinedUserEventsCount. + */ + @java.lang.Override + public long getRejoinedUserEventsCount() { + return rejoinedUserEventsCount_; + } + /** + * + * + *
+     * Number of user events that were joined with latest product catalog.
+     * 
+ * + * int64 rejoined_user_events_count = 1; + * + * @param value The rejoinedUserEventsCount to set. + * @return This builder for chaining. + */ + public Builder setRejoinedUserEventsCount(long value) { + + rejoinedUserEventsCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of user events that were joined with latest product catalog.
+     * 
+ * + * int64 rejoined_user_events_count = 1; + * + * @return This builder for chaining. + */ + public Builder clearRejoinedUserEventsCount() { + + rejoinedUserEventsCount_ = 0L; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.RejoinUserEventsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.RejoinUserEventsResponse) + private static final com.google.cloud.retail.v2.RejoinUserEventsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.RejoinUserEventsResponse(); + } + + public static com.google.cloud.retail.v2.RejoinUserEventsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RejoinUserEventsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RejoinUserEventsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RejoinUserEventsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsResponseOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsResponseOrBuilder.java new file mode 100644 index 00000000..5b2e5241 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RejoinUserEventsResponseOrBuilder.java @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +public interface RejoinUserEventsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.RejoinUserEventsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Number of user events that were joined with latest product catalog.
+   * 
+ * + * int64 rejoined_user_events_count = 1; + * + * @return The rejoinedUserEventsCount. + */ + long getRejoinedUserEventsCount(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCatalogRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCatalogRequest.java new file mode 100644 index 00000000..3c0e8986 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCatalogRequest.java @@ -0,0 +1,1149 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateCatalogRequest} + */ +public final class UpdateCatalogRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UpdateCatalogRequest) + UpdateCatalogRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateCatalogRequest.newBuilder() to construct. + private UpdateCatalogRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateCatalogRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateCatalogRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateCatalogRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.Catalog.Builder subBuilder = null; + if (catalog_ != null) { + subBuilder = catalog_.toBuilder(); + } + catalog_ = + input.readMessage(com.google.cloud.retail.v2.Catalog.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(catalog_); + catalog_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCatalogRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCatalogRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateCatalogRequest.class, + com.google.cloud.retail.v2.UpdateCatalogRequest.Builder.class); + } + + public static final int CATALOG_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.Catalog catalog_; + /** + * + * + *
+   * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+   * If the caller does not have permission to update the
+   * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalog field is set. + */ + @java.lang.Override + public boolean hasCatalog() { + return catalog_ != null; + } + /** + * + * + *
+   * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+   * If the caller does not have permission to update the
+   * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalog. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Catalog getCatalog() { + return catalog_ == null ? com.google.cloud.retail.v2.Catalog.getDefaultInstance() : catalog_; + } + /** + * + * + *
+   * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+   * If the caller does not have permission to update the
+   * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogOrBuilder getCatalogOrBuilder() { + return getCatalog(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+   * update the
+   * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+   * field, which is also the only currently supported field to update.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+   * update the
+   * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+   * field, which is also the only currently supported field to update.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+   * update the
+   * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+   * field, which is also the only currently supported field to update.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (catalog_ != null) { + output.writeMessage(1, getCatalog()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (catalog_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCatalog()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UpdateCatalogRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UpdateCatalogRequest other = + (com.google.cloud.retail.v2.UpdateCatalogRequest) obj; + + if (hasCatalog() != other.hasCatalog()) return false; + if (hasCatalog()) { + if (!getCatalog().equals(other.getCatalog())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCatalog()) { + hash = (37 * hash) + CATALOG_FIELD_NUMBER; + hash = (53 * hash) + getCatalog().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UpdateCatalogRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateCatalogRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UpdateCatalogRequest) + com.google.cloud.retail.v2.UpdateCatalogRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCatalogRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCatalogRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateCatalogRequest.class, + com.google.cloud.retail.v2.UpdateCatalogRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UpdateCatalogRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (catalogBuilder_ == null) { + catalog_ = null; + } else { + catalog_ = null; + catalogBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCatalogRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCatalogRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UpdateCatalogRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCatalogRequest build() { + com.google.cloud.retail.v2.UpdateCatalogRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCatalogRequest buildPartial() { + com.google.cloud.retail.v2.UpdateCatalogRequest result = + new com.google.cloud.retail.v2.UpdateCatalogRequest(this); + if (catalogBuilder_ == null) { + result.catalog_ = catalog_; + } else { + result.catalog_ = catalogBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UpdateCatalogRequest) { + return mergeFrom((com.google.cloud.retail.v2.UpdateCatalogRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UpdateCatalogRequest other) { + if (other == com.google.cloud.retail.v2.UpdateCatalogRequest.getDefaultInstance()) + return this; + if (other.hasCatalog()) { + mergeCatalog(other.getCatalog()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UpdateCatalogRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.UpdateCatalogRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.retail.v2.Catalog catalog_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Catalog, + com.google.cloud.retail.v2.Catalog.Builder, + com.google.cloud.retail.v2.CatalogOrBuilder> + catalogBuilder_; + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalog field is set. + */ + public boolean hasCatalog() { + return catalogBuilder_ != null || catalog_ != null; + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalog. + */ + public com.google.cloud.retail.v2.Catalog getCatalog() { + if (catalogBuilder_ == null) { + return catalog_ == null + ? com.google.cloud.retail.v2.Catalog.getDefaultInstance() + : catalog_; + } else { + return catalogBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCatalog(com.google.cloud.retail.v2.Catalog value) { + if (catalogBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + catalog_ = value; + onChanged(); + } else { + catalogBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCatalog(com.google.cloud.retail.v2.Catalog.Builder builderForValue) { + if (catalogBuilder_ == null) { + catalog_ = builderForValue.build(); + onChanged(); + } else { + catalogBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeCatalog(com.google.cloud.retail.v2.Catalog value) { + if (catalogBuilder_ == null) { + if (catalog_ != null) { + catalog_ = + com.google.cloud.retail.v2.Catalog.newBuilder(catalog_) + .mergeFrom(value) + .buildPartial(); + } else { + catalog_ = value; + } + onChanged(); + } else { + catalogBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearCatalog() { + if (catalogBuilder_ == null) { + catalog_ = null; + onChanged(); + } else { + catalog_ = null; + catalogBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Catalog.Builder getCatalogBuilder() { + + onChanged(); + return getCatalogFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.CatalogOrBuilder getCatalogOrBuilder() { + if (catalogBuilder_ != null) { + return catalogBuilder_.getMessageOrBuilder(); + } else { + return catalog_ == null + ? com.google.cloud.retail.v2.Catalog.getDefaultInstance() + : catalog_; + } + } + /** + * + * + *
+     * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+     * If the caller does not have permission to update the
+     * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Catalog, + com.google.cloud.retail.v2.Catalog.Builder, + com.google.cloud.retail.v2.CatalogOrBuilder> + getCatalogFieldBuilder() { + if (catalogBuilder_ == null) { + catalogBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Catalog, + com.google.cloud.retail.v2.Catalog.Builder, + com.google.cloud.retail.v2.CatalogOrBuilder>( + getCatalog(), getParentForChildren(), isClean()); + catalog_ = null; + } + return catalogBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+     * update the
+     * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+     * field, which is also the only currently supported field to update.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UpdateCatalogRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UpdateCatalogRequest) + private static final com.google.cloud.retail.v2.UpdateCatalogRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UpdateCatalogRequest(); + } + + public static com.google.cloud.retail.v2.UpdateCatalogRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateCatalogRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateCatalogRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCatalogRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCatalogRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCatalogRequestOrBuilder.java new file mode 100644 index 00000000..77224b10 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCatalogRequestOrBuilder.java @@ -0,0 +1,131 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface UpdateCatalogRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UpdateCatalogRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+   * If the caller does not have permission to update the
+   * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalog field is set. + */ + boolean hasCatalog(); + /** + * + * + *
+   * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+   * If the caller does not have permission to update the
+   * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalog. + */ + com.google.cloud.retail.v2.Catalog getCatalog(); + /** + * + * + *
+   * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
+   * If the caller does not have permission to update the
+   * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Catalog catalog = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.CatalogOrBuilder getCatalogOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+   * update the
+   * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+   * field, which is also the only currently supported field to update.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+   * update the
+   * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+   * field, which is also the only currently supported field to update.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only
+   * update the
+   * [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config]
+   * field, which is also the only currently supported field to update.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateProductRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateProductRequest.java new file mode 100644 index 00000000..d40dffa6 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateProductRequest.java @@ -0,0 +1,1133 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for [UpdateProduct][] method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateProductRequest} + */ +public final class UpdateProductRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UpdateProductRequest) + UpdateProductRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateProductRequest.newBuilder() to construct. + private UpdateProductRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateProductRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateProductRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateProductRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.Product.Builder subBuilder = null; + if (product_ != null) { + subBuilder = product_.toBuilder(); + } + product_ = + input.readMessage(com.google.cloud.retail.v2.Product.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(product_); + product_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_UpdateProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_UpdateProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateProductRequest.class, + com.google.cloud.retail.v2.UpdateProductRequest.Builder.class); + } + + public static final int PRODUCT_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.Product product_; + /** + * + * + *
+   * Required. The product to update/create.
+   * If the caller does not have permission to update the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + @java.lang.Override + public boolean hasProduct() { + return product_ != null; + } + /** + * + * + *
+   * Required. The product to update/create.
+   * If the caller does not have permission to update the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Product getProduct() { + return product_ == null ? com.google.cloud.retail.v2.Product.getDefaultInstance() : product_; + } + /** + * + * + *
+   * Required. The product to update/create.
+   * If the caller does not have permission to update the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder() { + return getProduct(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+   * output only fields are NOT supported. If not set, all supported fields (the
+   * fields that are neither immutable nor output only) are updated.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+   * output only fields are NOT supported. If not set, all supported fields (the
+   * fields that are neither immutable nor output only) are updated.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+   * output only fields are NOT supported. If not set, all supported fields (the
+   * fields that are neither immutable nor output only) are updated.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (product_ != null) { + output.writeMessage(1, getProduct()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (product_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getProduct()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UpdateProductRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UpdateProductRequest other = + (com.google.cloud.retail.v2.UpdateProductRequest) obj; + + if (hasProduct() != other.hasProduct()) return false; + if (hasProduct()) { + if (!getProduct().equals(other.getProduct())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasProduct()) { + hash = (37 * hash) + PRODUCT_FIELD_NUMBER; + hash = (53 * hash) + getProduct().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UpdateProductRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for [UpdateProduct][] method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateProductRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UpdateProductRequest) + com.google.cloud.retail.v2.UpdateProductRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_UpdateProductRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_UpdateProductRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateProductRequest.class, + com.google.cloud.retail.v2.UpdateProductRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UpdateProductRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (productBuilder_ == null) { + product_ = null; + } else { + product_ = null; + productBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ProductServiceProto + .internal_static_google_cloud_retail_v2_UpdateProductRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateProductRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UpdateProductRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateProductRequest build() { + com.google.cloud.retail.v2.UpdateProductRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateProductRequest buildPartial() { + com.google.cloud.retail.v2.UpdateProductRequest result = + new com.google.cloud.retail.v2.UpdateProductRequest(this); + if (productBuilder_ == null) { + result.product_ = product_; + } else { + result.product_ = productBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UpdateProductRequest) { + return mergeFrom((com.google.cloud.retail.v2.UpdateProductRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UpdateProductRequest other) { + if (other == com.google.cloud.retail.v2.UpdateProductRequest.getDefaultInstance()) + return this; + if (other.hasProduct()) { + mergeProduct(other.getProduct()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UpdateProductRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.UpdateProductRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.retail.v2.Product product_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + productBuilder_; + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + public boolean hasProduct() { + return productBuilder_ != null || product_ != null; + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + public com.google.cloud.retail.v2.Product getProduct() { + if (productBuilder_ == null) { + return product_ == null + ? com.google.cloud.retail.v2.Product.getDefaultInstance() + : product_; + } else { + return productBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProduct(com.google.cloud.retail.v2.Product value) { + if (productBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + product_ = value; + onChanged(); + } else { + productBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setProduct(com.google.cloud.retail.v2.Product.Builder builderForValue) { + if (productBuilder_ == null) { + product_ = builderForValue.build(); + onChanged(); + } else { + productBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeProduct(com.google.cloud.retail.v2.Product value) { + if (productBuilder_ == null) { + if (product_ != null) { + product_ = + com.google.cloud.retail.v2.Product.newBuilder(product_) + .mergeFrom(value) + .buildPartial(); + } else { + product_ = value; + } + onChanged(); + } else { + productBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearProduct() { + if (productBuilder_ == null) { + product_ = null; + onChanged(); + } else { + product_ = null; + productBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Product.Builder getProductBuilder() { + + onChanged(); + return getProductFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder() { + if (productBuilder_ != null) { + return productBuilder_.getMessageOrBuilder(); + } else { + return product_ == null + ? com.google.cloud.retail.v2.Product.getDefaultInstance() + : product_; + } + } + /** + * + * + *
+     * Required. The product to update/create.
+     * If the caller does not have permission to update the
+     * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+     * exists, a PERMISSION_DENIED error is returned.
+     * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder> + getProductFieldBuilder() { + if (productBuilder_ == null) { + productBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Product, + com.google.cloud.retail.v2.Product.Builder, + com.google.cloud.retail.v2.ProductOrBuilder>( + getProduct(), getParentForChildren(), isClean()); + product_ = null; + } + return productBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+     * output only fields are NOT supported. If not set, all supported fields (the
+     * fields that are neither immutable nor output only) are updated.
+     * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+     * is returned.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UpdateProductRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UpdateProductRequest) + private static final com.google.cloud.retail.v2.UpdateProductRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UpdateProductRequest(); + } + + public static com.google.cloud.retail.v2.UpdateProductRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateProductRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateProductRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateProductRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateProductRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateProductRequestOrBuilder.java new file mode 100644 index 00000000..9038e133 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateProductRequestOrBuilder.java @@ -0,0 +1,128 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/product_service.proto + +package com.google.cloud.retail.v2; + +public interface UpdateProductRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UpdateProductRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The product to update/create.
+   * If the caller does not have permission to update the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the product field is set. + */ + boolean hasProduct(); + /** + * + * + *
+   * Required. The product to update/create.
+   * If the caller does not have permission to update the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The product. + */ + com.google.cloud.retail.v2.Product getProduct(); + /** + * + * + *
+   * Required. The product to update/create.
+   * If the caller does not have permission to update the
+   * [Product][google.cloud.retail.v2.Product], regardless of whether or not it
+   * exists, a PERMISSION_DENIED error is returned.
+   * If the [Product][google.cloud.retail.v2.Product] to update does not exist,
+   * a NOT_FOUND error is returned.
+   * 
+ * + * .google.cloud.retail.v2.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ProductOrBuilder getProductOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+   * output only fields are NOT supported. If not set, all supported fields (the
+   * fields that are neither immutable nor output only) are updated.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+   * output only fields are NOT supported. If not set, all supported fields (the
+   * fields that are neither immutable nor output only) are updated.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Product][google.cloud.retail.v2.Product] to update. The immutable and
+   * output only fields are NOT supported. If not set, all supported fields (the
+   * fields that are neither immutable nor output only) are updated.
+   * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
+   * is returned.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEvent.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEvent.java new file mode 100644 index 00000000..d2f4dcbe --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEvent.java @@ -0,0 +1,4953 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * UserEvent captures all metadata information Retail API needs to know about
+ * how end users interact with customers' website.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEvent} + */ +public final class UserEvent extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UserEvent) + UserEventOrBuilder { + private static final long serialVersionUID = 0L; + // Use UserEvent.newBuilder() to construct. + private UserEvent(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UserEvent() { + eventType_ = ""; + visitorId_ = ""; + experimentIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + attributionToken_ = ""; + productDetails_ = java.util.Collections.emptyList(); + cartId_ = ""; + searchQuery_ = ""; + pageCategories_ = com.google.protobuf.LazyStringArrayList.EMPTY; + uri_ = ""; + referrerUri_ = ""; + pageViewId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UserEvent(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UserEvent( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + eventType_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + visitorId_ = s; + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (eventTime_ != null) { + subBuilder = eventTime_.toBuilder(); + } + eventTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(eventTime_); + eventTime_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + experimentIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + experimentIds_.add(s); + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + attributionToken_ = s; + break; + } + case 50: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + productDetails_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + productDetails_.add( + input.readMessage( + com.google.cloud.retail.v2.ProductDetail.parser(), extensionRegistry)); + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + attributes_ = + com.google.protobuf.MapField.newMapField( + AttributesDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000004; + } + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + attributes__ = + input.readMessage( + AttributesDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + attributes_.getMutableMap().put(attributes__.getKey(), attributes__.getValue()); + break; + } + case 66: + { + java.lang.String s = input.readStringRequireUtf8(); + + cartId_ = s; + break; + } + case 74: + { + com.google.cloud.retail.v2.PurchaseTransaction.Builder subBuilder = null; + if (purchaseTransaction_ != null) { + subBuilder = purchaseTransaction_.toBuilder(); + } + purchaseTransaction_ = + input.readMessage( + com.google.cloud.retail.v2.PurchaseTransaction.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(purchaseTransaction_); + purchaseTransaction_ = subBuilder.buildPartial(); + } + + break; + } + case 82: + { + java.lang.String s = input.readStringRequireUtf8(); + + searchQuery_ = s; + break; + } + case 90: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + pageCategories_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000008; + } + pageCategories_.add(s); + break; + } + case 98: + { + com.google.cloud.retail.v2.UserInfo.Builder subBuilder = null; + if (userInfo_ != null) { + subBuilder = userInfo_.toBuilder(); + } + userInfo_ = + input.readMessage( + com.google.cloud.retail.v2.UserInfo.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(userInfo_); + userInfo_ = subBuilder.buildPartial(); + } + + break; + } + case 106: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + case 114: + { + java.lang.String s = input.readStringRequireUtf8(); + + referrerUri_ = s; + break; + } + case 122: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageViewId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + experimentIds_ = experimentIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + productDetails_ = java.util.Collections.unmodifiableList(productDetails_); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + pageCategories_ = pageCategories_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_UserEvent_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_UserEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEvent.class, + com.google.cloud.retail.v2.UserEvent.Builder.class); + } + + public static final int EVENT_TYPE_FIELD_NUMBER = 1; + private volatile java.lang.Object eventType_; + /** + * + * + *
+   * Required. User event type. Allowed values are:
+   * * `add-to-cart`: Products being added to cart.
+   * * `category-page-view`: Special pages such as sale or promotion pages
+   *   viewed.
+   * * `detail-page-view`: Products detail page viewed.
+   * * `home-page-view`: Homepage viewed.
+   * * `purchase-complete`: User finishing a purchase.
+   * * `search`: Product search.
+   * * `shopping-cart-page-view`: User viewing a shopping cart.
+   * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The eventType. + */ + @java.lang.Override + public java.lang.String getEventType() { + java.lang.Object ref = eventType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + eventType_ = s; + return s; + } + } + /** + * + * + *
+   * Required. User event type. Allowed values are:
+   * * `add-to-cart`: Products being added to cart.
+   * * `category-page-view`: Special pages such as sale or promotion pages
+   *   viewed.
+   * * `detail-page-view`: Products detail page viewed.
+   * * `home-page-view`: Homepage viewed.
+   * * `purchase-complete`: User finishing a purchase.
+   * * `search`: Product search.
+   * * `shopping-cart-page-view`: User viewing a shopping cart.
+   * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for eventType. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEventTypeBytes() { + java.lang.Object ref = eventType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + eventType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VISITOR_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object visitorId_; + /** + * + * + *
+   * Required. A unique identifier for tracking visitors.
+   * For example, this could be implemented with an HTTP cookie, which should be
+   * able to uniquely identify a visitor on a single device. This unique
+   * identifier should not change if the visitor log in/out of the website.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The visitorId. + */ + @java.lang.Override + public java.lang.String getVisitorId() { + java.lang.Object ref = visitorId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + visitorId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. A unique identifier for tracking visitors.
+   * For example, this could be implemented with an HTTP cookie, which should be
+   * able to uniquely identify a visitor on a single device. This unique
+   * identifier should not change if the visitor log in/out of the website.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for visitorId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getVisitorIdBytes() { + java.lang.Object ref = visitorId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + visitorId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EVENT_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp eventTime_; + /** + * + * + *
+   * Only required for
+   * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+   * method. Timestamp of when the user event happened.
+   * 
+ * + * .google.protobuf.Timestamp event_time = 3; + * + * @return Whether the eventTime field is set. + */ + @java.lang.Override + public boolean hasEventTime() { + return eventTime_ != null; + } + /** + * + * + *
+   * Only required for
+   * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+   * method. Timestamp of when the user event happened.
+   * 
+ * + * .google.protobuf.Timestamp event_time = 3; + * + * @return The eventTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getEventTime() { + return eventTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : eventTime_; + } + /** + * + * + *
+   * Only required for
+   * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+   * method. Timestamp of when the user event happened.
+   * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getEventTimeOrBuilder() { + return getEventTime(); + } + + public static final int EXPERIMENT_IDS_FIELD_NUMBER = 4; + private com.google.protobuf.LazyStringList experimentIds_; + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @return A list containing the experimentIds. + */ + public com.google.protobuf.ProtocolStringList getExperimentIdsList() { + return experimentIds_; + } + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @return The count of experimentIds. + */ + public int getExperimentIdsCount() { + return experimentIds_.size(); + } + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @param index The index of the element to return. + * @return The experimentIds at the given index. + */ + public java.lang.String getExperimentIds(int index) { + return experimentIds_.get(index); + } + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @param index The index of the value to return. + * @return The bytes of the experimentIds at the given index. + */ + public com.google.protobuf.ByteString getExperimentIdsBytes(int index) { + return experimentIds_.getByteString(index); + } + + public static final int ATTRIBUTION_TOKEN_FIELD_NUMBER = 5; + private volatile java.lang.Object attributionToken_; + /** + * + * + *
+   * Highly recommended for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This field enables accurate attribution of recommendation model
+   * performance.
+   * The value must be a valid
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This token enables us to accurately attribute page view or purchase back to
+   * the event and the particular predict response containing this
+   * clicked/purchased product. If user clicks on product K in the
+   * recommendation results, pass
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * as a URL parameter to product K's page. When recording events on product
+   * K's page, log the
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * to this field.
+   * 
+ * + * string attribution_token = 5; + * + * @return The attributionToken. + */ + @java.lang.Override + public java.lang.String getAttributionToken() { + java.lang.Object ref = attributionToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributionToken_ = s; + return s; + } + } + /** + * + * + *
+   * Highly recommended for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This field enables accurate attribution of recommendation model
+   * performance.
+   * The value must be a valid
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This token enables us to accurately attribute page view or purchase back to
+   * the event and the particular predict response containing this
+   * clicked/purchased product. If user clicks on product K in the
+   * recommendation results, pass
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * as a URL parameter to product K's page. When recording events on product
+   * K's page, log the
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * to this field.
+   * 
+ * + * string attribution_token = 5; + * + * @return The bytes for attributionToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAttributionTokenBytes() { + java.lang.Object ref = attributionToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributionToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PRODUCT_DETAILS_FIELD_NUMBER = 6; + private java.util.List productDetails_; + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + @java.lang.Override + public java.util.List getProductDetailsList() { + return productDetails_; + } + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + @java.lang.Override + public java.util.List + getProductDetailsOrBuilderList() { + return productDetails_; + } + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + @java.lang.Override + public int getProductDetailsCount() { + return productDetails_.size(); + } + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductDetail getProductDetails(int index) { + return productDetails_.get(index); + } + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ProductDetailOrBuilder getProductDetailsOrBuilder(int index) { + return productDetails_.get(index); + } + + public static final int ATTRIBUTES_FIELD_NUMBER = 7; + + private static final class AttributesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_UserEvent_AttributesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.retail.v2.CustomAttribute.getDefaultInstance()); + } + + private com.google.protobuf.MapField + attributes_; + + private com.google.protobuf.MapField + internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField(AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); + } + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public boolean containsAttributes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetAttributes().getMap().containsKey(key); + } + /** Use {@link #getAttributesMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getAttributes() { + return getAttributesMap(); + } + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public java.util.Map + getAttributesMap() { + return internalGetAttributes().getMap(); + } + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int CART_ID_FIELD_NUMBER = 8; + private volatile java.lang.Object cartId_; + /** + * + * + *
+   * The id or name of the associated shopping cart. This id is used
+   * to associate multiple items added or present in the cart before purchase.
+   * This can only be set for `add-to-cart`, `purchase-complete`, or
+   * `shopping-cart-page-view` events.
+   * 
+ * + * string cart_id = 8; + * + * @return The cartId. + */ + @java.lang.Override + public java.lang.String getCartId() { + java.lang.Object ref = cartId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cartId_ = s; + return s; + } + } + /** + * + * + *
+   * The id or name of the associated shopping cart. This id is used
+   * to associate multiple items added or present in the cart before purchase.
+   * This can only be set for `add-to-cart`, `purchase-complete`, or
+   * `shopping-cart-page-view` events.
+   * 
+ * + * string cart_id = 8; + * + * @return The bytes for cartId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCartIdBytes() { + java.lang.Object ref = cartId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cartId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PURCHASE_TRANSACTION_FIELD_NUMBER = 9; + private com.google.cloud.retail.v2.PurchaseTransaction purchaseTransaction_; + /** + * + * + *
+   * A transaction represents the entire purchase transaction.
+   * Required for `purchase-complete` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + * + * @return Whether the purchaseTransaction field is set. + */ + @java.lang.Override + public boolean hasPurchaseTransaction() { + return purchaseTransaction_ != null; + } + /** + * + * + *
+   * A transaction represents the entire purchase transaction.
+   * Required for `purchase-complete` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + * + * @return The purchaseTransaction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.PurchaseTransaction getPurchaseTransaction() { + return purchaseTransaction_ == null + ? com.google.cloud.retail.v2.PurchaseTransaction.getDefaultInstance() + : purchaseTransaction_; + } + /** + * + * + *
+   * A transaction represents the entire purchase transaction.
+   * Required for `purchase-complete` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + @java.lang.Override + public com.google.cloud.retail.v2.PurchaseTransactionOrBuilder getPurchaseTransactionOrBuilder() { + return getPurchaseTransaction(); + } + + public static final int SEARCH_QUERY_FIELD_NUMBER = 10; + private volatile java.lang.Object searchQuery_; + /** + * + * + *
+   * The user's search query.
+   * The value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Required for `search` events. Other event types should not set this field.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string search_query = 10; + * + * @return The searchQuery. + */ + @java.lang.Override + public java.lang.String getSearchQuery() { + java.lang.Object ref = searchQuery_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + searchQuery_ = s; + return s; + } + } + /** + * + * + *
+   * The user's search query.
+   * The value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Required for `search` events. Other event types should not set this field.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string search_query = 10; + * + * @return The bytes for searchQuery. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSearchQueryBytes() { + java.lang.Object ref = searchQuery_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + searchQuery_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_CATEGORIES_FIELD_NUMBER = 11; + private com.google.protobuf.LazyStringList pageCategories_; + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @return A list containing the pageCategories. + */ + public com.google.protobuf.ProtocolStringList getPageCategoriesList() { + return pageCategories_; + } + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @return The count of pageCategories. + */ + public int getPageCategoriesCount() { + return pageCategories_.size(); + } + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @param index The index of the element to return. + * @return The pageCategories at the given index. + */ + public java.lang.String getPageCategories(int index) { + return pageCategories_.get(index); + } + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @param index The index of the value to return. + * @return The bytes of the pageCategories at the given index. + */ + public com.google.protobuf.ByteString getPageCategoriesBytes(int index) { + return pageCategories_.getByteString(index); + } + + public static final int USER_INFO_FIELD_NUMBER = 12; + private com.google.cloud.retail.v2.UserInfo userInfo_; + /** + * + * + *
+   * User information.
+   * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + * + * @return Whether the userInfo field is set. + */ + @java.lang.Override + public boolean hasUserInfo() { + return userInfo_ != null; + } + /** + * + * + *
+   * User information.
+   * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + * + * @return The userInfo. + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserInfo getUserInfo() { + return userInfo_ == null ? com.google.cloud.retail.v2.UserInfo.getDefaultInstance() : userInfo_; + } + /** + * + * + *
+   * User information.
+   * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserInfoOrBuilder getUserInfoOrBuilder() { + return getUserInfo(); + } + + public static final int URI_FIELD_NUMBER = 13; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * Complete URL (window.location.href) of the user's current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically. Maximum length 5,000
+   * characters.
+   * 
+ * + * string uri = 13; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * Complete URL (window.location.href) of the user's current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically. Maximum length 5,000
+   * characters.
+   * 
+ * + * string uri = 13; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFERRER_URI_FIELD_NUMBER = 14; + private volatile java.lang.Object referrerUri_; + /** + * + * + *
+   * The referrer URL of the current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string referrer_uri = 14; + * + * @return The referrerUri. + */ + @java.lang.Override + public java.lang.String getReferrerUri() { + java.lang.Object ref = referrerUri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + referrerUri_ = s; + return s; + } + } + /** + * + * + *
+   * The referrer URL of the current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string referrer_uri = 14; + * + * @return The bytes for referrerUri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getReferrerUriBytes() { + java.lang.Object ref = referrerUri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + referrerUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_VIEW_ID_FIELD_NUMBER = 15; + private volatile java.lang.Object pageViewId_; + /** + * + * + *
+   * A unique id of a web page view.
+   * This should be kept the same for all user events triggered from the same
+   * pageview. For example, an item detail page view could trigger multiple
+   * events as the user is browsing the page. The `pageViewId` property should
+   * be kept the same for all these events so that they can be grouped together
+   * properly.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string page_view_id = 15; + * + * @return The pageViewId. + */ + @java.lang.Override + public java.lang.String getPageViewId() { + java.lang.Object ref = pageViewId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageViewId_ = s; + return s; + } + } + /** + * + * + *
+   * A unique id of a web page view.
+   * This should be kept the same for all user events triggered from the same
+   * pageview. For example, an item detail page view could trigger multiple
+   * events as the user is browsing the page. The `pageViewId` property should
+   * be kept the same for all these events so that they can be grouped together
+   * properly.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string page_view_id = 15; + * + * @return The bytes for pageViewId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageViewIdBytes() { + java.lang.Object ref = pageViewId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageViewId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getEventTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, eventType_); + } + if (!getVisitorIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, visitorId_); + } + if (eventTime_ != null) { + output.writeMessage(3, getEventTime()); + } + for (int i = 0; i < experimentIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, experimentIds_.getRaw(i)); + } + if (!getAttributionTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, attributionToken_); + } + for (int i = 0; i < productDetails_.size(); i++) { + output.writeMessage(6, productDetails_.get(i)); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAttributes(), AttributesDefaultEntryHolder.defaultEntry, 7); + if (!getCartIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, cartId_); + } + if (purchaseTransaction_ != null) { + output.writeMessage(9, getPurchaseTransaction()); + } + if (!getSearchQueryBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, searchQuery_); + } + for (int i = 0; i < pageCategories_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, pageCategories_.getRaw(i)); + } + if (userInfo_ != null) { + output.writeMessage(12, getUserInfo()); + } + if (!getUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 13, uri_); + } + if (!getReferrerUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 14, referrerUri_); + } + if (!getPageViewIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 15, pageViewId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getEventTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, eventType_); + } + if (!getVisitorIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, visitorId_); + } + if (eventTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getEventTime()); + } + { + int dataSize = 0; + for (int i = 0; i < experimentIds_.size(); i++) { + dataSize += computeStringSizeNoTag(experimentIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getExperimentIdsList().size(); + } + if (!getAttributionTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, attributionToken_); + } + for (int i = 0; i < productDetails_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, productDetails_.get(i)); + } + for (java.util.Map.Entry entry : + internalGetAttributes().getMap().entrySet()) { + com.google.protobuf.MapEntry + attributes__ = + AttributesDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, attributes__); + } + if (!getCartIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, cartId_); + } + if (purchaseTransaction_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getPurchaseTransaction()); + } + if (!getSearchQueryBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, searchQuery_); + } + { + int dataSize = 0; + for (int i = 0; i < pageCategories_.size(); i++) { + dataSize += computeStringSizeNoTag(pageCategories_.getRaw(i)); + } + size += dataSize; + size += 1 * getPageCategoriesList().size(); + } + if (userInfo_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, getUserInfo()); + } + if (!getUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, uri_); + } + if (!getReferrerUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, referrerUri_); + } + if (!getPageViewIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(15, pageViewId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UserEvent)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UserEvent other = (com.google.cloud.retail.v2.UserEvent) obj; + + if (!getEventType().equals(other.getEventType())) return false; + if (!getVisitorId().equals(other.getVisitorId())) return false; + if (hasEventTime() != other.hasEventTime()) return false; + if (hasEventTime()) { + if (!getEventTime().equals(other.getEventTime())) return false; + } + if (!getExperimentIdsList().equals(other.getExperimentIdsList())) return false; + if (!getAttributionToken().equals(other.getAttributionToken())) return false; + if (!getProductDetailsList().equals(other.getProductDetailsList())) return false; + if (!internalGetAttributes().equals(other.internalGetAttributes())) return false; + if (!getCartId().equals(other.getCartId())) return false; + if (hasPurchaseTransaction() != other.hasPurchaseTransaction()) return false; + if (hasPurchaseTransaction()) { + if (!getPurchaseTransaction().equals(other.getPurchaseTransaction())) return false; + } + if (!getSearchQuery().equals(other.getSearchQuery())) return false; + if (!getPageCategoriesList().equals(other.getPageCategoriesList())) return false; + if (hasUserInfo() != other.hasUserInfo()) return false; + if (hasUserInfo()) { + if (!getUserInfo().equals(other.getUserInfo())) return false; + } + if (!getUri().equals(other.getUri())) return false; + if (!getReferrerUri().equals(other.getReferrerUri())) return false; + if (!getPageViewId().equals(other.getPageViewId())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + EVENT_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getEventType().hashCode(); + hash = (37 * hash) + VISITOR_ID_FIELD_NUMBER; + hash = (53 * hash) + getVisitorId().hashCode(); + if (hasEventTime()) { + hash = (37 * hash) + EVENT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEventTime().hashCode(); + } + if (getExperimentIdsCount() > 0) { + hash = (37 * hash) + EXPERIMENT_IDS_FIELD_NUMBER; + hash = (53 * hash) + getExperimentIdsList().hashCode(); + } + hash = (37 * hash) + ATTRIBUTION_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getAttributionToken().hashCode(); + if (getProductDetailsCount() > 0) { + hash = (37 * hash) + PRODUCT_DETAILS_FIELD_NUMBER; + hash = (53 * hash) + getProductDetailsList().hashCode(); + } + if (!internalGetAttributes().getMap().isEmpty()) { + hash = (37 * hash) + ATTRIBUTES_FIELD_NUMBER; + hash = (53 * hash) + internalGetAttributes().hashCode(); + } + hash = (37 * hash) + CART_ID_FIELD_NUMBER; + hash = (53 * hash) + getCartId().hashCode(); + if (hasPurchaseTransaction()) { + hash = (37 * hash) + PURCHASE_TRANSACTION_FIELD_NUMBER; + hash = (53 * hash) + getPurchaseTransaction().hashCode(); + } + hash = (37 * hash) + SEARCH_QUERY_FIELD_NUMBER; + hash = (53 * hash) + getSearchQuery().hashCode(); + if (getPageCategoriesCount() > 0) { + hash = (37 * hash) + PAGE_CATEGORIES_FIELD_NUMBER; + hash = (53 * hash) + getPageCategoriesList().hashCode(); + } + if (hasUserInfo()) { + hash = (37 * hash) + USER_INFO_FIELD_NUMBER; + hash = (53 * hash) + getUserInfo().hashCode(); + } + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (37 * hash) + REFERRER_URI_FIELD_NUMBER; + hash = (53 * hash) + getReferrerUri().hashCode(); + hash = (37 * hash) + PAGE_VIEW_ID_FIELD_NUMBER; + hash = (53 * hash) + getPageViewId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEvent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEvent parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEvent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UserEvent prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * UserEvent captures all metadata information Retail API needs to know about
+   * how end users interact with customers' website.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEvent} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UserEvent) + com.google.cloud.retail.v2.UserEventOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_UserEvent_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 7: + return internalGetMutableAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_UserEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEvent.class, + com.google.cloud.retail.v2.UserEvent.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UserEvent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getProductDetailsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + eventType_ = ""; + + visitorId_ = ""; + + if (eventTimeBuilder_ == null) { + eventTime_ = null; + } else { + eventTime_ = null; + eventTimeBuilder_ = null; + } + experimentIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + attributionToken_ = ""; + + if (productDetailsBuilder_ == null) { + productDetails_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + productDetailsBuilder_.clear(); + } + internalGetMutableAttributes().clear(); + cartId_ = ""; + + if (purchaseTransactionBuilder_ == null) { + purchaseTransaction_ = null; + } else { + purchaseTransaction_ = null; + purchaseTransactionBuilder_ = null; + } + searchQuery_ = ""; + + pageCategories_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + if (userInfoBuilder_ == null) { + userInfo_ = null; + } else { + userInfo_ = null; + userInfoBuilder_ = null; + } + uri_ = ""; + + referrerUri_ = ""; + + pageViewId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventProto + .internal_static_google_cloud_retail_v2_UserEvent_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEvent getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UserEvent.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEvent build() { + com.google.cloud.retail.v2.UserEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEvent buildPartial() { + com.google.cloud.retail.v2.UserEvent result = new com.google.cloud.retail.v2.UserEvent(this); + int from_bitField0_ = bitField0_; + result.eventType_ = eventType_; + result.visitorId_ = visitorId_; + if (eventTimeBuilder_ == null) { + result.eventTime_ = eventTime_; + } else { + result.eventTime_ = eventTimeBuilder_.build(); + } + if (((bitField0_ & 0x00000001) != 0)) { + experimentIds_ = experimentIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.experimentIds_ = experimentIds_; + result.attributionToken_ = attributionToken_; + if (productDetailsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + productDetails_ = java.util.Collections.unmodifiableList(productDetails_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.productDetails_ = productDetails_; + } else { + result.productDetails_ = productDetailsBuilder_.build(); + } + result.attributes_ = internalGetAttributes(); + result.attributes_.makeImmutable(); + result.cartId_ = cartId_; + if (purchaseTransactionBuilder_ == null) { + result.purchaseTransaction_ = purchaseTransaction_; + } else { + result.purchaseTransaction_ = purchaseTransactionBuilder_.build(); + } + result.searchQuery_ = searchQuery_; + if (((bitField0_ & 0x00000008) != 0)) { + pageCategories_ = pageCategories_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.pageCategories_ = pageCategories_; + if (userInfoBuilder_ == null) { + result.userInfo_ = userInfo_; + } else { + result.userInfo_ = userInfoBuilder_.build(); + } + result.uri_ = uri_; + result.referrerUri_ = referrerUri_; + result.pageViewId_ = pageViewId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UserEvent) { + return mergeFrom((com.google.cloud.retail.v2.UserEvent) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UserEvent other) { + if (other == com.google.cloud.retail.v2.UserEvent.getDefaultInstance()) return this; + if (!other.getEventType().isEmpty()) { + eventType_ = other.eventType_; + onChanged(); + } + if (!other.getVisitorId().isEmpty()) { + visitorId_ = other.visitorId_; + onChanged(); + } + if (other.hasEventTime()) { + mergeEventTime(other.getEventTime()); + } + if (!other.experimentIds_.isEmpty()) { + if (experimentIds_.isEmpty()) { + experimentIds_ = other.experimentIds_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureExperimentIdsIsMutable(); + experimentIds_.addAll(other.experimentIds_); + } + onChanged(); + } + if (!other.getAttributionToken().isEmpty()) { + attributionToken_ = other.attributionToken_; + onChanged(); + } + if (productDetailsBuilder_ == null) { + if (!other.productDetails_.isEmpty()) { + if (productDetails_.isEmpty()) { + productDetails_ = other.productDetails_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureProductDetailsIsMutable(); + productDetails_.addAll(other.productDetails_); + } + onChanged(); + } + } else { + if (!other.productDetails_.isEmpty()) { + if (productDetailsBuilder_.isEmpty()) { + productDetailsBuilder_.dispose(); + productDetailsBuilder_ = null; + productDetails_ = other.productDetails_; + bitField0_ = (bitField0_ & ~0x00000002); + productDetailsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getProductDetailsFieldBuilder() + : null; + } else { + productDetailsBuilder_.addAllMessages(other.productDetails_); + } + } + } + internalGetMutableAttributes().mergeFrom(other.internalGetAttributes()); + if (!other.getCartId().isEmpty()) { + cartId_ = other.cartId_; + onChanged(); + } + if (other.hasPurchaseTransaction()) { + mergePurchaseTransaction(other.getPurchaseTransaction()); + } + if (!other.getSearchQuery().isEmpty()) { + searchQuery_ = other.searchQuery_; + onChanged(); + } + if (!other.pageCategories_.isEmpty()) { + if (pageCategories_.isEmpty()) { + pageCategories_ = other.pageCategories_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensurePageCategoriesIsMutable(); + pageCategories_.addAll(other.pageCategories_); + } + onChanged(); + } + if (other.hasUserInfo()) { + mergeUserInfo(other.getUserInfo()); + } + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + if (!other.getReferrerUri().isEmpty()) { + referrerUri_ = other.referrerUri_; + onChanged(); + } + if (!other.getPageViewId().isEmpty()) { + pageViewId_ = other.pageViewId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UserEvent parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.UserEvent) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object eventType_ = ""; + /** + * + * + *
+     * Required. User event type. Allowed values are:
+     * * `add-to-cart`: Products being added to cart.
+     * * `category-page-view`: Special pages such as sale or promotion pages
+     *   viewed.
+     * * `detail-page-view`: Products detail page viewed.
+     * * `home-page-view`: Homepage viewed.
+     * * `purchase-complete`: User finishing a purchase.
+     * * `search`: Product search.
+     * * `shopping-cart-page-view`: User viewing a shopping cart.
+     * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The eventType. + */ + public java.lang.String getEventType() { + java.lang.Object ref = eventType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + eventType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. User event type. Allowed values are:
+     * * `add-to-cart`: Products being added to cart.
+     * * `category-page-view`: Special pages such as sale or promotion pages
+     *   viewed.
+     * * `detail-page-view`: Products detail page viewed.
+     * * `home-page-view`: Homepage viewed.
+     * * `purchase-complete`: User finishing a purchase.
+     * * `search`: Product search.
+     * * `shopping-cart-page-view`: User viewing a shopping cart.
+     * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for eventType. + */ + public com.google.protobuf.ByteString getEventTypeBytes() { + java.lang.Object ref = eventType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + eventType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. User event type. Allowed values are:
+     * * `add-to-cart`: Products being added to cart.
+     * * `category-page-view`: Special pages such as sale or promotion pages
+     *   viewed.
+     * * `detail-page-view`: Products detail page viewed.
+     * * `home-page-view`: Homepage viewed.
+     * * `purchase-complete`: User finishing a purchase.
+     * * `search`: Product search.
+     * * `shopping-cart-page-view`: User viewing a shopping cart.
+     * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The eventType to set. + * @return This builder for chaining. + */ + public Builder setEventType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + eventType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. User event type. Allowed values are:
+     * * `add-to-cart`: Products being added to cart.
+     * * `category-page-view`: Special pages such as sale or promotion pages
+     *   viewed.
+     * * `detail-page-view`: Products detail page viewed.
+     * * `home-page-view`: Homepage viewed.
+     * * `purchase-complete`: User finishing a purchase.
+     * * `search`: Product search.
+     * * `shopping-cart-page-view`: User viewing a shopping cart.
+     * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearEventType() { + + eventType_ = getDefaultInstance().getEventType(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. User event type. Allowed values are:
+     * * `add-to-cart`: Products being added to cart.
+     * * `category-page-view`: Special pages such as sale or promotion pages
+     *   viewed.
+     * * `detail-page-view`: Products detail page viewed.
+     * * `home-page-view`: Homepage viewed.
+     * * `purchase-complete`: User finishing a purchase.
+     * * `search`: Product search.
+     * * `shopping-cart-page-view`: User viewing a shopping cart.
+     * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for eventType to set. + * @return This builder for chaining. + */ + public Builder setEventTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + eventType_ = value; + onChanged(); + return this; + } + + private java.lang.Object visitorId_ = ""; + /** + * + * + *
+     * Required. A unique identifier for tracking visitors.
+     * For example, this could be implemented with an HTTP cookie, which should be
+     * able to uniquely identify a visitor on a single device. This unique
+     * identifier should not change if the visitor log in/out of the website.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The visitorId. + */ + public java.lang.String getVisitorId() { + java.lang.Object ref = visitorId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + visitorId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. A unique identifier for tracking visitors.
+     * For example, this could be implemented with an HTTP cookie, which should be
+     * able to uniquely identify a visitor on a single device. This unique
+     * identifier should not change if the visitor log in/out of the website.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for visitorId. + */ + public com.google.protobuf.ByteString getVisitorIdBytes() { + java.lang.Object ref = visitorId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + visitorId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. A unique identifier for tracking visitors.
+     * For example, this could be implemented with an HTTP cookie, which should be
+     * able to uniquely identify a visitor on a single device. This unique
+     * identifier should not change if the visitor log in/out of the website.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The visitorId to set. + * @return This builder for chaining. + */ + public Builder setVisitorId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + visitorId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A unique identifier for tracking visitors.
+     * For example, this could be implemented with an HTTP cookie, which should be
+     * able to uniquely identify a visitor on a single device. This unique
+     * identifier should not change if the visitor log in/out of the website.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearVisitorId() { + + visitorId_ = getDefaultInstance().getVisitorId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A unique identifier for tracking visitors.
+     * For example, this could be implemented with an HTTP cookie, which should be
+     * able to uniquely identify a visitor on a single device. This unique
+     * identifier should not change if the visitor log in/out of the website.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for visitorId to set. + * @return This builder for chaining. + */ + public Builder setVisitorIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + visitorId_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp eventTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + eventTimeBuilder_; + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + * + * @return Whether the eventTime field is set. + */ + public boolean hasEventTime() { + return eventTimeBuilder_ != null || eventTime_ != null; + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + * + * @return The eventTime. + */ + public com.google.protobuf.Timestamp getEventTime() { + if (eventTimeBuilder_ == null) { + return eventTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : eventTime_; + } else { + return eventTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + public Builder setEventTime(com.google.protobuf.Timestamp value) { + if (eventTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + eventTime_ = value; + onChanged(); + } else { + eventTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + public Builder setEventTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (eventTimeBuilder_ == null) { + eventTime_ = builderForValue.build(); + onChanged(); + } else { + eventTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + public Builder mergeEventTime(com.google.protobuf.Timestamp value) { + if (eventTimeBuilder_ == null) { + if (eventTime_ != null) { + eventTime_ = + com.google.protobuf.Timestamp.newBuilder(eventTime_).mergeFrom(value).buildPartial(); + } else { + eventTime_ = value; + } + onChanged(); + } else { + eventTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + public Builder clearEventTime() { + if (eventTimeBuilder_ == null) { + eventTime_ = null; + onChanged(); + } else { + eventTime_ = null; + eventTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getEventTimeBuilder() { + + onChanged(); + return getEventTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getEventTimeOrBuilder() { + if (eventTimeBuilder_ != null) { + return eventTimeBuilder_.getMessageOrBuilder(); + } else { + return eventTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : eventTime_; + } + } + /** + * + * + *
+     * Only required for
+     * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+     * method. Timestamp of when the user event happened.
+     * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEventTimeFieldBuilder() { + if (eventTimeBuilder_ == null) { + eventTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEventTime(), getParentForChildren(), isClean()); + eventTime_ = null; + } + return eventTimeBuilder_; + } + + private com.google.protobuf.LazyStringList experimentIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureExperimentIdsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + experimentIds_ = new com.google.protobuf.LazyStringArrayList(experimentIds_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @return A list containing the experimentIds. + */ + public com.google.protobuf.ProtocolStringList getExperimentIdsList() { + return experimentIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @return The count of experimentIds. + */ + public int getExperimentIdsCount() { + return experimentIds_.size(); + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @param index The index of the element to return. + * @return The experimentIds at the given index. + */ + public java.lang.String getExperimentIds(int index) { + return experimentIds_.get(index); + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @param index The index of the value to return. + * @return The bytes of the experimentIds at the given index. + */ + public com.google.protobuf.ByteString getExperimentIdsBytes(int index) { + return experimentIds_.getByteString(index); + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @param index The index to set the value at. + * @param value The experimentIds to set. + * @return This builder for chaining. + */ + public Builder setExperimentIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureExperimentIdsIsMutable(); + experimentIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @param value The experimentIds to add. + * @return This builder for chaining. + */ + public Builder addExperimentIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureExperimentIdsIsMutable(); + experimentIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @param values The experimentIds to add. + * @return This builder for chaining. + */ + public Builder addAllExperimentIds(java.lang.Iterable values) { + ensureExperimentIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, experimentIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @return This builder for chaining. + */ + public Builder clearExperimentIds() { + experimentIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of identifiers for the independent experiment groups this user event
+     * belongs to. This is used to distinguish between user events associated with
+     * different experiment setups (e.g. using Retail API, using different
+     * recommendation models).
+     * 
+ * + * repeated string experiment_ids = 4; + * + * @param value The bytes of the experimentIds to add. + * @return This builder for chaining. + */ + public Builder addExperimentIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureExperimentIdsIsMutable(); + experimentIds_.add(value); + onChanged(); + return this; + } + + private java.lang.Object attributionToken_ = ""; + /** + * + * + *
+     * Highly recommended for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This field enables accurate attribution of recommendation model
+     * performance.
+     * The value must be a valid
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This token enables us to accurately attribute page view or purchase back to
+     * the event and the particular predict response containing this
+     * clicked/purchased product. If user clicks on product K in the
+     * recommendation results, pass
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * as a URL parameter to product K's page. When recording events on product
+     * K's page, log the
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * to this field.
+     * 
+ * + * string attribution_token = 5; + * + * @return The attributionToken. + */ + public java.lang.String getAttributionToken() { + java.lang.Object ref = attributionToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributionToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Highly recommended for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This field enables accurate attribution of recommendation model
+     * performance.
+     * The value must be a valid
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This token enables us to accurately attribute page view or purchase back to
+     * the event and the particular predict response containing this
+     * clicked/purchased product. If user clicks on product K in the
+     * recommendation results, pass
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * as a URL parameter to product K's page. When recording events on product
+     * K's page, log the
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * to this field.
+     * 
+ * + * string attribution_token = 5; + * + * @return The bytes for attributionToken. + */ + public com.google.protobuf.ByteString getAttributionTokenBytes() { + java.lang.Object ref = attributionToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributionToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Highly recommended for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This field enables accurate attribution of recommendation model
+     * performance.
+     * The value must be a valid
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This token enables us to accurately attribute page view or purchase back to
+     * the event and the particular predict response containing this
+     * clicked/purchased product. If user clicks on product K in the
+     * recommendation results, pass
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * as a URL parameter to product K's page. When recording events on product
+     * K's page, log the
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * to this field.
+     * 
+ * + * string attribution_token = 5; + * + * @param value The attributionToken to set. + * @return This builder for chaining. + */ + public Builder setAttributionToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + attributionToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Highly recommended for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This field enables accurate attribution of recommendation model
+     * performance.
+     * The value must be a valid
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This token enables us to accurately attribute page view or purchase back to
+     * the event and the particular predict response containing this
+     * clicked/purchased product. If user clicks on product K in the
+     * recommendation results, pass
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * as a URL parameter to product K's page. When recording events on product
+     * K's page, log the
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * to this field.
+     * 
+ * + * string attribution_token = 5; + * + * @return This builder for chaining. + */ + public Builder clearAttributionToken() { + + attributionToken_ = getDefaultInstance().getAttributionToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Highly recommended for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This field enables accurate attribution of recommendation model
+     * performance.
+     * The value must be a valid
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * for user events that are the result of
+     * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+     * This token enables us to accurately attribute page view or purchase back to
+     * the event and the particular predict response containing this
+     * clicked/purchased product. If user clicks on product K in the
+     * recommendation results, pass
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * as a URL parameter to product K's page. When recording events on product
+     * K's page, log the
+     * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+     * to this field.
+     * 
+ * + * string attribution_token = 5; + * + * @param value The bytes for attributionToken to set. + * @return This builder for chaining. + */ + public Builder setAttributionTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + attributionToken_ = value; + onChanged(); + return this; + } + + private java.util.List productDetails_ = + java.util.Collections.emptyList(); + + private void ensureProductDetailsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + productDetails_ = + new java.util.ArrayList(productDetails_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.ProductDetail, + com.google.cloud.retail.v2.ProductDetail.Builder, + com.google.cloud.retail.v2.ProductDetailOrBuilder> + productDetailsBuilder_; + + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public java.util.List getProductDetailsList() { + if (productDetailsBuilder_ == null) { + return java.util.Collections.unmodifiableList(productDetails_); + } else { + return productDetailsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public int getProductDetailsCount() { + if (productDetailsBuilder_ == null) { + return productDetails_.size(); + } else { + return productDetailsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public com.google.cloud.retail.v2.ProductDetail getProductDetails(int index) { + if (productDetailsBuilder_ == null) { + return productDetails_.get(index); + } else { + return productDetailsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder setProductDetails(int index, com.google.cloud.retail.v2.ProductDetail value) { + if (productDetailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProductDetailsIsMutable(); + productDetails_.set(index, value); + onChanged(); + } else { + productDetailsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder setProductDetails( + int index, com.google.cloud.retail.v2.ProductDetail.Builder builderForValue) { + if (productDetailsBuilder_ == null) { + ensureProductDetailsIsMutable(); + productDetails_.set(index, builderForValue.build()); + onChanged(); + } else { + productDetailsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder addProductDetails(com.google.cloud.retail.v2.ProductDetail value) { + if (productDetailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProductDetailsIsMutable(); + productDetails_.add(value); + onChanged(); + } else { + productDetailsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder addProductDetails(int index, com.google.cloud.retail.v2.ProductDetail value) { + if (productDetailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProductDetailsIsMutable(); + productDetails_.add(index, value); + onChanged(); + } else { + productDetailsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder addProductDetails( + com.google.cloud.retail.v2.ProductDetail.Builder builderForValue) { + if (productDetailsBuilder_ == null) { + ensureProductDetailsIsMutable(); + productDetails_.add(builderForValue.build()); + onChanged(); + } else { + productDetailsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder addProductDetails( + int index, com.google.cloud.retail.v2.ProductDetail.Builder builderForValue) { + if (productDetailsBuilder_ == null) { + ensureProductDetailsIsMutable(); + productDetails_.add(index, builderForValue.build()); + onChanged(); + } else { + productDetailsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder addAllProductDetails( + java.lang.Iterable values) { + if (productDetailsBuilder_ == null) { + ensureProductDetailsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, productDetails_); + onChanged(); + } else { + productDetailsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder clearProductDetails() { + if (productDetailsBuilder_ == null) { + productDetails_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + productDetailsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public Builder removeProductDetails(int index) { + if (productDetailsBuilder_ == null) { + ensureProductDetailsIsMutable(); + productDetails_.remove(index); + onChanged(); + } else { + productDetailsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public com.google.cloud.retail.v2.ProductDetail.Builder getProductDetailsBuilder(int index) { + return getProductDetailsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public com.google.cloud.retail.v2.ProductDetailOrBuilder getProductDetailsOrBuilder(int index) { + if (productDetailsBuilder_ == null) { + return productDetails_.get(index); + } else { + return productDetailsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public java.util.List + getProductDetailsOrBuilderList() { + if (productDetailsBuilder_ != null) { + return productDetailsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(productDetails_); + } + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public com.google.cloud.retail.v2.ProductDetail.Builder addProductDetailsBuilder() { + return getProductDetailsFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.ProductDetail.getDefaultInstance()); + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public com.google.cloud.retail.v2.ProductDetail.Builder addProductDetailsBuilder(int index) { + return getProductDetailsFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.ProductDetail.getDefaultInstance()); + } + /** + * + * + *
+     * The main product details related to the event.
+     * This field is required for the following event types:
+     * * `add-to-cart`
+     * * `detail-page-view`
+     * * `purchase-complete`
+     * In a `search` event, this field represents the products returned to the end
+     * user on the current page (the end user may have not finished broswing the
+     * whole page yet). When a new page is returned to the end user, after
+     * pagination/filtering/ordering even for the same query, a new `search` event
+     * with different
+     * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+     * desired. The end user may have not finished broswing the whole page yet.
+     * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + public java.util.List + getProductDetailsBuilderList() { + return getProductDetailsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.ProductDetail, + com.google.cloud.retail.v2.ProductDetail.Builder, + com.google.cloud.retail.v2.ProductDetailOrBuilder> + getProductDetailsFieldBuilder() { + if (productDetailsBuilder_ == null) { + productDetailsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.ProductDetail, + com.google.cloud.retail.v2.ProductDetail.Builder, + com.google.cloud.retail.v2.ProductDetailOrBuilder>( + productDetails_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + productDetails_ = null; + } + return productDetailsBuilder_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + attributes_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CustomAttribute> + internalGetMutableAttributes() { + onChanged(); + ; + if (attributes_ == null) { + attributes_ = + com.google.protobuf.MapField.newMapField(AttributesDefaultEntryHolder.defaultEntry); + } + if (!attributes_.isMutable()) { + attributes_ = attributes_.copy(); + } + return attributes_; + } + + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); + } + /** + * + * + *
+     * Extra user event features to include in the recommendation model.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * For product recommendation, an example of extra user information is
+     * traffic_channel, i.e. how user arrives at the site. Users can arrive
+     * at the site by coming to the site directly, or coming through Google
+     * search, and etc.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public boolean containsAttributes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetAttributes().getMap().containsKey(key); + } + /** Use {@link #getAttributesMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getAttributes() { + return getAttributesMap(); + } + /** + * + * + *
+     * Extra user event features to include in the recommendation model.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * For product recommendation, an example of extra user information is
+     * traffic_channel, i.e. how user arrives at the site. Users can arrive
+     * at the site by coming to the site directly, or coming through Google
+     * search, and etc.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public java.util.Map + getAttributesMap() { + return internalGetAttributes().getMap(); + } + /** + * + * + *
+     * Extra user event features to include in the recommendation model.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * For product recommendation, an example of extra user information is
+     * traffic_channel, i.e. how user arrives at the site. Users can arrive
+     * at the site by coming to the site directly, or coming through Google
+     * search, and etc.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Extra user event features to include in the recommendation model.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * For product recommendation, an example of extra user information is
+     * traffic_channel, i.e. how user arrives at the site. Users can arrive
+     * at the site by coming to the site directly, or coming through Google
+     * search, and etc.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + @java.lang.Override + public com.google.cloud.retail.v2.CustomAttribute getAttributesOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAttributes() { + internalGetMutableAttributes().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Extra user event features to include in the recommendation model.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * For product recommendation, an example of extra user information is
+     * traffic_channel, i.e. how user arrives at the site. Users can arrive
+     * at the site by coming to the site directly, or coming through Google
+     * search, and etc.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + public Builder removeAttributes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableAttributes().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map + getMutableAttributes() { + return internalGetMutableAttributes().getMutableMap(); + } + /** + * + * + *
+     * Extra user event features to include in the recommendation model.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * For product recommendation, an example of extra user information is
+     * traffic_channel, i.e. how user arrives at the site. Users can arrive
+     * at the site by coming to the site directly, or coming through Google
+     * search, and etc.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + public Builder putAttributes( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableAttributes().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Extra user event features to include in the recommendation model.
+     * The key must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * For product recommendation, an example of extra user information is
+     * traffic_channel, i.e. how user arrives at the site. Users can arrive
+     * at the site by coming to the site directly, or coming through Google
+     * search, and etc.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + public Builder putAllAttributes( + java.util.Map values) { + internalGetMutableAttributes().getMutableMap().putAll(values); + return this; + } + + private java.lang.Object cartId_ = ""; + /** + * + * + *
+     * The id or name of the associated shopping cart. This id is used
+     * to associate multiple items added or present in the cart before purchase.
+     * This can only be set for `add-to-cart`, `purchase-complete`, or
+     * `shopping-cart-page-view` events.
+     * 
+ * + * string cart_id = 8; + * + * @return The cartId. + */ + public java.lang.String getCartId() { + java.lang.Object ref = cartId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cartId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The id or name of the associated shopping cart. This id is used
+     * to associate multiple items added or present in the cart before purchase.
+     * This can only be set for `add-to-cart`, `purchase-complete`, or
+     * `shopping-cart-page-view` events.
+     * 
+ * + * string cart_id = 8; + * + * @return The bytes for cartId. + */ + public com.google.protobuf.ByteString getCartIdBytes() { + java.lang.Object ref = cartId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cartId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The id or name of the associated shopping cart. This id is used
+     * to associate multiple items added or present in the cart before purchase.
+     * This can only be set for `add-to-cart`, `purchase-complete`, or
+     * `shopping-cart-page-view` events.
+     * 
+ * + * string cart_id = 8; + * + * @param value The cartId to set. + * @return This builder for chaining. + */ + public Builder setCartId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + cartId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The id or name of the associated shopping cart. This id is used
+     * to associate multiple items added or present in the cart before purchase.
+     * This can only be set for `add-to-cart`, `purchase-complete`, or
+     * `shopping-cart-page-view` events.
+     * 
+ * + * string cart_id = 8; + * + * @return This builder for chaining. + */ + public Builder clearCartId() { + + cartId_ = getDefaultInstance().getCartId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The id or name of the associated shopping cart. This id is used
+     * to associate multiple items added or present in the cart before purchase.
+     * This can only be set for `add-to-cart`, `purchase-complete`, or
+     * `shopping-cart-page-view` events.
+     * 
+ * + * string cart_id = 8; + * + * @param value The bytes for cartId to set. + * @return This builder for chaining. + */ + public Builder setCartIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + cartId_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.PurchaseTransaction purchaseTransaction_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.PurchaseTransaction, + com.google.cloud.retail.v2.PurchaseTransaction.Builder, + com.google.cloud.retail.v2.PurchaseTransactionOrBuilder> + purchaseTransactionBuilder_; + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + * + * @return Whether the purchaseTransaction field is set. + */ + public boolean hasPurchaseTransaction() { + return purchaseTransactionBuilder_ != null || purchaseTransaction_ != null; + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + * + * @return The purchaseTransaction. + */ + public com.google.cloud.retail.v2.PurchaseTransaction getPurchaseTransaction() { + if (purchaseTransactionBuilder_ == null) { + return purchaseTransaction_ == null + ? com.google.cloud.retail.v2.PurchaseTransaction.getDefaultInstance() + : purchaseTransaction_; + } else { + return purchaseTransactionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + public Builder setPurchaseTransaction(com.google.cloud.retail.v2.PurchaseTransaction value) { + if (purchaseTransactionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + purchaseTransaction_ = value; + onChanged(); + } else { + purchaseTransactionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + public Builder setPurchaseTransaction( + com.google.cloud.retail.v2.PurchaseTransaction.Builder builderForValue) { + if (purchaseTransactionBuilder_ == null) { + purchaseTransaction_ = builderForValue.build(); + onChanged(); + } else { + purchaseTransactionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + public Builder mergePurchaseTransaction(com.google.cloud.retail.v2.PurchaseTransaction value) { + if (purchaseTransactionBuilder_ == null) { + if (purchaseTransaction_ != null) { + purchaseTransaction_ = + com.google.cloud.retail.v2.PurchaseTransaction.newBuilder(purchaseTransaction_) + .mergeFrom(value) + .buildPartial(); + } else { + purchaseTransaction_ = value; + } + onChanged(); + } else { + purchaseTransactionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + public Builder clearPurchaseTransaction() { + if (purchaseTransactionBuilder_ == null) { + purchaseTransaction_ = null; + onChanged(); + } else { + purchaseTransaction_ = null; + purchaseTransactionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + public com.google.cloud.retail.v2.PurchaseTransaction.Builder getPurchaseTransactionBuilder() { + + onChanged(); + return getPurchaseTransactionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + public com.google.cloud.retail.v2.PurchaseTransactionOrBuilder + getPurchaseTransactionOrBuilder() { + if (purchaseTransactionBuilder_ != null) { + return purchaseTransactionBuilder_.getMessageOrBuilder(); + } else { + return purchaseTransaction_ == null + ? com.google.cloud.retail.v2.PurchaseTransaction.getDefaultInstance() + : purchaseTransaction_; + } + } + /** + * + * + *
+     * A transaction represents the entire purchase transaction.
+     * Required for `purchase-complete` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.PurchaseTransaction, + com.google.cloud.retail.v2.PurchaseTransaction.Builder, + com.google.cloud.retail.v2.PurchaseTransactionOrBuilder> + getPurchaseTransactionFieldBuilder() { + if (purchaseTransactionBuilder_ == null) { + purchaseTransactionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.PurchaseTransaction, + com.google.cloud.retail.v2.PurchaseTransaction.Builder, + com.google.cloud.retail.v2.PurchaseTransactionOrBuilder>( + getPurchaseTransaction(), getParentForChildren(), isClean()); + purchaseTransaction_ = null; + } + return purchaseTransactionBuilder_; + } + + private java.lang.Object searchQuery_ = ""; + /** + * + * + *
+     * The user's search query.
+     * The value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Required for `search` events. Other event types should not set this field.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string search_query = 10; + * + * @return The searchQuery. + */ + public java.lang.String getSearchQuery() { + java.lang.Object ref = searchQuery_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + searchQuery_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The user's search query.
+     * The value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Required for `search` events. Other event types should not set this field.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string search_query = 10; + * + * @return The bytes for searchQuery. + */ + public com.google.protobuf.ByteString getSearchQueryBytes() { + java.lang.Object ref = searchQuery_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + searchQuery_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The user's search query.
+     * The value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Required for `search` events. Other event types should not set this field.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string search_query = 10; + * + * @param value The searchQuery to set. + * @return This builder for chaining. + */ + public Builder setSearchQuery(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + searchQuery_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The user's search query.
+     * The value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Required for `search` events. Other event types should not set this field.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string search_query = 10; + * + * @return This builder for chaining. + */ + public Builder clearSearchQuery() { + + searchQuery_ = getDefaultInstance().getSearchQuery(); + onChanged(); + return this; + } + /** + * + * + *
+     * The user's search query.
+     * The value must be a UTF-8 encoded string with a length limit of 5,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * Required for `search` events. Other event types should not set this field.
+     * Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string search_query = 10; + * + * @param value The bytes for searchQuery to set. + * @return This builder for chaining. + */ + public Builder setSearchQueryBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + searchQuery_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList pageCategories_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensurePageCategoriesIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + pageCategories_ = new com.google.protobuf.LazyStringArrayList(pageCategories_); + bitField0_ |= 0x00000008; + } + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @return A list containing the pageCategories. + */ + public com.google.protobuf.ProtocolStringList getPageCategoriesList() { + return pageCategories_.getUnmodifiableView(); + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @return The count of pageCategories. + */ + public int getPageCategoriesCount() { + return pageCategories_.size(); + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @param index The index of the element to return. + * @return The pageCategories at the given index. + */ + public java.lang.String getPageCategories(int index) { + return pageCategories_.get(index); + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @param index The index of the value to return. + * @return The bytes of the pageCategories at the given index. + */ + public com.google.protobuf.ByteString getPageCategoriesBytes(int index) { + return pageCategories_.getByteString(index); + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @param index The index to set the value at. + * @param value The pageCategories to set. + * @return This builder for chaining. + */ + public Builder setPageCategories(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePageCategoriesIsMutable(); + pageCategories_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @param value The pageCategories to add. + * @return This builder for chaining. + */ + public Builder addPageCategories(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePageCategoriesIsMutable(); + pageCategories_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @param values The pageCategories to add. + * @return This builder for chaining. + */ + public Builder addAllPageCategories(java.lang.Iterable values) { + ensurePageCategoriesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, pageCategories_); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @return This builder for chaining. + */ + public Builder clearPageCategories() { + pageCategories_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories associated with a category page.
+     * To represent full path of category, use '>' sign to separate different
+     * hierarchies. If '>' is part of the category name, please replace it with
+     * other character(s).
+     * Category pages include special pages such as sales or promotions. For
+     * instance, a special sale page may have the category hierarchy:
+     * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+     * Required for `category-page-view` events. Other event types should not set
+     * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * repeated string page_categories = 11; + * + * @param value The bytes of the pageCategories to add. + * @return This builder for chaining. + */ + public Builder addPageCategoriesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensurePageCategoriesIsMutable(); + pageCategories_.add(value); + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.UserInfo userInfo_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserInfo, + com.google.cloud.retail.v2.UserInfo.Builder, + com.google.cloud.retail.v2.UserInfoOrBuilder> + userInfoBuilder_; + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + * + * @return Whether the userInfo field is set. + */ + public boolean hasUserInfo() { + return userInfoBuilder_ != null || userInfo_ != null; + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + * + * @return The userInfo. + */ + public com.google.cloud.retail.v2.UserInfo getUserInfo() { + if (userInfoBuilder_ == null) { + return userInfo_ == null + ? com.google.cloud.retail.v2.UserInfo.getDefaultInstance() + : userInfo_; + } else { + return userInfoBuilder_.getMessage(); + } + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + public Builder setUserInfo(com.google.cloud.retail.v2.UserInfo value) { + if (userInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + userInfo_ = value; + onChanged(); + } else { + userInfoBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + public Builder setUserInfo(com.google.cloud.retail.v2.UserInfo.Builder builderForValue) { + if (userInfoBuilder_ == null) { + userInfo_ = builderForValue.build(); + onChanged(); + } else { + userInfoBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + public Builder mergeUserInfo(com.google.cloud.retail.v2.UserInfo value) { + if (userInfoBuilder_ == null) { + if (userInfo_ != null) { + userInfo_ = + com.google.cloud.retail.v2.UserInfo.newBuilder(userInfo_) + .mergeFrom(value) + .buildPartial(); + } else { + userInfo_ = value; + } + onChanged(); + } else { + userInfoBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + public Builder clearUserInfo() { + if (userInfoBuilder_ == null) { + userInfo_ = null; + onChanged(); + } else { + userInfo_ = null; + userInfoBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + public com.google.cloud.retail.v2.UserInfo.Builder getUserInfoBuilder() { + + onChanged(); + return getUserInfoFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + public com.google.cloud.retail.v2.UserInfoOrBuilder getUserInfoOrBuilder() { + if (userInfoBuilder_ != null) { + return userInfoBuilder_.getMessageOrBuilder(); + } else { + return userInfo_ == null + ? com.google.cloud.retail.v2.UserInfo.getDefaultInstance() + : userInfo_; + } + } + /** + * + * + *
+     * User information.
+     * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserInfo, + com.google.cloud.retail.v2.UserInfo.Builder, + com.google.cloud.retail.v2.UserInfoOrBuilder> + getUserInfoFieldBuilder() { + if (userInfoBuilder_ == null) { + userInfoBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserInfo, + com.google.cloud.retail.v2.UserInfo.Builder, + com.google.cloud.retail.v2.UserInfoOrBuilder>( + getUserInfo(), getParentForChildren(), isClean()); + userInfo_ = null; + } + return userInfoBuilder_; + } + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * Complete URL (window.location.href) of the user's current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically. Maximum length 5,000
+     * characters.
+     * 
+ * + * string uri = 13; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Complete URL (window.location.href) of the user's current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically. Maximum length 5,000
+     * characters.
+     * 
+ * + * string uri = 13; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Complete URL (window.location.href) of the user's current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically. Maximum length 5,000
+     * characters.
+     * 
+ * + * string uri = 13; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Complete URL (window.location.href) of the user's current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically. Maximum length 5,000
+     * characters.
+     * 
+ * + * string uri = 13; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * Complete URL (window.location.href) of the user's current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically. Maximum length 5,000
+     * characters.
+     * 
+ * + * string uri = 13; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = value; + onChanged(); + return this; + } + + private java.lang.Object referrerUri_ = ""; + /** + * + * + *
+     * The referrer URL of the current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string referrer_uri = 14; + * + * @return The referrerUri. + */ + public java.lang.String getReferrerUri() { + java.lang.Object ref = referrerUri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + referrerUri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The referrer URL of the current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string referrer_uri = 14; + * + * @return The bytes for referrerUri. + */ + public com.google.protobuf.ByteString getReferrerUriBytes() { + java.lang.Object ref = referrerUri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + referrerUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The referrer URL of the current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string referrer_uri = 14; + * + * @param value The referrerUri to set. + * @return This builder for chaining. + */ + public Builder setReferrerUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + referrerUri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The referrer URL of the current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string referrer_uri = 14; + * + * @return This builder for chaining. + */ + public Builder clearReferrerUri() { + + referrerUri_ = getDefaultInstance().getReferrerUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * The referrer URL of the current page.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string referrer_uri = 14; + * + * @param value The bytes for referrerUri to set. + * @return This builder for chaining. + */ + public Builder setReferrerUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + referrerUri_ = value; + onChanged(); + return this; + } + + private java.lang.Object pageViewId_ = ""; + /** + * + * + *
+     * A unique id of a web page view.
+     * This should be kept the same for all user events triggered from the same
+     * pageview. For example, an item detail page view could trigger multiple
+     * events as the user is browsing the page. The `pageViewId` property should
+     * be kept the same for all these events so that they can be grouped together
+     * properly.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string page_view_id = 15; + * + * @return The pageViewId. + */ + public java.lang.String getPageViewId() { + java.lang.Object ref = pageViewId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageViewId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A unique id of a web page view.
+     * This should be kept the same for all user events triggered from the same
+     * pageview. For example, an item detail page view could trigger multiple
+     * events as the user is browsing the page. The `pageViewId` property should
+     * be kept the same for all these events so that they can be grouped together
+     * properly.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string page_view_id = 15; + * + * @return The bytes for pageViewId. + */ + public com.google.protobuf.ByteString getPageViewIdBytes() { + java.lang.Object ref = pageViewId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageViewId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A unique id of a web page view.
+     * This should be kept the same for all user events triggered from the same
+     * pageview. For example, an item detail page view could trigger multiple
+     * events as the user is browsing the page. The `pageViewId` property should
+     * be kept the same for all these events so that they can be grouped together
+     * properly.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string page_view_id = 15; + * + * @param value The pageViewId to set. + * @return This builder for chaining. + */ + public Builder setPageViewId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageViewId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A unique id of a web page view.
+     * This should be kept the same for all user events triggered from the same
+     * pageview. For example, an item detail page view could trigger multiple
+     * events as the user is browsing the page. The `pageViewId` property should
+     * be kept the same for all these events so that they can be grouped together
+     * properly.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string page_view_id = 15; + * + * @return This builder for chaining. + */ + public Builder clearPageViewId() { + + pageViewId_ = getDefaultInstance().getPageViewId(); + onChanged(); + return this; + } + /** + * + * + *
+     * A unique id of a web page view.
+     * This should be kept the same for all user events triggered from the same
+     * pageview. For example, an item detail page view could trigger multiple
+     * events as the user is browsing the page. The `pageViewId` property should
+     * be kept the same for all these events so that they can be grouped together
+     * properly.
+     * When using the client side event reporting with JavaScript pixel and Google
+     * Tag Manager, this value is filled in automatically.
+     * 
+ * + * string page_view_id = 15; + * + * @param value The bytes for pageViewId to set. + * @return This builder for chaining. + */ + public Builder setPageViewIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageViewId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UserEvent) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UserEvent) + private static final com.google.cloud.retail.v2.UserEvent DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UserEvent(); + } + + public static com.google.cloud.retail.v2.UserEvent getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UserEvent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UserEvent(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEvent getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventImportSummary.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventImportSummary.java new file mode 100644 index 00000000..9c8374c0 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventImportSummary.java @@ -0,0 +1,642 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * A summary of import result. The UserEventImportSummary summarizes
+ * the import status for user events.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEventImportSummary} + */ +public final class UserEventImportSummary extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UserEventImportSummary) + UserEventImportSummaryOrBuilder { + private static final long serialVersionUID = 0L; + // Use UserEventImportSummary.newBuilder() to construct. + private UserEventImportSummary(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UserEventImportSummary() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UserEventImportSummary(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UserEventImportSummary( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + joinedEventsCount_ = input.readInt64(); + break; + } + case 16: + { + unjoinedEventsCount_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventImportSummary_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventImportSummary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEventImportSummary.class, + com.google.cloud.retail.v2.UserEventImportSummary.Builder.class); + } + + public static final int JOINED_EVENTS_COUNT_FIELD_NUMBER = 1; + private long joinedEventsCount_; + /** + * + * + *
+   * Count of user events imported with complete existing catalog information.
+   * 
+ * + * int64 joined_events_count = 1; + * + * @return The joinedEventsCount. + */ + @java.lang.Override + public long getJoinedEventsCount() { + return joinedEventsCount_; + } + + public static final int UNJOINED_EVENTS_COUNT_FIELD_NUMBER = 2; + private long unjoinedEventsCount_; + /** + * + * + *
+   * Count of user events imported, but with catalog information not found
+   * in the imported catalog.
+   * 
+ * + * int64 unjoined_events_count = 2; + * + * @return The unjoinedEventsCount. + */ + @java.lang.Override + public long getUnjoinedEventsCount() { + return unjoinedEventsCount_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (joinedEventsCount_ != 0L) { + output.writeInt64(1, joinedEventsCount_); + } + if (unjoinedEventsCount_ != 0L) { + output.writeInt64(2, unjoinedEventsCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (joinedEventsCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, joinedEventsCount_); + } + if (unjoinedEventsCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, unjoinedEventsCount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UserEventImportSummary)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UserEventImportSummary other = + (com.google.cloud.retail.v2.UserEventImportSummary) obj; + + if (getJoinedEventsCount() != other.getJoinedEventsCount()) return false; + if (getUnjoinedEventsCount() != other.getUnjoinedEventsCount()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + JOINED_EVENTS_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getJoinedEventsCount()); + hash = (37 * hash) + UNJOINED_EVENTS_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getUnjoinedEventsCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UserEventImportSummary prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A summary of import result. The UserEventImportSummary summarizes
+   * the import status for user events.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEventImportSummary} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UserEventImportSummary) + com.google.cloud.retail.v2.UserEventImportSummaryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventImportSummary_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventImportSummary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEventImportSummary.class, + com.google.cloud.retail.v2.UserEventImportSummary.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UserEventImportSummary.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + joinedEventsCount_ = 0L; + + unjoinedEventsCount_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventImportSummary_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventImportSummary getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UserEventImportSummary.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventImportSummary build() { + com.google.cloud.retail.v2.UserEventImportSummary result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventImportSummary buildPartial() { + com.google.cloud.retail.v2.UserEventImportSummary result = + new com.google.cloud.retail.v2.UserEventImportSummary(this); + result.joinedEventsCount_ = joinedEventsCount_; + result.unjoinedEventsCount_ = unjoinedEventsCount_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UserEventImportSummary) { + return mergeFrom((com.google.cloud.retail.v2.UserEventImportSummary) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UserEventImportSummary other) { + if (other == com.google.cloud.retail.v2.UserEventImportSummary.getDefaultInstance()) + return this; + if (other.getJoinedEventsCount() != 0L) { + setJoinedEventsCount(other.getJoinedEventsCount()); + } + if (other.getUnjoinedEventsCount() != 0L) { + setUnjoinedEventsCount(other.getUnjoinedEventsCount()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UserEventImportSummary parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.UserEventImportSummary) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long joinedEventsCount_; + /** + * + * + *
+     * Count of user events imported with complete existing catalog information.
+     * 
+ * + * int64 joined_events_count = 1; + * + * @return The joinedEventsCount. + */ + @java.lang.Override + public long getJoinedEventsCount() { + return joinedEventsCount_; + } + /** + * + * + *
+     * Count of user events imported with complete existing catalog information.
+     * 
+ * + * int64 joined_events_count = 1; + * + * @param value The joinedEventsCount to set. + * @return This builder for chaining. + */ + public Builder setJoinedEventsCount(long value) { + + joinedEventsCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Count of user events imported with complete existing catalog information.
+     * 
+ * + * int64 joined_events_count = 1; + * + * @return This builder for chaining. + */ + public Builder clearJoinedEventsCount() { + + joinedEventsCount_ = 0L; + onChanged(); + return this; + } + + private long unjoinedEventsCount_; + /** + * + * + *
+     * Count of user events imported, but with catalog information not found
+     * in the imported catalog.
+     * 
+ * + * int64 unjoined_events_count = 2; + * + * @return The unjoinedEventsCount. + */ + @java.lang.Override + public long getUnjoinedEventsCount() { + return unjoinedEventsCount_; + } + /** + * + * + *
+     * Count of user events imported, but with catalog information not found
+     * in the imported catalog.
+     * 
+ * + * int64 unjoined_events_count = 2; + * + * @param value The unjoinedEventsCount to set. + * @return This builder for chaining. + */ + public Builder setUnjoinedEventsCount(long value) { + + unjoinedEventsCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Count of user events imported, but with catalog information not found
+     * in the imported catalog.
+     * 
+ * + * int64 unjoined_events_count = 2; + * + * @return This builder for chaining. + */ + public Builder clearUnjoinedEventsCount() { + + unjoinedEventsCount_ = 0L; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UserEventImportSummary) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UserEventImportSummary) + private static final com.google.cloud.retail.v2.UserEventImportSummary DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UserEventImportSummary(); + } + + public static com.google.cloud.retail.v2.UserEventImportSummary getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UserEventImportSummary parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UserEventImportSummary(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventImportSummary getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventImportSummaryOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventImportSummaryOrBuilder.java new file mode 100644 index 00000000..354174fd --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventImportSummaryOrBuilder.java @@ -0,0 +1,52 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface UserEventImportSummaryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UserEventImportSummary) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Count of user events imported with complete existing catalog information.
+   * 
+ * + * int64 joined_events_count = 1; + * + * @return The joinedEventsCount. + */ + long getJoinedEventsCount(); + + /** + * + * + *
+   * Count of user events imported, but with catalog information not found
+   * in the imported catalog.
+   * 
+ * + * int64 unjoined_events_count = 2; + * + * @return The unjoinedEventsCount. + */ + long getUnjoinedEventsCount(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInlineSource.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInlineSource.java new file mode 100644 index 00000000..c94f3801 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInlineSource.java @@ -0,0 +1,993 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * The inline source for the input config for ImportUserEvents method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEventInlineSource} + */ +public final class UserEventInlineSource extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UserEventInlineSource) + UserEventInlineSourceOrBuilder { + private static final long serialVersionUID = 0L; + // Use UserEventInlineSource.newBuilder() to construct. + private UserEventInlineSource(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UserEventInlineSource() { + userEvents_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UserEventInlineSource(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UserEventInlineSource( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + userEvents_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + userEvents_.add( + input.readMessage( + com.google.cloud.retail.v2.UserEvent.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + userEvents_ = java.util.Collections.unmodifiableList(userEvents_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInlineSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInlineSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEventInlineSource.class, + com.google.cloud.retail.v2.UserEventInlineSource.Builder.class); + } + + public static final int USER_EVENTS_FIELD_NUMBER = 1; + private java.util.List userEvents_; + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public java.util.List getUserEventsList() { + return userEvents_; + } + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public java.util.List + getUserEventsOrBuilderList() { + return userEvents_; + } + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public int getUserEventsCount() { + return userEvents_.size(); + } + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEvent getUserEvents(int index) { + return userEvents_.get(index); + } + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventsOrBuilder(int index) { + return userEvents_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < userEvents_.size(); i++) { + output.writeMessage(1, userEvents_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < userEvents_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, userEvents_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UserEventInlineSource)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UserEventInlineSource other = + (com.google.cloud.retail.v2.UserEventInlineSource) obj; + + if (!getUserEventsList().equals(other.getUserEventsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getUserEventsCount() > 0) { + hash = (37 * hash) + USER_EVENTS_FIELD_NUMBER; + hash = (53 * hash) + getUserEventsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UserEventInlineSource prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The inline source for the input config for ImportUserEvents method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEventInlineSource} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UserEventInlineSource) + com.google.cloud.retail.v2.UserEventInlineSourceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInlineSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInlineSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEventInlineSource.class, + com.google.cloud.retail.v2.UserEventInlineSource.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UserEventInlineSource.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getUserEventsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (userEventsBuilder_ == null) { + userEvents_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + userEventsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInlineSource_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSource getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSource build() { + com.google.cloud.retail.v2.UserEventInlineSource result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSource buildPartial() { + com.google.cloud.retail.v2.UserEventInlineSource result = + new com.google.cloud.retail.v2.UserEventInlineSource(this); + int from_bitField0_ = bitField0_; + if (userEventsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + userEvents_ = java.util.Collections.unmodifiableList(userEvents_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.userEvents_ = userEvents_; + } else { + result.userEvents_ = userEventsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UserEventInlineSource) { + return mergeFrom((com.google.cloud.retail.v2.UserEventInlineSource) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UserEventInlineSource other) { + if (other == com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance()) + return this; + if (userEventsBuilder_ == null) { + if (!other.userEvents_.isEmpty()) { + if (userEvents_.isEmpty()) { + userEvents_ = other.userEvents_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureUserEventsIsMutable(); + userEvents_.addAll(other.userEvents_); + } + onChanged(); + } + } else { + if (!other.userEvents_.isEmpty()) { + if (userEventsBuilder_.isEmpty()) { + userEventsBuilder_.dispose(); + userEventsBuilder_ = null; + userEvents_ = other.userEvents_; + bitField0_ = (bitField0_ & ~0x00000001); + userEventsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getUserEventsFieldBuilder() + : null; + } else { + userEventsBuilder_.addAllMessages(other.userEvents_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UserEventInlineSource parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.UserEventInlineSource) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List userEvents_ = + java.util.Collections.emptyList(); + + private void ensureUserEventsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + userEvents_ = new java.util.ArrayList(userEvents_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder> + userEventsBuilder_; + + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List getUserEventsList() { + if (userEventsBuilder_ == null) { + return java.util.Collections.unmodifiableList(userEvents_); + } else { + return userEventsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getUserEventsCount() { + if (userEventsBuilder_ == null) { + return userEvents_.size(); + } else { + return userEventsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEvent getUserEvents(int index) { + if (userEventsBuilder_ == null) { + return userEvents_.get(index); + } else { + return userEventsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEvents(int index, com.google.cloud.retail.v2.UserEvent value) { + if (userEventsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureUserEventsIsMutable(); + userEvents_.set(index, value); + onChanged(); + } else { + userEventsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEvents( + int index, com.google.cloud.retail.v2.UserEvent.Builder builderForValue) { + if (userEventsBuilder_ == null) { + ensureUserEventsIsMutable(); + userEvents_.set(index, builderForValue.build()); + onChanged(); + } else { + userEventsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addUserEvents(com.google.cloud.retail.v2.UserEvent value) { + if (userEventsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureUserEventsIsMutable(); + userEvents_.add(value); + onChanged(); + } else { + userEventsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addUserEvents(int index, com.google.cloud.retail.v2.UserEvent value) { + if (userEventsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureUserEventsIsMutable(); + userEvents_.add(index, value); + onChanged(); + } else { + userEventsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addUserEvents(com.google.cloud.retail.v2.UserEvent.Builder builderForValue) { + if (userEventsBuilder_ == null) { + ensureUserEventsIsMutable(); + userEvents_.add(builderForValue.build()); + onChanged(); + } else { + userEventsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addUserEvents( + int index, com.google.cloud.retail.v2.UserEvent.Builder builderForValue) { + if (userEventsBuilder_ == null) { + ensureUserEventsIsMutable(); + userEvents_.add(index, builderForValue.build()); + onChanged(); + } else { + userEventsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addAllUserEvents( + java.lang.Iterable values) { + if (userEventsBuilder_ == null) { + ensureUserEventsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, userEvents_); + onChanged(); + } else { + userEventsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearUserEvents() { + if (userEventsBuilder_ == null) { + userEvents_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + userEventsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder removeUserEvents(int index) { + if (userEventsBuilder_ == null) { + ensureUserEventsIsMutable(); + userEvents_.remove(index); + onChanged(); + } else { + userEventsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEvent.Builder getUserEventsBuilder(int index) { + return getUserEventsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventsOrBuilder(int index) { + if (userEventsBuilder_ == null) { + return userEvents_.get(index); + } else { + return userEventsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getUserEventsOrBuilderList() { + if (userEventsBuilder_ != null) { + return userEventsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(userEvents_); + } + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEvent.Builder addUserEventsBuilder() { + return getUserEventsFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.UserEvent.getDefaultInstance()); + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEvent.Builder addUserEventsBuilder(int index) { + return getUserEventsFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.UserEvent.getDefaultInstance()); + } + /** + * + * + *
+     * Required. A list of user events to import. Recommended max of 10k items.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List getUserEventsBuilderList() { + return getUserEventsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder> + getUserEventsFieldBuilder() { + if (userEventsBuilder_ == null) { + userEventsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder>( + userEvents_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + userEvents_ = null; + } + return userEventsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UserEventInlineSource) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UserEventInlineSource) + private static final com.google.cloud.retail.v2.UserEventInlineSource DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UserEventInlineSource(); + } + + public static com.google.cloud.retail.v2.UserEventInlineSource getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UserEventInlineSource parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UserEventInlineSource(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSource getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInlineSourceOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInlineSourceOrBuilder.java new file mode 100644 index 00000000..5d261f81 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInlineSourceOrBuilder.java @@ -0,0 +1,87 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface UserEventInlineSourceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UserEventInlineSource) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getUserEventsList(); + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.UserEvent getUserEvents(int index); + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + int getUserEventsCount(); + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List + getUserEventsOrBuilderList(); + /** + * + * + *
+   * Required. A list of user events to import. Recommended max of 10k items.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.UserEvent user_events = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.UserEventOrBuilder getUserEventsOrBuilder(int index); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInputConfig.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInputConfig.java new file mode 100644 index 00000000..93259aa9 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInputConfig.java @@ -0,0 +1,1521 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * The input config source for user events.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEventInputConfig} + */ +public final class UserEventInputConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UserEventInputConfig) + UserEventInputConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use UserEventInputConfig.newBuilder() to construct. + private UserEventInputConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UserEventInputConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UserEventInputConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UserEventInputConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.UserEventInlineSource.Builder subBuilder = null; + if (sourceCase_ == 1) { + subBuilder = + ((com.google.cloud.retail.v2.UserEventInlineSource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.retail.v2.UserEventInlineSource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.UserEventInlineSource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 1; + break; + } + case 18: + { + com.google.cloud.retail.v2.GcsSource.Builder subBuilder = null; + if (sourceCase_ == 2) { + subBuilder = ((com.google.cloud.retail.v2.GcsSource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.retail.v2.GcsSource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.GcsSource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 2; + break; + } + case 26: + { + com.google.cloud.retail.v2.BigQuerySource.Builder subBuilder = null; + if (sourceCase_ == 3) { + subBuilder = ((com.google.cloud.retail.v2.BigQuerySource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.retail.v2.BigQuerySource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.BigQuerySource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 3; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEventInputConfig.class, + com.google.cloud.retail.v2.UserEventInputConfig.Builder.class); + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public enum SourceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + USER_EVENT_INLINE_SOURCE(1), + GCS_SOURCE(2), + BIG_QUERY_SOURCE(3), + SOURCE_NOT_SET(0); + private final int value; + + private SourceCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SourceCase valueOf(int value) { + return forNumber(value); + } + + public static SourceCase forNumber(int value) { + switch (value) { + case 1: + return USER_EVENT_INLINE_SOURCE; + case 2: + return GCS_SOURCE; + case 3: + return BIG_QUERY_SOURCE; + case 0: + return SOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public static final int USER_EVENT_INLINE_SOURCE_FIELD_NUMBER = 1; + /** + * + * + *
+   * Required. The Inline source for the input content for UserEvents.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEventInlineSource field is set. + */ + @java.lang.Override + public boolean hasUserEventInlineSource() { + return sourceCase_ == 1; + } + /** + * + * + *
+   * Required. The Inline source for the input content for UserEvents.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEventInlineSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSource getUserEventInlineSource() { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.UserEventInlineSource) source_; + } + return com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance(); + } + /** + * + * + *
+   * Required. The Inline source for the input content for UserEvents.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSourceOrBuilder + getUserEventInlineSourceOrBuilder() { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.UserEventInlineSource) source_; + } + return com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance(); + } + + public static final int GCS_SOURCE_FIELD_NUMBER = 2; + /** + * + * + *
+   * Required. Google Cloud Storage location for the input content.
+   * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the gcsSource field is set. + */ + @java.lang.Override + public boolean hasGcsSource() { + return sourceCase_ == 2; + } + /** + * + * + *
+   * Required. Google Cloud Storage location for the input content.
+   * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The gcsSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource getGcsSource() { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + /** + * + * + *
+   * Required. Google Cloud Storage location for the input content.
+   * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + + public static final int BIG_QUERY_SOURCE_FIELD_NUMBER = 3; + /** + * + * + *
+   * Required. BigQuery input source.
+   * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the bigQuerySource field is set. + */ + @java.lang.Override + public boolean hasBigQuerySource() { + return sourceCase_ == 3; + } + /** + * + * + *
+   * Required. BigQuery input source.
+   * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The bigQuerySource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource getBigQuerySource() { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + /** + * + * + *
+   * Required. BigQuery input source.
+   * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySourceOrBuilder getBigQuerySourceOrBuilder() { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (sourceCase_ == 1) { + output.writeMessage(1, (com.google.cloud.retail.v2.UserEventInlineSource) source_); + } + if (sourceCase_ == 2) { + output.writeMessage(2, (com.google.cloud.retail.v2.GcsSource) source_); + } + if (sourceCase_ == 3) { + output.writeMessage(3, (com.google.cloud.retail.v2.BigQuerySource) source_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sourceCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.cloud.retail.v2.UserEventInlineSource) source_); + } + if (sourceCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.retail.v2.GcsSource) source_); + } + if (sourceCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.cloud.retail.v2.BigQuerySource) source_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UserEventInputConfig)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UserEventInputConfig other = + (com.google.cloud.retail.v2.UserEventInputConfig) obj; + + if (!getSourceCase().equals(other.getSourceCase())) return false; + switch (sourceCase_) { + case 1: + if (!getUserEventInlineSource().equals(other.getUserEventInlineSource())) return false; + break; + case 2: + if (!getGcsSource().equals(other.getGcsSource())) return false; + break; + case 3: + if (!getBigQuerySource().equals(other.getBigQuerySource())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (sourceCase_) { + case 1: + hash = (37 * hash) + USER_EVENT_INLINE_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getUserEventInlineSource().hashCode(); + break; + case 2: + hash = (37 * hash) + GCS_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getGcsSource().hashCode(); + break; + case 3: + hash = (37 * hash) + BIG_QUERY_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getBigQuerySource().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UserEventInputConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The input config source for user events.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserEventInputConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UserEventInputConfig) + com.google.cloud.retail.v2.UserEventInputConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserEventInputConfig.class, + com.google.cloud.retail.v2.UserEventInputConfig.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UserEventInputConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + sourceCase_ = 0; + source_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ImportConfigProto + .internal_static_google_cloud_retail_v2_UserEventInputConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInputConfig getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UserEventInputConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInputConfig build() { + com.google.cloud.retail.v2.UserEventInputConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInputConfig buildPartial() { + com.google.cloud.retail.v2.UserEventInputConfig result = + new com.google.cloud.retail.v2.UserEventInputConfig(this); + if (sourceCase_ == 1) { + if (userEventInlineSourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = userEventInlineSourceBuilder_.build(); + } + } + if (sourceCase_ == 2) { + if (gcsSourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = gcsSourceBuilder_.build(); + } + } + if (sourceCase_ == 3) { + if (bigQuerySourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = bigQuerySourceBuilder_.build(); + } + } + result.sourceCase_ = sourceCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UserEventInputConfig) { + return mergeFrom((com.google.cloud.retail.v2.UserEventInputConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UserEventInputConfig other) { + if (other == com.google.cloud.retail.v2.UserEventInputConfig.getDefaultInstance()) + return this; + switch (other.getSourceCase()) { + case USER_EVENT_INLINE_SOURCE: + { + mergeUserEventInlineSource(other.getUserEventInlineSource()); + break; + } + case GCS_SOURCE: + { + mergeGcsSource(other.getGcsSource()); + break; + } + case BIG_QUERY_SOURCE: + { + mergeBigQuerySource(other.getBigQuerySource()); + break; + } + case SOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UserEventInputConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.UserEventInputConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public Builder clearSource() { + sourceCase_ = 0; + source_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventInlineSource, + com.google.cloud.retail.v2.UserEventInlineSource.Builder, + com.google.cloud.retail.v2.UserEventInlineSourceOrBuilder> + userEventInlineSourceBuilder_; + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEventInlineSource field is set. + */ + @java.lang.Override + public boolean hasUserEventInlineSource() { + return sourceCase_ == 1; + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEventInlineSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSource getUserEventInlineSource() { + if (userEventInlineSourceBuilder_ == null) { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.UserEventInlineSource) source_; + } + return com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance(); + } else { + if (sourceCase_ == 1) { + return userEventInlineSourceBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEventInlineSource( + com.google.cloud.retail.v2.UserEventInlineSource value) { + if (userEventInlineSourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + userEventInlineSourceBuilder_.setMessage(value); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEventInlineSource( + com.google.cloud.retail.v2.UserEventInlineSource.Builder builderForValue) { + if (userEventInlineSourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + userEventInlineSourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeUserEventInlineSource( + com.google.cloud.retail.v2.UserEventInlineSource value) { + if (userEventInlineSourceBuilder_ == null) { + if (sourceCase_ == 1 + && source_ != com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance()) { + source_ = + com.google.cloud.retail.v2.UserEventInlineSource.newBuilder( + (com.google.cloud.retail.v2.UserEventInlineSource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 1) { + userEventInlineSourceBuilder_.mergeFrom(value); + } + userEventInlineSourceBuilder_.setMessage(value); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearUserEventInlineSource() { + if (userEventInlineSourceBuilder_ == null) { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + } + userEventInlineSourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEventInlineSource.Builder + getUserEventInlineSourceBuilder() { + return getUserEventInlineSourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInlineSourceOrBuilder + getUserEventInlineSourceOrBuilder() { + if ((sourceCase_ == 1) && (userEventInlineSourceBuilder_ != null)) { + return userEventInlineSourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 1) { + return (com.google.cloud.retail.v2.UserEventInlineSource) source_; + } + return com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. The Inline source for the input content for UserEvents.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventInlineSource, + com.google.cloud.retail.v2.UserEventInlineSource.Builder, + com.google.cloud.retail.v2.UserEventInlineSourceOrBuilder> + getUserEventInlineSourceFieldBuilder() { + if (userEventInlineSourceBuilder_ == null) { + if (!(sourceCase_ == 1)) { + source_ = com.google.cloud.retail.v2.UserEventInlineSource.getDefaultInstance(); + } + userEventInlineSourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEventInlineSource, + com.google.cloud.retail.v2.UserEventInlineSource.Builder, + com.google.cloud.retail.v2.UserEventInlineSourceOrBuilder>( + (com.google.cloud.retail.v2.UserEventInlineSource) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 1; + onChanged(); + ; + return userEventInlineSourceBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.GcsSource, + com.google.cloud.retail.v2.GcsSource.Builder, + com.google.cloud.retail.v2.GcsSourceOrBuilder> + gcsSourceBuilder_; + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the gcsSource field is set. + */ + @java.lang.Override + public boolean hasGcsSource() { + return sourceCase_ == 2; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The gcsSource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSource getGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } else { + if (sourceCase_ == 2) { + return gcsSourceBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setGcsSource(com.google.cloud.retail.v2.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setGcsSource(com.google.cloud.retail.v2.GcsSource.Builder builderForValue) { + if (gcsSourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + gcsSourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeGcsSource(com.google.cloud.retail.v2.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2 + && source_ != com.google.cloud.retail.v2.GcsSource.getDefaultInstance()) { + source_ = + com.google.cloud.retail.v2.GcsSource.newBuilder( + (com.google.cloud.retail.v2.GcsSource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 2) { + gcsSourceBuilder_.mergeFrom(value); + } + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + } + gcsSourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.GcsSource.Builder getGcsSourceBuilder() { + return getGcsSourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if ((sourceCase_ == 2) && (gcsSourceBuilder_ != null)) { + return gcsSourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 2) { + return (com.google.cloud.retail.v2.GcsSource) source_; + } + return com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the input content.
+     * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.GcsSource, + com.google.cloud.retail.v2.GcsSource.Builder, + com.google.cloud.retail.v2.GcsSourceOrBuilder> + getGcsSourceFieldBuilder() { + if (gcsSourceBuilder_ == null) { + if (!(sourceCase_ == 2)) { + source_ = com.google.cloud.retail.v2.GcsSource.getDefaultInstance(); + } + gcsSourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.GcsSource, + com.google.cloud.retail.v2.GcsSource.Builder, + com.google.cloud.retail.v2.GcsSourceOrBuilder>( + (com.google.cloud.retail.v2.GcsSource) source_, getParentForChildren(), isClean()); + source_ = null; + } + sourceCase_ = 2; + onChanged(); + ; + return gcsSourceBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.BigQuerySource, + com.google.cloud.retail.v2.BigQuerySource.Builder, + com.google.cloud.retail.v2.BigQuerySourceOrBuilder> + bigQuerySourceBuilder_; + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the bigQuerySource field is set. + */ + @java.lang.Override + public boolean hasBigQuerySource() { + return sourceCase_ == 3; + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The bigQuerySource. + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySource getBigQuerySource() { + if (bigQuerySourceBuilder_ == null) { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } else { + if (sourceCase_ == 3) { + return bigQuerySourceBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBigQuerySource(com.google.cloud.retail.v2.BigQuerySource value) { + if (bigQuerySourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + bigQuerySourceBuilder_.setMessage(value); + } + sourceCase_ = 3; + return this; + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBigQuerySource( + com.google.cloud.retail.v2.BigQuerySource.Builder builderForValue) { + if (bigQuerySourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + bigQuerySourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 3; + return this; + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeBigQuerySource(com.google.cloud.retail.v2.BigQuerySource value) { + if (bigQuerySourceBuilder_ == null) { + if (sourceCase_ == 3 + && source_ != com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance()) { + source_ = + com.google.cloud.retail.v2.BigQuerySource.newBuilder( + (com.google.cloud.retail.v2.BigQuerySource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 3) { + bigQuerySourceBuilder_.mergeFrom(value); + } + bigQuerySourceBuilder_.setMessage(value); + } + sourceCase_ = 3; + return this; + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearBigQuerySource() { + if (bigQuerySourceBuilder_ == null) { + if (sourceCase_ == 3) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 3) { + sourceCase_ = 0; + source_ = null; + } + bigQuerySourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.BigQuerySource.Builder getBigQuerySourceBuilder() { + return getBigQuerySourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.BigQuerySourceOrBuilder getBigQuerySourceOrBuilder() { + if ((sourceCase_ == 3) && (bigQuerySourceBuilder_ != null)) { + return bigQuerySourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 3) { + return (com.google.cloud.retail.v2.BigQuerySource) source_; + } + return com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. BigQuery input source.
+     * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.BigQuerySource, + com.google.cloud.retail.v2.BigQuerySource.Builder, + com.google.cloud.retail.v2.BigQuerySourceOrBuilder> + getBigQuerySourceFieldBuilder() { + if (bigQuerySourceBuilder_ == null) { + if (!(sourceCase_ == 3)) { + source_ = com.google.cloud.retail.v2.BigQuerySource.getDefaultInstance(); + } + bigQuerySourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.BigQuerySource, + com.google.cloud.retail.v2.BigQuerySource.Builder, + com.google.cloud.retail.v2.BigQuerySourceOrBuilder>( + (com.google.cloud.retail.v2.BigQuerySource) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 3; + onChanged(); + ; + return bigQuerySourceBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UserEventInputConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UserEventInputConfig) + private static final com.google.cloud.retail.v2.UserEventInputConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UserEventInputConfig(); + } + + public static com.google.cloud.retail.v2.UserEventInputConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UserEventInputConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UserEventInputConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserEventInputConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInputConfigOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInputConfigOrBuilder.java new file mode 100644 index 00000000..44f156a9 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventInputConfigOrBuilder.java @@ -0,0 +1,150 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/import_config.proto + +package com.google.cloud.retail.v2; + +public interface UserEventInputConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UserEventInputConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Inline source for the input content for UserEvents.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEventInlineSource field is set. + */ + boolean hasUserEventInlineSource(); + /** + * + * + *
+   * Required. The Inline source for the input content for UserEvents.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEventInlineSource. + */ + com.google.cloud.retail.v2.UserEventInlineSource getUserEventInlineSource(); + /** + * + * + *
+   * Required. The Inline source for the input content for UserEvents.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEventInlineSource user_event_inline_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.UserEventInlineSourceOrBuilder getUserEventInlineSourceOrBuilder(); + + /** + * + * + *
+   * Required. Google Cloud Storage location for the input content.
+   * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the gcsSource field is set. + */ + boolean hasGcsSource(); + /** + * + * + *
+   * Required. Google Cloud Storage location for the input content.
+   * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The gcsSource. + */ + com.google.cloud.retail.v2.GcsSource getGcsSource(); + /** + * + * + *
+   * Required. Google Cloud Storage location for the input content.
+   * 
+ * + * + * .google.cloud.retail.v2.GcsSource gcs_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.GcsSourceOrBuilder getGcsSourceOrBuilder(); + + /** + * + * + *
+   * Required. BigQuery input source.
+   * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the bigQuerySource field is set. + */ + boolean hasBigQuerySource(); + /** + * + * + *
+   * Required. BigQuery input source.
+   * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The bigQuerySource. + */ + com.google.cloud.retail.v2.BigQuerySource getBigQuerySource(); + /** + * + * + *
+   * Required. BigQuery input source.
+   * 
+ * + * + * .google.cloud.retail.v2.BigQuerySource big_query_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.BigQuerySourceOrBuilder getBigQuerySourceOrBuilder(); + + public com.google.cloud.retail.v2.UserEventInputConfig.SourceCase getSourceCase(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventOrBuilder.java new file mode 100644 index 00000000..ccc43da7 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventOrBuilder.java @@ -0,0 +1,776 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event.proto + +package com.google.cloud.retail.v2; + +public interface UserEventOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UserEvent) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. User event type. Allowed values are:
+   * * `add-to-cart`: Products being added to cart.
+   * * `category-page-view`: Special pages such as sale or promotion pages
+   *   viewed.
+   * * `detail-page-view`: Products detail page viewed.
+   * * `home-page-view`: Homepage viewed.
+   * * `purchase-complete`: User finishing a purchase.
+   * * `search`: Product search.
+   * * `shopping-cart-page-view`: User viewing a shopping cart.
+   * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The eventType. + */ + java.lang.String getEventType(); + /** + * + * + *
+   * Required. User event type. Allowed values are:
+   * * `add-to-cart`: Products being added to cart.
+   * * `category-page-view`: Special pages such as sale or promotion pages
+   *   viewed.
+   * * `detail-page-view`: Products detail page viewed.
+   * * `home-page-view`: Homepage viewed.
+   * * `purchase-complete`: User finishing a purchase.
+   * * `search`: Product search.
+   * * `shopping-cart-page-view`: User viewing a shopping cart.
+   * 
+ * + * string event_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for eventType. + */ + com.google.protobuf.ByteString getEventTypeBytes(); + + /** + * + * + *
+   * Required. A unique identifier for tracking visitors.
+   * For example, this could be implemented with an HTTP cookie, which should be
+   * able to uniquely identify a visitor on a single device. This unique
+   * identifier should not change if the visitor log in/out of the website.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The visitorId. + */ + java.lang.String getVisitorId(); + /** + * + * + *
+   * Required. A unique identifier for tracking visitors.
+   * For example, this could be implemented with an HTTP cookie, which should be
+   * able to uniquely identify a visitor on a single device. This unique
+   * identifier should not change if the visitor log in/out of the website.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string visitor_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for visitorId. + */ + com.google.protobuf.ByteString getVisitorIdBytes(); + + /** + * + * + *
+   * Only required for
+   * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+   * method. Timestamp of when the user event happened.
+   * 
+ * + * .google.protobuf.Timestamp event_time = 3; + * + * @return Whether the eventTime field is set. + */ + boolean hasEventTime(); + /** + * + * + *
+   * Only required for
+   * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+   * method. Timestamp of when the user event happened.
+   * 
+ * + * .google.protobuf.Timestamp event_time = 3; + * + * @return The eventTime. + */ + com.google.protobuf.Timestamp getEventTime(); + /** + * + * + *
+   * Only required for
+   * [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
+   * method. Timestamp of when the user event happened.
+   * 
+ * + * .google.protobuf.Timestamp event_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getEventTimeOrBuilder(); + + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @return A list containing the experimentIds. + */ + java.util.List getExperimentIdsList(); + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @return The count of experimentIds. + */ + int getExperimentIdsCount(); + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @param index The index of the element to return. + * @return The experimentIds at the given index. + */ + java.lang.String getExperimentIds(int index); + /** + * + * + *
+   * A list of identifiers for the independent experiment groups this user event
+   * belongs to. This is used to distinguish between user events associated with
+   * different experiment setups (e.g. using Retail API, using different
+   * recommendation models).
+   * 
+ * + * repeated string experiment_ids = 4; + * + * @param index The index of the value to return. + * @return The bytes of the experimentIds at the given index. + */ + com.google.protobuf.ByteString getExperimentIdsBytes(int index); + + /** + * + * + *
+   * Highly recommended for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This field enables accurate attribution of recommendation model
+   * performance.
+   * The value must be a valid
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This token enables us to accurately attribute page view or purchase back to
+   * the event and the particular predict response containing this
+   * clicked/purchased product. If user clicks on product K in the
+   * recommendation results, pass
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * as a URL parameter to product K's page. When recording events on product
+   * K's page, log the
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * to this field.
+   * 
+ * + * string attribution_token = 5; + * + * @return The attributionToken. + */ + java.lang.String getAttributionToken(); + /** + * + * + *
+   * Highly recommended for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This field enables accurate attribution of recommendation model
+   * performance.
+   * The value must be a valid
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * for user events that are the result of
+   * [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
+   * This token enables us to accurately attribute page view or purchase back to
+   * the event and the particular predict response containing this
+   * clicked/purchased product. If user clicks on product K in the
+   * recommendation results, pass
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * as a URL parameter to product K's page. When recording events on product
+   * K's page, log the
+   * [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
+   * to this field.
+   * 
+ * + * string attribution_token = 5; + * + * @return The bytes for attributionToken. + */ + com.google.protobuf.ByteString getAttributionTokenBytes(); + + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + java.util.List getProductDetailsList(); + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + com.google.cloud.retail.v2.ProductDetail getProductDetails(int index); + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + int getProductDetailsCount(); + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + java.util.List + getProductDetailsOrBuilderList(); + /** + * + * + *
+   * The main product details related to the event.
+   * This field is required for the following event types:
+   * * `add-to-cart`
+   * * `detail-page-view`
+   * * `purchase-complete`
+   * In a `search` event, this field represents the products returned to the end
+   * user on the current page (the end user may have not finished broswing the
+   * whole page yet). When a new page is returned to the end user, after
+   * pagination/filtering/ordering even for the same query, a new `search` event
+   * with different
+   * [product_details][google.cloud.retail.v2.UserEvent.product_details] is
+   * desired. The end user may have not finished broswing the whole page yet.
+   * 
+ * + * repeated .google.cloud.retail.v2.ProductDetail product_details = 6; + */ + com.google.cloud.retail.v2.ProductDetailOrBuilder getProductDetailsOrBuilder(int index); + + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + int getAttributesCount(); + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + boolean containsAttributes(java.lang.String key); + /** Use {@link #getAttributesMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAttributes(); + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + java.util.Map getAttributesMap(); + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CustomAttribute defaultValue); + /** + * + * + *
+   * Extra user event features to include in the recommendation model.
+   * The key must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * For product recommendation, an example of extra user information is
+   * traffic_channel, i.e. how user arrives at the site. Users can arrive
+   * at the site by coming to the site directly, or coming through Google
+   * search, and etc.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 7; + */ + com.google.cloud.retail.v2.CustomAttribute getAttributesOrThrow(java.lang.String key); + + /** + * + * + *
+   * The id or name of the associated shopping cart. This id is used
+   * to associate multiple items added or present in the cart before purchase.
+   * This can only be set for `add-to-cart`, `purchase-complete`, or
+   * `shopping-cart-page-view` events.
+   * 
+ * + * string cart_id = 8; + * + * @return The cartId. + */ + java.lang.String getCartId(); + /** + * + * + *
+   * The id or name of the associated shopping cart. This id is used
+   * to associate multiple items added or present in the cart before purchase.
+   * This can only be set for `add-to-cart`, `purchase-complete`, or
+   * `shopping-cart-page-view` events.
+   * 
+ * + * string cart_id = 8; + * + * @return The bytes for cartId. + */ + com.google.protobuf.ByteString getCartIdBytes(); + + /** + * + * + *
+   * A transaction represents the entire purchase transaction.
+   * Required for `purchase-complete` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + * + * @return Whether the purchaseTransaction field is set. + */ + boolean hasPurchaseTransaction(); + /** + * + * + *
+   * A transaction represents the entire purchase transaction.
+   * Required for `purchase-complete` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + * + * @return The purchaseTransaction. + */ + com.google.cloud.retail.v2.PurchaseTransaction getPurchaseTransaction(); + /** + * + * + *
+   * A transaction represents the entire purchase transaction.
+   * Required for `purchase-complete` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * .google.cloud.retail.v2.PurchaseTransaction purchase_transaction = 9; + */ + com.google.cloud.retail.v2.PurchaseTransactionOrBuilder getPurchaseTransactionOrBuilder(); + + /** + * + * + *
+   * The user's search query.
+   * The value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Required for `search` events. Other event types should not set this field.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string search_query = 10; + * + * @return The searchQuery. + */ + java.lang.String getSearchQuery(); + /** + * + * + *
+   * The user's search query.
+   * The value must be a UTF-8 encoded string with a length limit of 5,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * Required for `search` events. Other event types should not set this field.
+   * Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string search_query = 10; + * + * @return The bytes for searchQuery. + */ + com.google.protobuf.ByteString getSearchQueryBytes(); + + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @return A list containing the pageCategories. + */ + java.util.List getPageCategoriesList(); + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @return The count of pageCategories. + */ + int getPageCategoriesCount(); + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @param index The index of the element to return. + * @return The pageCategories at the given index. + */ + java.lang.String getPageCategories(int index); + /** + * + * + *
+   * The categories associated with a category page.
+   * To represent full path of category, use '>' sign to separate different
+   * hierarchies. If '>' is part of the category name, please replace it with
+   * other character(s).
+   * Category pages include special pages such as sales or promotions. For
+   * instance, a special sale page may have the category hierarchy:
+   * "pageCategories" : ["Sales > 2017 Black Friday Deals"].
+   * Required for `category-page-view` events. Other event types should not set
+   * this field. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * repeated string page_categories = 11; + * + * @param index The index of the value to return. + * @return The bytes of the pageCategories at the given index. + */ + com.google.protobuf.ByteString getPageCategoriesBytes(int index); + + /** + * + * + *
+   * User information.
+   * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + * + * @return Whether the userInfo field is set. + */ + boolean hasUserInfo(); + /** + * + * + *
+   * User information.
+   * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + * + * @return The userInfo. + */ + com.google.cloud.retail.v2.UserInfo getUserInfo(); + /** + * + * + *
+   * User information.
+   * 
+ * + * .google.cloud.retail.v2.UserInfo user_info = 12; + */ + com.google.cloud.retail.v2.UserInfoOrBuilder getUserInfoOrBuilder(); + + /** + * + * + *
+   * Complete URL (window.location.href) of the user's current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically. Maximum length 5,000
+   * characters.
+   * 
+ * + * string uri = 13; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * Complete URL (window.location.href) of the user's current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically. Maximum length 5,000
+   * characters.
+   * 
+ * + * string uri = 13; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * The referrer URL of the current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string referrer_uri = 14; + * + * @return The referrerUri. + */ + java.lang.String getReferrerUri(); + /** + * + * + *
+   * The referrer URL of the current page.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string referrer_uri = 14; + * + * @return The bytes for referrerUri. + */ + com.google.protobuf.ByteString getReferrerUriBytes(); + + /** + * + * + *
+   * A unique id of a web page view.
+   * This should be kept the same for all user events triggered from the same
+   * pageview. For example, an item detail page view could trigger multiple
+   * events as the user is browsing the page. The `pageViewId` property should
+   * be kept the same for all these events so that they can be grouped together
+   * properly.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string page_view_id = 15; + * + * @return The pageViewId. + */ + java.lang.String getPageViewId(); + /** + * + * + *
+   * A unique id of a web page view.
+   * This should be kept the same for all user events triggered from the same
+   * pageview. For example, an item detail page view could trigger multiple
+   * events as the user is browsing the page. The `pageViewId` property should
+   * be kept the same for all these events so that they can be grouped together
+   * properly.
+   * When using the client side event reporting with JavaScript pixel and Google
+   * Tag Manager, this value is filled in automatically.
+   * 
+ * + * string page_view_id = 15; + * + * @return The bytes for pageViewId. + */ + com.google.protobuf.ByteString getPageViewIdBytes(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventProto.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventProto.java new file mode 100644 index 00000000..d7ff4ff4 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventProto.java @@ -0,0 +1,161 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event.proto + +package com.google.cloud.retail.v2; + +public final class UserEventProto { + private UserEventProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_UserEvent_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_UserEvent_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_UserEvent_AttributesEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_UserEvent_AttributesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ProductDetail_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ProductDetail_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_PurchaseTransaction_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_PurchaseTransaction_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\'google/cloud/retail/v2/user_event.prot" + + "o\022\026google.cloud.retail.v2\032\034google/api/an" + + "notations.proto\032\037google/api/field_behavi" + + "or.proto\032#google/cloud/retail/v2/common." + + "proto\032$google/cloud/retail/v2/product.pr" + + "oto\032\037google/protobuf/timestamp.proto\032\036go" + + "ogle/protobuf/wrappers.proto\"\374\004\n\tUserEve" + + "nt\022\027\n\nevent_type\030\001 \001(\tB\003\340A\002\022\027\n\nvisitor_i" + + "d\030\002 \001(\tB\003\340A\002\022.\n\nevent_time\030\003 \001(\0132\032.googl" + + "e.protobuf.Timestamp\022\026\n\016experiment_ids\030\004" + + " \003(\t\022\031\n\021attribution_token\030\005 \001(\t\022>\n\017produ" + + "ct_details\030\006 \003(\0132%.google.cloud.retail.v" + + "2.ProductDetail\022E\n\nattributes\030\007 \003(\01321.go" + + "ogle.cloud.retail.v2.UserEvent.Attribute" + + "sEntry\022\017\n\007cart_id\030\010 \001(\t\022I\n\024purchase_tran" + + "saction\030\t \001(\0132+.google.cloud.retail.v2.P" + + "urchaseTransaction\022\024\n\014search_query\030\n \001(\t" + + "\022\027\n\017page_categories\030\013 \003(\t\0223\n\tuser_info\030\014" + + " \001(\0132 .google.cloud.retail.v2.UserInfo\022\013" + + "\n\003uri\030\r \001(\t\022\024\n\014referrer_uri\030\016 \001(\t\022\024\n\014pag" + + "e_view_id\030\017 \001(\t\032Z\n\017AttributesEntry\022\013\n\003ke" + + "y\030\001 \001(\t\0226\n\005value\030\002 \001(\0132\'.google.cloud.re" + + "tail.v2.CustomAttribute:\0028\001\"u\n\rProductDe" + + "tail\0225\n\007product\030\001 \001(\0132\037.google.cloud.ret" + + "ail.v2.ProductB\003\340A\002\022-\n\010quantity\030\002 \001(\0132\033." + + "google.protobuf.Int32Value\"n\n\023PurchaseTr" + + "ansaction\022\n\n\002id\030\001 \001(\t\022\024\n\007revenue\030\002 \001(\002B\003" + + "\340A\002\022\013\n\003tax\030\003 \001(\002\022\014\n\004cost\030\004 \001(\002\022\032\n\rcurren" + + "cy_code\030\005 \001(\tB\003\340A\002B\303\001\n\032com.google.cloud." + + "retail.v2B\016UserEventProtoP\001Z\n\030RejoinUserEventsRespo" + + "nse\022\"\n\032rejoined_user_events_count\030\001 \001(\003\"" + + "\032\n\030RejoinUserEventsMetadata2\277\t\n\020UserEven" + + "tService\022\267\001\n\016WriteUserEvent\022-.google.clo" + + "ud.retail.v2.WriteUserEventRequest\032!.goo" + + "gle.cloud.retail.v2.UserEvent\"S\202\323\344\223\002M\"?/" + + "v2/{parent=projects/*/locations/*/catalo" + + "gs/*}/userEvents:write:\nuser_event\022\244\001\n\020C" + + "ollectUserEvent\022/.google.cloud.retail.v2" + + ".CollectUserEventRequest\032\024.google.api.Ht" + + "tpBody\"I\202\323\344\223\002C\022A/v2/{parent=projects/*/l" + + "ocations/*/catalogs/*}/userEvents:collec" + + "t\022\206\002\n\017PurgeUserEvents\022..google.cloud.ret" + + "ail.v2.PurgeUserEventsRequest\032\035.google.l" + + "ongrunning.Operation\"\243\001\202\323\344\223\002D\"?/v2/{pare" + + "nt=projects/*/locations/*/catalogs/*}/us" + + "erEvents:purge:\001*\312AV\n.google.cloud.retai" + + "l.v2.PurgeUserEventsResponse\022$google.clo" + + "ud.retail.v2.PurgeMetadata\022\213\002\n\020ImportUse" + + "rEvents\022/.google.cloud.retail.v2.ImportU" + + "serEventsRequest\032\035.google.longrunning.Op" + + "eration\"\246\001\202\323\344\223\002E\"@/v2/{parent=projects/*" + + "/locations/*/catalogs/*}/userEvents:impo" + + "rt:\001*\312AX\n/google.cloud.retail.v2.ImportU" + + "serEventsResponse\022%google.cloud.retail.v" + + "2.ImportMetadata\022\347\001\n\020RejoinUserEvents\022/." + + "google.cloud.retail.v2.RejoinUserEventsR" + + "equest\032\035.google.longrunning.Operation\"\202\001" + + "\202\323\344\223\002E\"@/v2/{parent=projects/*/locations" + + "/*/catalogs/*}/userEvents:rejoin:\001*\312A4\n\030" + + "RejoinUserEventsResponse\022\030RejoinUserEven" + + "tsMetadata\032I\312A\025retail.googleapis.com\322A.h" + + "ttps://www.googleapis.com/auth/cloud-pla" + + "tformB\312\001\n\032com.google.cloud.retail.v2B\025Us" + + "erEventServiceProtoP\001Z + * Information of an end user. + * + * + * Protobuf type {@code google.cloud.retail.v2.UserInfo} + */ +public final class UserInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UserInfo) + UserInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use UserInfo.newBuilder() to construct. + private UserInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UserInfo() { + userId_ = ""; + ipAddress_ = ""; + userAgent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UserInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UserInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + userId_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + ipAddress_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + userAgent_ = s; + break; + } + case 32: + { + directUserRequest_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_UserInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_UserInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserInfo.class, + com.google.cloud.retail.v2.UserInfo.Builder.class); + } + + public static final int USER_ID_FIELD_NUMBER = 1; + private volatile java.lang.Object userId_; + /** + * + * + *
+   * Highly recommended for logged-in users. Unique identifier for logged-in
+   * user, such as a user name.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string user_id = 1; + * + * @return The userId. + */ + @java.lang.Override + public java.lang.String getUserId() { + java.lang.Object ref = userId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + userId_ = s; + return s; + } + } + /** + * + * + *
+   * Highly recommended for logged-in users. Unique identifier for logged-in
+   * user, such as a user name.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string user_id = 1; + * + * @return The bytes for userId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUserIdBytes() { + java.lang.Object ref = userId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + userId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int IP_ADDRESS_FIELD_NUMBER = 2; + private volatile java.lang.Object ipAddress_; + /** + * + * + *
+   * The end user's IP address. This field is used to extract location
+   * information for personalization.
+   * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+   * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This should not be set when using the JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string ip_address = 2; + * + * @return The ipAddress. + */ + @java.lang.Override + public java.lang.String getIpAddress() { + java.lang.Object ref = ipAddress_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + ipAddress_ = s; + return s; + } + } + /** + * + * + *
+   * The end user's IP address. This field is used to extract location
+   * information for personalization.
+   * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+   * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This should not be set when using the JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string ip_address = 2; + * + * @return The bytes for ipAddress. + */ + @java.lang.Override + public com.google.protobuf.ByteString getIpAddressBytes() { + java.lang.Object ref = ipAddress_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + ipAddress_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USER_AGENT_FIELD_NUMBER = 3; + private volatile java.lang.Object userAgent_; + /** + * + * + *
+   * User agent as included in the HTTP header.
+   * The field must be a UTF-8 encoded string with a length limit of 1,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * This should not be set when using the client side event reporting with
+   * GTM or JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string user_agent = 3; + * + * @return The userAgent. + */ + @java.lang.Override + public java.lang.String getUserAgent() { + java.lang.Object ref = userAgent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + userAgent_ = s; + return s; + } + } + /** + * + * + *
+   * User agent as included in the HTTP header.
+   * The field must be a UTF-8 encoded string with a length limit of 1,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * This should not be set when using the client side event reporting with
+   * GTM or JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string user_agent = 3; + * + * @return The bytes for userAgent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUserAgentBytes() { + java.lang.Object ref = userAgent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + userAgent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DIRECT_USER_REQUEST_FIELD_NUMBER = 4; + private boolean directUserRequest_; + /** + * + * + *
+   * True if the request is made directly from the end user, in which case the
+   * [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
+   * [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
+   * from the HTTP request. This flag should be set only if the API request is
+   * made directly from the end user such as a mobile app (and not if a gateway
+   * or a server is processing and pushing the user events).
+   * This should not be set when using the JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
+   * 
+ * + * bool direct_user_request = 4; + * + * @return The directUserRequest. + */ + @java.lang.Override + public boolean getDirectUserRequest() { + return directUserRequest_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getUserIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, userId_); + } + if (!getIpAddressBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, ipAddress_); + } + if (!getUserAgentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, userAgent_); + } + if (directUserRequest_ != false) { + output.writeBool(4, directUserRequest_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getUserIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, userId_); + } + if (!getIpAddressBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, ipAddress_); + } + if (!getUserAgentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, userAgent_); + } + if (directUserRequest_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, directUserRequest_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UserInfo)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UserInfo other = (com.google.cloud.retail.v2.UserInfo) obj; + + if (!getUserId().equals(other.getUserId())) return false; + if (!getIpAddress().equals(other.getIpAddress())) return false; + if (!getUserAgent().equals(other.getUserAgent())) return false; + if (getDirectUserRequest() != other.getDirectUserRequest()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + USER_ID_FIELD_NUMBER; + hash = (53 * hash) + getUserId().hashCode(); + hash = (37 * hash) + IP_ADDRESS_FIELD_NUMBER; + hash = (53 * hash) + getIpAddress().hashCode(); + hash = (37 * hash) + USER_AGENT_FIELD_NUMBER; + hash = (53 * hash) + getUserAgent().hashCode(); + hash = (37 * hash) + DIRECT_USER_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDirectUserRequest()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserInfo parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UserInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UserInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Information of an end user.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UserInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UserInfo) + com.google.cloud.retail.v2.UserInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_UserInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_UserInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UserInfo.class, + com.google.cloud.retail.v2.UserInfo.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UserInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + userId_ = ""; + + ipAddress_ = ""; + + userAgent_ = ""; + + directUserRequest_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_UserInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserInfo getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UserInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserInfo build() { + com.google.cloud.retail.v2.UserInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserInfo buildPartial() { + com.google.cloud.retail.v2.UserInfo result = new com.google.cloud.retail.v2.UserInfo(this); + result.userId_ = userId_; + result.ipAddress_ = ipAddress_; + result.userAgent_ = userAgent_; + result.directUserRequest_ = directUserRequest_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UserInfo) { + return mergeFrom((com.google.cloud.retail.v2.UserInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UserInfo other) { + if (other == com.google.cloud.retail.v2.UserInfo.getDefaultInstance()) return this; + if (!other.getUserId().isEmpty()) { + userId_ = other.userId_; + onChanged(); + } + if (!other.getIpAddress().isEmpty()) { + ipAddress_ = other.ipAddress_; + onChanged(); + } + if (!other.getUserAgent().isEmpty()) { + userAgent_ = other.userAgent_; + onChanged(); + } + if (other.getDirectUserRequest() != false) { + setDirectUserRequest(other.getDirectUserRequest()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UserInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.UserInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object userId_ = ""; + /** + * + * + *
+     * Highly recommended for logged-in users. Unique identifier for logged-in
+     * user, such as a user name.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string user_id = 1; + * + * @return The userId. + */ + public java.lang.String getUserId() { + java.lang.Object ref = userId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + userId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Highly recommended for logged-in users. Unique identifier for logged-in
+     * user, such as a user name.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string user_id = 1; + * + * @return The bytes for userId. + */ + public com.google.protobuf.ByteString getUserIdBytes() { + java.lang.Object ref = userId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + userId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Highly recommended for logged-in users. Unique identifier for logged-in
+     * user, such as a user name.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string user_id = 1; + * + * @param value The userId to set. + * @return This builder for chaining. + */ + public Builder setUserId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + userId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Highly recommended for logged-in users. Unique identifier for logged-in
+     * user, such as a user name.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string user_id = 1; + * + * @return This builder for chaining. + */ + public Builder clearUserId() { + + userId_ = getDefaultInstance().getUserId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Highly recommended for logged-in users. Unique identifier for logged-in
+     * user, such as a user name.
+     * The field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string user_id = 1; + * + * @param value The bytes for userId to set. + * @return This builder for chaining. + */ + public Builder setUserIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + userId_ = value; + onChanged(); + return this; + } + + private java.lang.Object ipAddress_ = ""; + /** + * + * + *
+     * The end user's IP address. This field is used to extract location
+     * information for personalization.
+     * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+     * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string ip_address = 2; + * + * @return The ipAddress. + */ + public java.lang.String getIpAddress() { + java.lang.Object ref = ipAddress_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + ipAddress_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The end user's IP address. This field is used to extract location
+     * information for personalization.
+     * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+     * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string ip_address = 2; + * + * @return The bytes for ipAddress. + */ + public com.google.protobuf.ByteString getIpAddressBytes() { + java.lang.Object ref = ipAddress_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + ipAddress_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The end user's IP address. This field is used to extract location
+     * information for personalization.
+     * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+     * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string ip_address = 2; + * + * @param value The ipAddress to set. + * @return This builder for chaining. + */ + public Builder setIpAddress(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + ipAddress_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The end user's IP address. This field is used to extract location
+     * information for personalization.
+     * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+     * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string ip_address = 2; + * + * @return This builder for chaining. + */ + public Builder clearIpAddress() { + + ipAddress_ = getDefaultInstance().getIpAddress(); + onChanged(); + return this; + } + /** + * + * + *
+     * The end user's IP address. This field is used to extract location
+     * information for personalization.
+     * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+     * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+     * INVALID_ARGUMENT error is returned.
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string ip_address = 2; + * + * @param value The bytes for ipAddress to set. + * @return This builder for chaining. + */ + public Builder setIpAddressBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + ipAddress_ = value; + onChanged(); + return this; + } + + private java.lang.Object userAgent_ = ""; + /** + * + * + *
+     * User agent as included in the HTTP header.
+     * The field must be a UTF-8 encoded string with a length limit of 1,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * This should not be set when using the client side event reporting with
+     * GTM or JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string user_agent = 3; + * + * @return The userAgent. + */ + public java.lang.String getUserAgent() { + java.lang.Object ref = userAgent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + userAgent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User agent as included in the HTTP header.
+     * The field must be a UTF-8 encoded string with a length limit of 1,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * This should not be set when using the client side event reporting with
+     * GTM or JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string user_agent = 3; + * + * @return The bytes for userAgent. + */ + public com.google.protobuf.ByteString getUserAgentBytes() { + java.lang.Object ref = userAgent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + userAgent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User agent as included in the HTTP header.
+     * The field must be a UTF-8 encoded string with a length limit of 1,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * This should not be set when using the client side event reporting with
+     * GTM or JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string user_agent = 3; + * + * @param value The userAgent to set. + * @return This builder for chaining. + */ + public Builder setUserAgent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + userAgent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User agent as included in the HTTP header.
+     * The field must be a UTF-8 encoded string with a length limit of 1,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * This should not be set when using the client side event reporting with
+     * GTM or JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string user_agent = 3; + * + * @return This builder for chaining. + */ + public Builder clearUserAgent() { + + userAgent_ = getDefaultInstance().getUserAgent(); + onChanged(); + return this; + } + /** + * + * + *
+     * User agent as included in the HTTP header.
+     * The field must be a UTF-8 encoded string with a length limit of 1,000
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * This should not be set when using the client side event reporting with
+     * GTM or JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+     * or if
+     * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+     * is set.
+     * 
+ * + * string user_agent = 3; + * + * @param value The bytes for userAgent to set. + * @return This builder for chaining. + */ + public Builder setUserAgentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + userAgent_ = value; + onChanged(); + return this; + } + + private boolean directUserRequest_; + /** + * + * + *
+     * True if the request is made directly from the end user, in which case the
+     * [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
+     * [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
+     * from the HTTP request. This flag should be set only if the API request is
+     * made directly from the end user such as a mobile app (and not if a gateway
+     * or a server is processing and pushing the user events).
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
+     * 
+ * + * bool direct_user_request = 4; + * + * @return The directUserRequest. + */ + @java.lang.Override + public boolean getDirectUserRequest() { + return directUserRequest_; + } + /** + * + * + *
+     * True if the request is made directly from the end user, in which case the
+     * [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
+     * [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
+     * from the HTTP request. This flag should be set only if the API request is
+     * made directly from the end user such as a mobile app (and not if a gateway
+     * or a server is processing and pushing the user events).
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
+     * 
+ * + * bool direct_user_request = 4; + * + * @param value The directUserRequest to set. + * @return This builder for chaining. + */ + public Builder setDirectUserRequest(boolean value) { + + directUserRequest_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * True if the request is made directly from the end user, in which case the
+     * [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
+     * [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
+     * from the HTTP request. This flag should be set only if the API request is
+     * made directly from the end user such as a mobile app (and not if a gateway
+     * or a server is processing and pushing the user events).
+     * This should not be set when using the JavaScript tag in
+     * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
+     * 
+ * + * bool direct_user_request = 4; + * + * @return This builder for chaining. + */ + public Builder clearDirectUserRequest() { + + directUserRequest_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UserInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UserInfo) + private static final com.google.cloud.retail.v2.UserInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UserInfo(); + } + + public static com.google.cloud.retail.v2.UserInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UserInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UserInfo(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UserInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserInfoOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserInfoOrBuilder.java new file mode 100644 index 00000000..7d78a82f --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserInfoOrBuilder.java @@ -0,0 +1,160 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +public interface UserInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UserInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Highly recommended for logged-in users. Unique identifier for logged-in
+   * user, such as a user name.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string user_id = 1; + * + * @return The userId. + */ + java.lang.String getUserId(); + /** + * + * + *
+   * Highly recommended for logged-in users. Unique identifier for logged-in
+   * user, such as a user name.
+   * The field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string user_id = 1; + * + * @return The bytes for userId. + */ + com.google.protobuf.ByteString getUserIdBytes(); + + /** + * + * + *
+   * The end user's IP address. This field is used to extract location
+   * information for personalization.
+   * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+   * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This should not be set when using the JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string ip_address = 2; + * + * @return The ipAddress. + */ + java.lang.String getIpAddress(); + /** + * + * + *
+   * The end user's IP address. This field is used to extract location
+   * information for personalization.
+   * This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
+   * address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
+   * INVALID_ARGUMENT error is returned.
+   * This should not be set when using the JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string ip_address = 2; + * + * @return The bytes for ipAddress. + */ + com.google.protobuf.ByteString getIpAddressBytes(); + + /** + * + * + *
+   * User agent as included in the HTTP header.
+   * The field must be a UTF-8 encoded string with a length limit of 1,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * This should not be set when using the client side event reporting with
+   * GTM or JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string user_agent = 3; + * + * @return The userAgent. + */ + java.lang.String getUserAgent(); + /** + * + * + *
+   * User agent as included in the HTTP header.
+   * The field must be a UTF-8 encoded string with a length limit of 1,000
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * This should not be set when using the client side event reporting with
+   * GTM or JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
+   * or if
+   * [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
+   * is set.
+   * 
+ * + * string user_agent = 3; + * + * @return The bytes for userAgent. + */ + com.google.protobuf.ByteString getUserAgentBytes(); + + /** + * + * + *
+   * True if the request is made directly from the end user, in which case the
+   * [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
+   * [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
+   * from the HTTP request. This flag should be set only if the API request is
+   * made directly from the end user such as a mobile app (and not if a gateway
+   * or a server is processing and pushing the user events).
+   * This should not be set when using the JavaScript tag in
+   * [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
+   * 
+ * + * bool direct_user_request = 4; + * + * @return The directUserRequest. + */ + boolean getDirectUserRequest(); +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/WriteUserEventRequest.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/WriteUserEventRequest.java new file mode 100644 index 00000000..f3861ed4 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/WriteUserEventRequest.java @@ -0,0 +1,943 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request message for WriteUserEvent method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.WriteUserEventRequest} + */ +public final class WriteUserEventRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.WriteUserEventRequest) + WriteUserEventRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use WriteUserEventRequest.newBuilder() to construct. + private WriteUserEventRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private WriteUserEventRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new WriteUserEventRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private WriteUserEventRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.UserEvent.Builder subBuilder = null; + if (userEvent_ != null) { + subBuilder = userEvent_.toBuilder(); + } + userEvent_ = + input.readMessage( + com.google.cloud.retail.v2.UserEvent.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(userEvent_); + userEvent_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_WriteUserEventRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_WriteUserEventRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.WriteUserEventRequest.class, + com.google.cloud.retail.v2.WriteUserEventRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USER_EVENT_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.UserEvent userEvent_; + /** + * + * + *
+   * Required. User event to write.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEvent field is set. + */ + @java.lang.Override + public boolean hasUserEvent() { + return userEvent_ != null; + } + /** + * + * + *
+   * Required. User event to write.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEvent. + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEvent getUserEvent() { + return userEvent_ == null + ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() + : userEvent_; + } + /** + * + * + *
+   * Required. User event to write.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder() { + return getUserEvent(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (userEvent_ != null) { + output.writeMessage(2, getUserEvent()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (userEvent_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUserEvent()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.WriteUserEventRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.WriteUserEventRequest other = + (com.google.cloud.retail.v2.WriteUserEventRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasUserEvent() != other.hasUserEvent()) return false; + if (hasUserEvent()) { + if (!getUserEvent().equals(other.getUserEvent())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasUserEvent()) { + hash = (37 * hash) + USER_EVENT_FIELD_NUMBER; + hash = (53 * hash) + getUserEvent().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.WriteUserEventRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for WriteUserEvent method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.WriteUserEventRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.WriteUserEventRequest) + com.google.cloud.retail.v2.WriteUserEventRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_WriteUserEventRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_WriteUserEventRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.WriteUserEventRequest.class, + com.google.cloud.retail.v2.WriteUserEventRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.WriteUserEventRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (userEventBuilder_ == null) { + userEvent_ = null; + } else { + userEvent_ = null; + userEventBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.UserEventServiceProto + .internal_static_google_cloud_retail_v2_WriteUserEventRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.WriteUserEventRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.WriteUserEventRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.WriteUserEventRequest build() { + com.google.cloud.retail.v2.WriteUserEventRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.WriteUserEventRequest buildPartial() { + com.google.cloud.retail.v2.WriteUserEventRequest result = + new com.google.cloud.retail.v2.WriteUserEventRequest(this); + result.parent_ = parent_; + if (userEventBuilder_ == null) { + result.userEvent_ = userEvent_; + } else { + result.userEvent_ = userEventBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.WriteUserEventRequest) { + return mergeFrom((com.google.cloud.retail.v2.WriteUserEventRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.WriteUserEventRequest other) { + if (other == com.google.cloud.retail.v2.WriteUserEventRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasUserEvent()) { + mergeUserEvent(other.getUserEvent()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.WriteUserEventRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.WriteUserEventRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent catalog resource name, such as
+     * "projects/1234/locations/global/catalogs/default_catalog".
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.UserEvent userEvent_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder> + userEventBuilder_; + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEvent field is set. + */ + public boolean hasUserEvent() { + return userEventBuilder_ != null || userEvent_ != null; + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEvent. + */ + public com.google.cloud.retail.v2.UserEvent getUserEvent() { + if (userEventBuilder_ == null) { + return userEvent_ == null + ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() + : userEvent_; + } else { + return userEventBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEvent(com.google.cloud.retail.v2.UserEvent value) { + if (userEventBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + userEvent_ = value; + onChanged(); + } else { + userEventBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUserEvent(com.google.cloud.retail.v2.UserEvent.Builder builderForValue) { + if (userEventBuilder_ == null) { + userEvent_ = builderForValue.build(); + onChanged(); + } else { + userEventBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeUserEvent(com.google.cloud.retail.v2.UserEvent value) { + if (userEventBuilder_ == null) { + if (userEvent_ != null) { + userEvent_ = + com.google.cloud.retail.v2.UserEvent.newBuilder(userEvent_) + .mergeFrom(value) + .buildPartial(); + } else { + userEvent_ = value; + } + onChanged(); + } else { + userEventBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearUserEvent() { + if (userEventBuilder_ == null) { + userEvent_ = null; + onChanged(); + } else { + userEvent_ = null; + userEventBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEvent.Builder getUserEventBuilder() { + + onChanged(); + return getUserEventFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder() { + if (userEventBuilder_ != null) { + return userEventBuilder_.getMessageOrBuilder(); + } else { + return userEvent_ == null + ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() + : userEvent_; + } + } + /** + * + * + *
+     * Required. User event to write.
+     * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder> + getUserEventFieldBuilder() { + if (userEventBuilder_ == null) { + userEventBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.UserEvent, + com.google.cloud.retail.v2.UserEvent.Builder, + com.google.cloud.retail.v2.UserEventOrBuilder>( + getUserEvent(), getParentForChildren(), isClean()); + userEvent_ = null; + } + return userEventBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.WriteUserEventRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.WriteUserEventRequest) + private static final com.google.cloud.retail.v2.WriteUserEventRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.WriteUserEventRequest(); + } + + public static com.google.cloud.retail.v2.WriteUserEventRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public WriteUserEventRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new WriteUserEventRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.WriteUserEventRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/WriteUserEventRequestOrBuilder.java b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/WriteUserEventRequestOrBuilder.java new file mode 100644 index 00000000..c408b047 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/WriteUserEventRequestOrBuilder.java @@ -0,0 +1,93 @@ +/* + * Copyright 2020 Google LLC + * + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/user_event_service.proto + +package com.google.cloud.retail.v2; + +public interface WriteUserEventRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.WriteUserEventRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent catalog resource name, such as
+   * "projects/1234/locations/global/catalogs/default_catalog".
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. User event to write.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the userEvent field is set. + */ + boolean hasUserEvent(); + /** + * + * + *
+   * Required. User event to write.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The userEvent. + */ + com.google.cloud.retail.v2.UserEvent getUserEvent(); + /** + * + * + *
+   * Required. User event to write.
+   * 
+ * + * + * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder(); +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog.proto new file mode 100644 index 00000000..ded4ebd0 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog.proto @@ -0,0 +1,111 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "CatalogProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Configures what level the product should be uploaded with regards to +// how users will be send events and how predictions will be made. +message ProductLevelConfig { + // The type of [Product][google.cloud.retail.v2.Product]s allowed to be + // ingested into the catalog. Acceptable values are: + // + // * `primary` (default): You can only ingest + // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]s. This means + // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id] + // can only be empty or set to the same value as + // [Product.id][google.cloud.retail.v2.Product.id]. + // * `variant`: You can only ingest + // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s. + // This means + // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id] + // cannot be empty. + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // If this field is `variant` and + // [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field] + // is `itemGroupId`, an INVALID_ARGUMENT error is returned. + // + // See [Using catalog + // levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more + // details. + string ingestion_product_type = 1; + + // Which field of [Merchant Center + // Product](/bigquery-transfer/docs/merchant-center-products-schema) should be + // imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable + // values are: + // + // * `offerId` (default): Import `offerId` as the product ID. + // * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail + // API will choose one item from the ones with the same `itemGroupId`, and + // use it to represent the item group. + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // If this field is `itemGroupId` and + // [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type] + // is `variant`, an INVALID_ARGUMENT error is returned. + // + // See [Using catalog + // levels](/retail/recommendations-ai/docs/catalog#catalog-levels) for more + // details. + string merchant_center_product_id_field = 2; +} + +// The catalog configuration. +message Catalog { + option (google.api.resource) = { + type: "retail.googleapis.com/Catalog" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}" + }; + + // Required. Immutable. The fully qualified resource name of the catalog. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. The catalog display name. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string display_name = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. The product level configuration. + ProductLevelConfig product_level_config = 4 + [(google.api.field_behavior) = REQUIRED]; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog_service.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog_service.proto new file mode 100644 index 00000000..4adda8df --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog_service.proto @@ -0,0 +1,136 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/catalog.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "CatalogServiceProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Service for managing catalog configuration. +service CatalogService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with + // the project. + rpc ListCatalogs(ListCatalogsRequest) returns (ListCatalogsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/catalogs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the [Catalog][google.cloud.retail.v2.Catalog]s. + rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog) { + option (google.api.http) = { + patch: "/v2/{catalog.name=projects/*/locations/*/catalogs/*}" + body: "catalog" + }; + option (google.api.method_signature) = "catalog,update_mask"; + } +} + +// Request for +// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs] +// method. +message ListCatalogsRequest { + // Required. The account resource name with an associated location. + // + // If the caller does not have permission to list + // [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless + // of whether or not this location exists, a PERMISSION_DENIED error is + // returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If + // unspecified, defaults to 50. The maximum allowed value is 1000. Values + // above 1000 will be coerced to 1000. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 page_size = 2; + + // A page token + // [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token], + // received from a previous + // [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs] + // must match the call that provided the page token. Otherwise, an + // INVALID_ARGUMENT error is returned. + string page_token = 3; +} + +// Response for +// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs] +// method. +message ListCatalogsResponse { + // All the customer's [Catalog][google.cloud.retail.v2.Catalog]s. + repeated Catalog catalogs = 1; + + // A token that can be sent as + // [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token] + // to retrieve the next page. If this field is omitted, there are no + // subsequent pages. + string next_page_token = 2; +} + +// Request for +// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog] +// method. +message UpdateCatalogRequest { + // Required. The [Catalog][google.cloud.retail.v2.Catalog] to update. + // + // If the caller does not have permission to update the + // [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it + // exists, a PERMISSION_DENIED error is returned. + // + // If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist, + // a NOT_FOUND error is returned. + Catalog catalog = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only + // update the + // [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config] + // field, which is also the only currently supported field to update. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned. + google.protobuf.FieldMask update_mask = 2; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/common.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/common.proto new file mode 100644 index 00000000..341126af --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/common.proto @@ -0,0 +1,161 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// A custom attribute that is not explicitly modeled in +// [Product][google.cloud.retail.v2.Product]]. +message CustomAttribute { + // The textual values of this custom attribute. For example, `["yellow", + // "green"]` when the key is "color". + // + // At most 400 values are allowed. Empty values are not allowed. Each value + // must be a UTF-8 encoded string with a length limit of 256 characters. + // Otherwise, an INVALID_ARGUMENT error is returned. + // + // Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or + // [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set. + // Otherwise, an INVALID_ARGUMENT error is returned. + repeated string text = 1; + + // The numerical values of this custom attribute. For example, `[2.3, 15.4]` + // when the key is "lengths_cm". + // + // At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is + // returned. + // + // Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or + // [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set. + // Otherwise, an INVALID_ARGUMENT error is returned. + repeated double numbers = 2; +} + +// [Product][google.cloud.retail.v2.Product] thumbnail/detail image. +message Image { + // Required. URI of the image. + // + // This field must be a valid UTF-8 encoded URI with a length limit of 5,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [image_link](https://support.google.com/merchants/answer/6324350). + // Schema.org property [Product.image](https://schema.org/image). + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Height of the image in number of pixels. + // + // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + // returned. + int32 height = 2; + + // Width of the image in number of pixels. + // + // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + // returned. + int32 width = 3; +} + +// The price information of a [Product][google.cloud.retail.v2.Product]. +message PriceInfo { + // The 3-letter currency code defined in [ISO + // 4217](https://www.iso.org/iso-4217-currency-codes.html). + // + // If this field is an unrecognizable currency code, an INVALID_ARGUMENT + // error is returned. + string currency_code = 1; + + // Price of the product. + // + // Google Merchant Center property + // [price](https://support.google.com/merchants/answer/6324371). Schema.org + // property [Offer.priceSpecification](https://schema.org/priceSpecification). + float price = 2; + + // Price of the product without any discount. If zero, by default set to be + // the [price][google.cloud.retail.v2.PriceInfo.price]. + float original_price = 3; + + // The costs associated with the sale of a particular product. Used for gross + // profit reporting. + // + // * Profit = [price][google.cloud.retail.v2.PriceInfo.price] - + // [cost][google.cloud.retail.v2.PriceInfo.cost] + // + // Google Merchant Center property + // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). + float cost = 4; +} + +// Information of an end user. +message UserInfo { + // Highly recommended for logged-in users. Unique identifier for logged-in + // user, such as a user name. + // + // The field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string user_id = 1; + + // The end user's IP address. This field is used to extract location + // information for personalization. + // + // This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6 + // address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // This should not be set when using the JavaScript tag in + // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent] + // or if + // [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request] + // is set. + string ip_address = 2; + + // User agent as included in the HTTP header. + // + // The field must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // This should not be set when using the client side event reporting with + // GTM or JavaScript tag in + // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent] + // or if + // [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request] + // is set. + string user_agent = 3; + + // True if the request is made directly from the end user, in which case the + // [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and + // [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated + // from the HTTP request. This flag should be set only if the API request is + // made directly from the end user such as a mobile app (and not if a gateway + // or a server is processing and pushing the user events). + // + // This should not be set when using the JavaScript tag in + // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]. + bool direct_user_request = 4; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/import_config.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/import_config.proto new file mode 100644 index 00000000..cece6d5d --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/import_config.proto @@ -0,0 +1,251 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2/product.proto"; +import "google/cloud/retail/v2/user_event.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "ImportConfigProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Google Cloud Storage location for input content. +// format. +message GcsSource { + // Required. Google Cloud Storage URIs to input files. URI can be up to + // 2000 characters long. URIs can match the full object path (for example, + // gs://bucket/directory/object.json) or a pattern matching one or more + // files, such as gs://bucket/directory/*.json. A request can + // contain at most 100 files, and each file can be up to 2 GB. See + // [Importing product information](/recommendations-ai/docs/upload-catalog) + // for the expected file format and setup instructions. + repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; + + // The schema to use when parsing the data from the source. + // + // Supported values for product imports: + // + // * `product` (default): One JSON [Product][google.cloud.retail.v2.Product] + // per line. Each product must + // have a valid [Product.id][google.cloud.retail.v2.Product.id]. + // * `product_merchant_center`: See [Importing catalog data from Merchant + // Center](/retail/recommendations-ai/docs/upload-catalog#mc). + // + // Supported values for user events imports: + // + // * `user_event` (default): One JSON + // [UserEvent][google.cloud.retail.v2.UserEvent] per line. + // * `user_event_ga360`: Using + // https://support.google.com/analytics/answer/3437719?hl=en. + string data_schema = 2; +} + +// BigQuery source import data from. +message BigQuerySource { + // The project id (can be project # or id) that the BigQuery source is in with + // a length limit of 128 characters. If not specified, inherits the project + // id from the parent request. + string project_id = 5; + + // Required. The BigQuery data set to copy the data from with a length limit + // of 1,024 characters. + string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The BigQuery table to copy the data from with a length limit of + // 1,024 characters. + string table_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Intermediate Cloud Storage directory used for the import with a length + // limit of 2,000 characters. Can be specified if one wants to have the + // BigQuery export to a specific Cloud Storage directory. + string gcs_staging_dir = 3; + + // The schema to use when parsing the data from the source. + // + // Supported values for product imports: + // + // * `product` (default): One JSON [Product][google.cloud.retail.v2.Product] + // per line. Each product must + // have a valid [Product.id][google.cloud.retail.v2.Product.id]. + // * `product_merchant_center`: See [Importing catalog data from Merchant + // Center](/retail/recommendations-ai/docs/upload-catalog#mc). + // + // Supported values for user events imports: + // + // * `user_event` (default): One JSON + // [UserEvent][google.cloud.retail.v2.UserEvent] per line. + // * `user_event_ga360`: Using + // https://support.google.com/analytics/answer/3437719?hl=en. + string data_schema = 4; +} + +// The inline source for the input config for ImportProducts method. +message ProductInlineSource { + // Required. A list of products to update/create. Each product must have a + // valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of + // 10k items. + repeated Product products = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The inline source for the input config for ImportUserEvents method. +message UserEventInlineSource { + // Required. A list of user events to import. Recommended max of 10k items. + repeated UserEvent user_events = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Configuration of destination for Import related errors. +message ImportErrorsConfig { + // Required. Errors destination. + oneof destination { + // Google Cloud Storage path for import errors. This must be an empty, + // existing Cloud Storage bucket. Import errors will be written to a file in + // this bucket, one per line, as a JSON-encoded + // `google.rpc.Status` message. + string gcs_prefix = 1; + } +} + +// Request message for Import methods. +message ImportProductsRequest { + // Required. + // "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch" + // + // If no updateMask is specified, requires products.create permission. + // If updateMask is specified, requires products.update permission. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The desired input location of the data. + ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // The desired location of errors incurred during the Import. + ImportErrorsConfig errors_config = 3; + + // Indicates which fields in the provided imported 'products' to update. If + // not set, will by default update all fields. + google.protobuf.FieldMask update_mask = 4; +} + +// Request message for the ImportUserEvents request. +message ImportUserEventsRequest { + // Required. "projects/1234/locations/global/catalogs/default_catalog" + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The desired input location of the data. + UserEventInputConfig input_config = 2 + [(google.api.field_behavior) = REQUIRED]; + + // The desired location of errors incurred during the Import. Cannot be set + // for inline user event imports. + ImportErrorsConfig errors_config = 3; +} + +// The input config source for products. +message ProductInputConfig { + // Required. The source of the input. + oneof source { + // The Inline source for the input content for products. + ProductInlineSource product_inline_source = 1; + + // Google Cloud Storage location for the input content. + GcsSource gcs_source = 2; + + // BigQuery input source. + BigQuerySource big_query_source = 3; + } +} + +// The input config source for user events. +message UserEventInputConfig { + // The source of the input. + oneof source { + // Required. The Inline source for the input content for UserEvents. + UserEventInlineSource user_event_inline_source = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Google Cloud Storage location for the input content. + GcsSource gcs_source = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. BigQuery input source. + BigQuerySource big_query_source = 3 + [(google.api.field_behavior) = REQUIRED]; + } +} + +// Metadata related to the progress of the Import operation. This will be +// returned by the google.longrunning.Operation.metadata field. +message ImportMetadata { + // Operation create time. + google.protobuf.Timestamp create_time = 1; + + // Operation last update time. If the operation is done, this is also the + // finish time. + google.protobuf.Timestamp update_time = 2; + + // Count of entries that were processed successfully. + int64 success_count = 3; + + // Count of entries that encountered errors while processing. + int64 failure_count = 4; +} + +// Response of the +// [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the +// long running operation is done, then this message is returned by the +// google.longrunning.Operations.response field if the operation was successful. +message ImportProductsResponse { + // A sample of errors encountered while processing the request. + repeated google.rpc.Status error_samples = 1; + + // Echoes the destination for the complete errors in the request if set. + ImportErrorsConfig errors_config = 2; +} + +// Response of the ImportUserEventsRequest. If the long running +// operation was successful, then this message is returned by the +// google.longrunning.Operations.response field if the operation was successful. +message ImportUserEventsResponse { + // A sample of errors encountered while processing the request. + repeated google.rpc.Status error_samples = 1; + + // Echoes the destination for the complete errors if this field was set in + // the request. + ImportErrorsConfig errors_config = 2; + + // Aggregated statistics of user event import status. + UserEventImportSummary import_summary = 3; +} + +// A summary of import result. The UserEventImportSummary summarizes +// the import status for user events. +message UserEventImportSummary { + // Count of user events imported with complete existing catalog information. + int64 joined_events_count = 1; + + // Count of user events imported, but with catalog information not found + // in the imported catalog. + int64 unjoined_events_count = 2; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/prediction_service.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/prediction_service.proto new file mode 100644 index 00000000..d5f68ebd --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/prediction_service.proto @@ -0,0 +1,190 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2/user_event.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "PredictionServiceProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Service for making recommendation prediction. +service PredictionService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Makes a recommendation prediction. + rpc Predict(PredictRequest) returns (PredictResponse) { + option (google.api.http) = { + post: "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict" + body: "*" + }; + } +} + +// Request message for Predict method. +message PredictRequest { + // Required. Full resource name of the format: + // {name=projects/*/locations/global/catalogs/default_catalog/placements/*} + // The id of the recommendation engine placement. This id is used to identify + // the set of models that will be used to make the prediction. + // + // We currently support three placements with the following IDs by default: + // + // * `shopping_cart`: Predicts products frequently bought together with one or + // more products in the same shopping session. Commonly displayed after + // `add-to-cart` events, on product detail pages, or on the shopping cart + // page. + // + // * `home_page`: Predicts the next product that a user will most likely + // engage with or purchase based on the shopping or viewing history of the + // specified `userId` or `visitorId`. For example - Recommendations for you. + // + // * `product_detail`: Predicts the next product that a user will most likely + // engage with or purchase. The prediction is based on the shopping or + // viewing history of the specified `userId` or `visitorId` and its + // relevance to a specified `CatalogItem`. Typically used on product detail + // pages. For example - More products like this. + // + // * `recently_viewed_default`: Returns up to 75 products recently viewed by + // the specified `userId` or `visitorId`, most recent ones first. Returns + // nothing if neither of them has viewed any products yet. For example - + // Recently viewed. + // + // The full list of available placements can be seen at + // https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + string placement = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Context about the user, what they are looking at and what action + // they took to trigger the predict request. Note that this user event detail + // won't be ingested to userEvent logs. Thus, a separate userEvent write + // request is required for event logging. + UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; + + // Maximum number of results to return per page. Set this property + // to the number of prediction results needed. If zero, the service will + // choose a reasonable default. The maximum allowed value is 100. Values + // above 100 will be coerced to 100. + int32 page_size = 3; + + // The previous PredictResponse.next_page_token. + string page_token = 4; + + // Filter for restricting prediction results with a length limit of 5,000 + // characters. Accepts values for tags and the `filterOutOfStockItems` flag. + // + // * Tag expressions. Restricts predictions to products that match all of the + // specified tags. Boolean operators `OR` and `NOT` are supported if the + // expression is enclosed in parentheses, and must be separated from the + // tag values by a space. `-"tagA"` is also supported and is equivalent to + // `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings + // with a size limit of 1,000 characters. + // + // * filterOutOfStockItems. Restricts predictions to products that do not + // have a + // stockState value of OUT_OF_STOCK. + // + // Examples: + // + // * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") + // * filterOutOfStockItems tag=(-"promotional") + // * filterOutOfStockItems + // + // If your filter blocks all prediction results, nothing will be returned. If + // you want generic (unfiltered) popular products to be returned instead, set + // `strictFiltering` to false in `PredictRequest.params`. + string filter = 5; + + // Use validate only mode for this prediction query. If set to true, a + // dummy model will be used that returns arbitrary products. + // Note that the validate only mode should only be used for testing the API, + // or if the model is not ready. + bool validate_only = 6; + + // Additional domain specific parameters for the predictions. + // + // Allowed values: + // + // * `returnProduct`: Boolean. If set to true, the associated product + // object will be returned in the `results.metadata` field in the + // prediction response. + // * `returnScore`: Boolean. If set to true, the prediction 'score' + // corresponding to each returned product will be set in the + // `results.metadata` field in the prediction response. The given + // 'score' indicates the probability of an product being clicked/purchased + // given the user's context and history. + // * `strictFiltering`: Boolean. True by default. If set to false, the service + // will return generic (unfiltered) popular products instead of empty if + // your filter blocks all prediction results. + map params = 7; + + // The labels for the predict request. + // + // * Label keys can contain lowercase letters, digits and hyphens, must start + // with a letter, and must end with a letter or digit. + // * Non-zero label values can contain lowercase letters, digits and hyphens, + // must start with a letter, and must end with a letter or digit. + // * No more than 64 labels can be associated with a given request. + // + // See https://goo.gl/xmQnxf for more information on and examples of labels. + map labels = 8; +} + +// Response message for predict method. +message PredictResponse { + // PredictionResult represents the recommendation prediction results. + message PredictionResult { + // ID of the recommended product + string id = 1; + + // Additional product metadata / annotations. + // + // Possible values: + // + // * `product`: JSON representation of the product. Will be set if + // `returnProduct` is set to true in `PredictRequest.params`. + // * `score`: Prediction score in double value. Will be set if + // `returnScore` is set to true in `PredictRequest.params`. + map metadata = 2; + } + + // A list of recommended products. The order represents the ranking (from the + // most relevant product to the least). + repeated PredictionResult results = 1; + + // A unique attribution token. This should be included in the + // [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this + // recommendation, which enables accurate attribution of recommendation model + // performance. + string attribution_token = 2; + + // IDs of products in the request that were missing from the inventory. + repeated string missing_ids = 3; + + // True if the validateOnly property was set in the request. + bool validate_only = 4; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product.proto new file mode 100644 index 00000000..0d2cece6 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product.proto @@ -0,0 +1,283 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/common.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "ProductProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; +option (google.api.resource_definition) = { + type: "retail.googleapis.com/Branch" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" +}; + +// Product captures all metadata information of items to be recommended or +// searched. +message Product { + option (google.api.resource) = { + type: "retail.googleapis.com/Product" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" + }; + + // The type of this product. + enum Type { + // Default value. Default to + // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if unset. + TYPE_UNSPECIFIED = 0; + + // The primary type. + // + // As the primary unit for predicting, indexing and search serving, a + // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product] is grouped with multiple + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s. + PRIMARY = 1; + + // The variant type. + // + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s usually share some common + // attributes on the same + // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]s, but they have variant + // attributes like different colors, sizes and prices, etc. + VARIANT = 2; + + // The collection type. Collection products are bundled + // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]s or + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s that are sold together, such + // as a jewelry set with necklaces, earrings and rings, etc. + COLLECTION = 3; + } + + // Product availability. If this field is unspecified, the product is + // assumed to be in stock. + enum Availability { + // Default product availability. Default to + // [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK] + // if unset. + AVAILABILITY_UNSPECIFIED = 0; + + // Product in stock. + IN_STOCK = 1; + + // Product out of stock. + OUT_OF_STOCK = 2; + + // Product that is in pre-order state. + PREORDER = 3; + + // Product that is back-ordered (i.e. temporarily out of stock). + BACKORDER = 4; + } + + // Immutable. Full resource name of the product, such as + // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id". + // + // The branch ID must be "default_branch". + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is + // the final component of [name][google.cloud.retail.v2.Product.name]. For + // example, this field is "id_1", if + // [name][google.cloud.retail.v2.Product.name] is + // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1". + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [id](https://support.google.com/merchants/answer/6324405). Schema.org + // Property [Product.sku](https://schema.org/sku). + string id = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The type of the product. This field is output-only. + Type type = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // Variant group identifier. Must be an + // [id][google.cloud.retail.v2.Product.id], with the same parent branch with + // this product. Otherwise, an error is thrown. + // + // For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]s, this field can only be empty or + // set to the same value as [id][google.cloud.retail.v2.Product.id]. + // + // For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot + // be empty. A maximum of 2,000 products are allowed to share the same + // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT + // error is returned. + // + // Google Merchant Center Property + // [item_group_id](https://support.google.com/merchants/answer/6324507). + // Schema.org Property + // [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID). + // + // This field must be enabled before it can be used. [Learn + // more](/recommendations-ai/docs/catalog#item-group-id). + string primary_product_id = 4; + + // Product categories. This field is repeated for supporting one product + // belonging to several parallel categories. Strongly recommended using the + // full path for better search / recommendation quality. + // + // + // To represent full path of category, use '>' sign to separate different + // hierarchies. If '>' is part of the category name, please replace it with + // other character(s). + // + // For example, if a shoes product belongs to both + // ["Shoes & Accessories" -> "Shoes"] and + // ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be + // represented as: + // + // "categories": [ + // "Shoes & Accessories > Shoes", + // "Sports & Fitness > Athletic Clothing > Shoes" + // ] + // + // Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT + // error is returned. + // + // At most 250 values are allowed per + // [Product][google.cloud.retail.v2.Product]. Empty values are not allowed. + // Each value must be a UTF-8 encoded string with a length limit of 5,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [google_product_category][mc_google_product_category]. Schema.org property + // [Product.category] (https://schema.org/category). + // + // [mc_google_product_category]: + // https://support.google.com/merchants/answer/6324436 + repeated string categories = 7; + + // Required. Product title. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [title](https://support.google.com/merchants/answer/6324415). Schema.org + // property [Product.name](https://schema.org/name). + string title = 8 [(google.api.field_behavior) = REQUIRED]; + + // Product description. + // + // This field must be a UTF-8 encoded string with a length limit of 5,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [description](https://support.google.com/merchants/answer/6324468). + // schema.org property [Product.description](https://schema.org/description). + string description = 10; + + // Highly encouraged. Extra product attributes to be included. For example, + // for products, this could include the store name, vendor, style, color, etc. + // These are very strong signals for recommendation model, thus we highly + // recommend providing the attributes here. + // + // Features that can take on one of a limited number of possible values. Two + // types of features can be set are: + // + // Textual features. some examples would be the brand/maker of a product, or + // country of a customer. Numerical features. Some examples would be the + // height/weight of a product, or age of a customer. + // + // For example: `{ "vendor": {"text": ["vendor123", "vendor456"]}, + // "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]} + // }`. + // + // A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT + // error is returned. + // + // The key must be a UTF-8 encoded string with a length limit of 5,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + map attributes = 12; + + // Custom tags associated with the product. + // + // At most 250 values are allowed per + // [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8 + // encoded string with a length limit of 1,000 characters. Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // This tag can be used for filtering recommendation results by passing the + // tag as part of the + // [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter]. + // + // Google Merchant Center property + // [custom_label_0–4](https://support.google.com/merchants/answer/6324473). + repeated string tags = 13; + + // Product price and cost information. + // + // Google Merchant Center property + // [price](https://support.google.com/merchants/answer/6324371). + PriceInfo price_info = 14; + + // The timestamp when this [Product][google.cloud.retail.v2.Product] becomes + // available recommendation and search. + google.protobuf.Timestamp available_time = 18; + + // The online availability of the [Product][google.cloud.retail.v2.Product]. + // Default to + // [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]. + // + // Google Merchant Center Property + // [availability](https://support.google.com/merchants/answer/6324448). + // Schema.org Property [Offer.availability](https://schema.org/availability). + Availability availability = 19; + + // The available quantity of the item. + google.protobuf.Int32Value available_quantity = 20; + + // Canonical URL directly linking to the product detail page. + // + // This field must be a UTF-8 encoded string with a length limit of 5,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [link](https://support.google.com/merchants/answer/6324416). Schema.org + // property [Offer.url](https://schema.org/url). + string uri = 22; + + // Product images for the product. + // + // A maximum of 300 images are allowed. + // + // Google Merchant Center property + // [image_link](https://support.google.com/merchants/answer/6324350). + // Schema.org property [Product.image](https://schema.org/image). + repeated Image images = 23; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product_service.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product_service.proto new file mode 100644 index 00000000..2c659064 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product_service.proto @@ -0,0 +1,186 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/import_config.proto"; +import "google/cloud/retail/v2/product.proto"; +import "google/cloud/retail/v2/purge_config.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "ProductServiceProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Service for ingesting [Product][google.cloud.retail.v2.Product] information +// of the customer's website. +service ProductService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a [Product][google.cloud.retail.v2.Product]. + rpc CreateProduct(CreateProductRequest) returns (Product) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + body: "product" + }; + option (google.api.method_signature) = "parent,product,product_id"; + } + + // Gets a [Product][google.cloud.retail.v2.Product]. + rpc GetProduct(GetProductRequest) returns (Product) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a [Product][google.cloud.retail.v2.Product]. + rpc UpdateProduct(UpdateProductRequest) returns (Product) { + option (google.api.http) = { + patch: "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + body: "product" + }; + option (google.api.method_signature) = "product,update_mask"; + } + + // Deletes a [Product][google.cloud.retail.v2.Product]. + rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. + // + // Request processing may be synchronous. No partial updating is supported. + // Non-existing items are created. + // + // Note that it is possible for a subset of the + // [Product][google.cloud.retail.v2.Product]s to be successfully updated. + rpc ImportProducts(ImportProductsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.ImportProductsResponse" + metadata_type: "google.cloud.retail.v2.ImportMetadata" + }; + } +} + +// Request message for [CreateProduct][] method. +message CreateProductRequest { + // Required. The parent catalog resource name, such as + // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Required. The [Product][google.cloud.retail.v2.Product] to create. + Product product = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the [Product][google.cloud.retail.v2.Product], + // which will become the final component of the + // [Product.name][google.cloud.retail.v2.Product.name]. + // + // If the caller does not have permission to create the + // [Product][google.cloud.retail.v2.Product], regardless of whether or not it + // exists, a PERMISSION_DENIED error is returned. + // + // This field must be unique among all + // [Product][google.cloud.retail.v2.Product]s with the same + // [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an + // ALREADY_EXISTS error is returned. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string product_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [GetProduct][] method. +message GetProductRequest { + // Required. Full resource name of [Product][google.cloud.retail.v2.Product], + // such as + // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + // + // If the caller does not have permission to access the + // [Product][google.cloud.retail.v2.Product], regardless of whether or not it + // exists, a PERMISSION_DENIED error is returned. + // + // If the requested [Product][google.cloud.retail.v2.Product] does not exist, + // a NOT_FOUND error is returned. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; +} + +// Request message for [UpdateProduct][] method. +message UpdateProductRequest { + // Required. The product to update/create. + // + // If the caller does not have permission to update the + // [Product][google.cloud.retail.v2.Product], regardless of whether or not it + // exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2.Product] to update does not exist, + // a NOT_FOUND error is returned. + Product product = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [Product][google.cloud.retail.v2.Product] to update. The immutable and + // output only fields are NOT supported. If not set, all supported fields (the + // fields that are neither immutable nor output only) are updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for [DeleteProduct][] method. +message DeleteProductRequest { + // Required. Full resource name of [Product][google.cloud.retail.v2.Product], + // such as + // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + // + // If the caller does not have permission to delete the + // [Product][google.cloud.retail.v2.Product], regardless of whether or not it + // exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2.Product] to delete does not exist, + // a NOT_FOUND error is returned. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/purge_config.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/purge_config.proto new file mode 100644 index 00000000..d9cf6b82 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/purge_config.proto @@ -0,0 +1,79 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "PurgeConfigProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Metadata related to the progress of the Purge operation. +// This will be returned by the google.longrunning.Operation.metadata field. +message PurgeMetadata {} + +// Request message for PurgeUserEvents method. +message PurgeUserEventsRequest { + // Required. The resource name of the catalog under which the events are + // created. The format is + // "projects/${projectId}/locations/global/catalogs/${catalogId}" + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The filter string to specify the events to be deleted with a + // length limit of 5,000 characters. Empty string filter is not allowed. The + // eligible fields for filtering are: + // + // * `eventType`: Double quoted + // [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string. + // * `eventTime`: in ISO 8601 "zulu" format. + // * `visitorId`: Double quoted string. Specifying this will delete all + // events associated with a visitor. + // * `userId`: Double quoted string. Specifying this will delete all events + // associated with a user. + // + // Examples: + // + // * Deleting all events in a time range: + // `eventTime > "2012-04-23T18:25:43.511Z" + // eventTime < "2012-04-23T18:30:43.511Z"` + // * Deleting specific eventType in time range: + // `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` + // * Deleting all events for a specific visitor: + // `visitorId = "visitor1024"` + // + // The filtering fields are assumed to have an implicit AND. + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // Actually perform the purge. + // If `force` is set to false, the method will return the expected purge count + // without deleting any user events. + bool force = 3; +} + +// Response of the PurgeUserEventsRequest. If the long running operation is +// successfully done, then this message is returned by the +// google.longrunning.Operations.response field. +message PurgeUserEventsResponse { + // The total count of events purged as a result of the operation. + int64 purged_events_count = 1; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event.proto new file mode 100644 index 00000000..ca7083e5 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event.proto @@ -0,0 +1,227 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2/common.proto"; +import "google/cloud/retail/v2/product.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "UserEventProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// UserEvent captures all metadata information Retail API needs to know about +// how end users interact with customers' website. +message UserEvent { + // Required. User event type. Allowed values are: + // + // * `add-to-cart`: Products being added to cart. + // * `category-page-view`: Special pages such as sale or promotion pages + // viewed. + // * `detail-page-view`: Products detail page viewed. + // * `home-page-view`: Homepage viewed. + // * `purchase-complete`: User finishing a purchase. + // * `search`: Product search. + // * `shopping-cart-page-view`: User viewing a shopping cart. + string event_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A unique identifier for tracking visitors. + // + // For example, this could be implemented with an HTTP cookie, which should be + // able to uniquely identify a visitor on a single device. This unique + // identifier should not change if the visitor log in/out of the website. + // + // The field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Only required for + // [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents] + // method. Timestamp of when the user event happened. + google.protobuf.Timestamp event_time = 3; + + // A list of identifiers for the independent experiment groups this user event + // belongs to. This is used to distinguish between user events associated with + // different experiment setups (e.g. using Retail API, using different + // recommendation models). + repeated string experiment_ids = 4; + + // Highly recommended for user events that are the result of + // [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict]. + // This field enables accurate attribution of recommendation model + // performance. + // + // The value must be a valid + // [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token] + // for user events that are the result of + // [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict]. + // + // This token enables us to accurately attribute page view or purchase back to + // the event and the particular predict response containing this + // clicked/purchased product. If user clicks on product K in the + // recommendation results, pass + // [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token] + // as a URL parameter to product K's page. When recording events on product + // K's page, log the + // [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token] + // to this field. + string attribution_token = 5; + + // The main product details related to the event. + // + // This field is required for the following event types: + // + // * `add-to-cart` + // * `detail-page-view` + // * `purchase-complete` + // + // In a `search` event, this field represents the products returned to the end + // user on the current page (the end user may have not finished broswing the + // whole page yet). When a new page is returned to the end user, after + // pagination/filtering/ordering even for the same query, a new `search` event + // with different + // [product_details][google.cloud.retail.v2.UserEvent.product_details] is + // desired. The end user may have not finished broswing the whole page yet. + repeated ProductDetail product_details = 6; + + // Extra user event features to include in the recommendation model. + // + // The key must be a UTF-8 encoded string with a length limit of 5,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // For product recommendation, an example of extra user information is + // traffic_channel, i.e. how user arrives at the site. Users can arrive + // at the site by coming to the site directly, or coming through Google + // search, and etc. + map attributes = 7; + + // The id or name of the associated shopping cart. This id is used + // to associate multiple items added or present in the cart before purchase. + // + // This can only be set for `add-to-cart`, `purchase-complete`, or + // `shopping-cart-page-view` events. + string cart_id = 8; + + // A transaction represents the entire purchase transaction. + // + // Required for `purchase-complete` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + PurchaseTransaction purchase_transaction = 9; + + // The user's search query. + // + // The value must be a UTF-8 encoded string with a length limit of 5,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // Required for `search` events. Other event types should not set this field. + // Otherwise, an INVALID_ARGUMENT error is returned. + string search_query = 10; + + // The categories associated with a category page. + // + // To represent full path of category, use '>' sign to separate different + // hierarchies. If '>' is part of the category name, please replace it with + // other character(s). + // + // Category pages include special pages such as sales or promotions. For + // instance, a special sale page may have the category hierarchy: + // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + // + // Required for `category-page-view` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + repeated string page_categories = 11; + + // User information. + UserInfo user_info = 12; + + // Complete URL (window.location.href) of the user's current page. + // + // When using the client side event reporting with JavaScript pixel and Google + // Tag Manager, this value is filled in automatically. Maximum length 5,000 + // characters. + string uri = 13; + + // The referrer URL of the current page. + // + // When using the client side event reporting with JavaScript pixel and Google + // Tag Manager, this value is filled in automatically. + string referrer_uri = 14; + + // A unique id of a web page view. + // + // This should be kept the same for all user events triggered from the same + // pageview. For example, an item detail page view could trigger multiple + // events as the user is browsing the page. The `pageViewId` property should + // be kept the same for all these events so that they can be grouped together + // properly. + // + // When using the client side event reporting with JavaScript pixel and Google + // Tag Manager, this value is filled in automatically. + string page_view_id = 15; +} + +// Detailed product information associated with a user event. +message ProductDetail { + // Required. [Product][google.cloud.retail.v2.Product] information. + // + // Only [Product.id][google.cloud.retail.v2.Product.id] field is used when + // ingesting an event, all other product fields are ignored as we will look + // them up from the catalog. + Product product = 1 [(google.api.field_behavior) = REQUIRED]; + + // Quantity of the product associated with the user event. + // + // For example, this field will be 2 if two products are added to the shopping + // cart for `purchase-complete` event. Required for `add-to-cart` and + // `purchase-complete` event types. + google.protobuf.Int32Value quantity = 2; +} + +// A transaction represents the entire purchase transaction. +message PurchaseTransaction { + // The transaction ID with a length limit of 128 characters. + string id = 1; + + // Required. Total non-zero revenue or grand total associated with the + // transaction. This value include shipping, tax, or other adjustments to + // total revenue that you want to include as part of your revenue + // calculations. + float revenue = 2 [(google.api.field_behavior) = REQUIRED]; + + // All the taxes associated with the transaction. + float tax = 3; + + // All the costs associated with the products. These can be manufacturing + // costs, shipping expenses not borne by the end user, or any other costs, + // such that: + // + // * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] - + // [tax][google.cloud.retail.v2.PurchaseTransaction.tax] - + // [cost][google.cloud.retail.v2.PurchaseTransaction.cost] + float cost = 4; + + // Required. Currency code. Use three-character ISO-4217 code. + string currency_code = 5 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event_service.proto b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event_service.proto new file mode 100644 index 00000000..a73b63e1 --- /dev/null +++ b/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event_service.proto @@ -0,0 +1,188 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.proto"; +import "google/cloud/retail/v2/import_config.proto"; +import "google/cloud/retail/v2/purge_config.proto"; +import "google/cloud/retail/v2/user_event.proto"; +import "google/longrunning/operations.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "UserEventServiceProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Service for ingesting end user actions on the customer website. +service UserEventService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Writes a single user event. + rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write" + body: "user_event" + }; + } + + // Writes a single user event from the browser. This uses a GET request to + // due to browser restriction of POST-ing to a 3rd party domain. + // + // This method is used only by the Retail API JavaScript pixel and Google Tag + // Manager. Users should not call this method directly. + rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + }; + } + + // Deletes permanently all user events specified by the filter provided. + // Depending on the number of events specified by the filter, this operation + // could take hours or days to complete. To test a filter, use the list + // command first. + rpc PurgeUserEvents(PurgeUserEventsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.PurgeUserEventsResponse" + metadata_type: "google.cloud.retail.v2.PurgeMetadata" + }; + } + + // Bulk import of User events. Request processing might be + // synchronous. Events that already exist are skipped. + // Use this method for backfilling historical user events. + // + // Operation.response is of type ImportResponse. Note that it is + // possible for a subset of the items to be successfully inserted. + // Operation.metadata is of type ImportMetadata. + rpc ImportUserEvents(ImportUserEventsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.ImportUserEventsResponse" + metadata_type: "google.cloud.retail.v2.ImportMetadata" + }; + } + + // Triggers a user event rejoin operation with latest product catalog. Events + // will not be annotated with detailed product information if product is + // missing from the catalog at the time the user event is ingested, and these + // events are stored as unjoined events with a limited usage on training and + // serving. This API can be used to trigger a 'join' operation on specified + // events with latest version of product catalog. It can also be used to + // correct events joined with wrong product catalog. + rpc RejoinUserEvents(RejoinUserEventsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "RejoinUserEventsResponse" + metadata_type: "RejoinUserEventsMetadata" + }; + } +} + +// Request message for WriteUserEvent method. +message WriteUserEventRequest { + // Required. The parent catalog resource name, such as + // "projects/1234/locations/global/catalogs/default_catalog". + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. User event to write. + UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for CollectUserEvent method. +message CollectUserEventRequest { + // Required. The parent catalog name, such as + // "projects/1234/locations/global/catalogs/default_catalog". + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. URL encoded UserEvent proto with a length limit of 2,000,000 + // characters. + string user_event = 2 [(google.api.field_behavior) = REQUIRED]; + + // The URL including cgi-parameters but excluding the hash fragment with a + // length limit of 5,000 characters. This is often more useful than the + // referer URL, because many browsers only send the domain for 3rd party + // requests. + string uri = 3; + + // The event timestamp in milliseconds. This prevents browser caching of + // otherwise identical get requests. The name is abbreviated to reduce the + // payload bytes. + int64 ets = 4; +} + +// Request message for RejoinUserEvents method. +message RejoinUserEventsRequest { + // The scope of user events to be rejoined with the latest product catalog. + // If the rejoining aims at reducing number of unjoined events, set + // UserEventRejoinScope to UNJOINED_EVENTS. + // If the rejoining aims at correcting product catalog information in joined + // events, set UserEventRejoinScope to JOINED_EVENTS. + // If all events needs to be rejoined, set UserEventRejoinScope to + // USER_EVENT_REJOIN_SCOPE_UNSPECIFIED. + enum UserEventRejoinScope { + // Rejoin all events with the latest product catalog, including both joined + // events and unjoined events. + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0; + + // Only rejoin joined events with the latest product catalog. + JOINED_EVENTS = 1; + + // Only rejoin unjoined events with the latest product catalog. + UNJOINED_EVENTS = 2; + } + + // Required. The parent catalog resource name, such as + // "projects/1234/locations/global/catalogs/default_catalog". + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The type of the user event rejoin to define the scope and range of the user + // events to be rejoined with the latest product catalog. Defaults to + // USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an + // invalid integer value. + UserEventRejoinScope user_event_rejoin_scope = 2; +} + +// Response message for RejoinUserEvents method. +message RejoinUserEventsResponse { + // Number of user events that were joined with latest product catalog. + int64 rejoined_user_events_count = 1; +} + +// Metadata for RejoinUserEvents method. +message RejoinUserEventsMetadata {} diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..96762e4d --- /dev/null +++ b/renovate.json @@ -0,0 +1,73 @@ +{ + "extends": [ + ":separateMajorReleases", + ":combinePatchMinorReleases", + ":ignoreUnstable", + ":prImmediately", + ":updateNotScheduled", + ":automergeDisabled", + ":ignoreModulesAndTests", + ":maintainLockFilesDisabled", + ":autodetectPinVersions" + ], + "packageRules": [ + { + "packagePatterns": [ + "^com.google.guava:" + ], + "versionScheme": "docker" + }, + { + "packagePatterns": [ + "*" + ], + "semanticCommitType": "deps", + "semanticCommitScope": null + }, + { + "packagePatterns": [ + "^org.apache.maven", + "^org.jacoco:", + "^org.codehaus.mojo:", + "^org.sonatype.plugins:", + "^com.coveo:", + "^com.google.cloud:google-cloud-shared-config" + ], + "semanticCommitType": "build", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-retail", + "^com.google.cloud:libraries-bom", + "^com.google.cloud.samples:shared-configuration" + ], + "semanticCommitType": "chore", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^junit:junit", + "^com.google.truth:truth", + "^org.mockito:mockito-core", + "^org.objenesis:objenesis" + ], + "semanticCommitType": "test", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-" + ], + "ignoreUnstable": false + }, + { + "packagePatterns": [ + "^com.fasterxml.jackson.core" + ], + "groupName": "jackson dependencies" + } + ], + "semanticCommits": true, + "masterIssue": true +} diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml new file mode 100644 index 00000000..dc31e463 --- /dev/null +++ b/samples/install-without-bom/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + retail-install-without-bom + jar + Google Cloud Retail Install Without Bom + https://github.com/googleapis/java-retail + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + com.google.cloud + google-cloud-retail + 0.0.0 + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + diff --git a/samples/pom.xml b/samples/pom.xml new file mode 100644 index 00000000..44a373f5 --- /dev/null +++ b/samples/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + com.google.cloud + google-cloud-retail-samples + 0.0.1-SNAPSHOT + pom + Google Cloud Retail Samples Parent + https://github.com/googleapis/java-retail + + Java idiomatic client for Google Cloud Platform services. + + + + + com.google.cloud.samples + shared-configuration + 1.0.18 + + + + 1.8 + 1.8 + UTF-8 + + + + install-without-bom + snapshot + snippets + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + + true + + + + + diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml new file mode 100644 index 00000000..63e740d2 --- /dev/null +++ b/samples/snapshot/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + com.google.cloud + retail-snapshot + jar + Google Cloud Retail Snapshot Samples + https://github.com/googleapis/java-retail + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-retail + 0.0.0 + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + \ No newline at end of file diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml new file mode 100644 index 00000000..0d132dae --- /dev/null +++ b/samples/snippets/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + com.google.cloud + retail-snippets + jar + Google Cloud Retail Snippets + https://github.com/googleapis/java-retail + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-retail + 0.0.0 + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + diff --git a/synth.metadata b/synth.metadata new file mode 100644 index 00000000..e2cff5fe --- /dev/null +++ b/synth.metadata @@ -0,0 +1,37 @@ +{ + "sources": [ + { + "git": { + "name": ".", + "remote": "sso://devrel/cloud/libraries/java/repo-splitter", + "sha": "7e5c8c380dfbdfee028d2fce8dc7a93e5c729192" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "53eb2512a55caabcbad1898225080a2a3dfcb6aa", + "internalRef": "346818879" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "352f25621c28d2fa0784984ea0ed5ea697aa1525" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "retail", + "apiVersion": "v2", + "language": "java", + "generator": "bazel" + } + } + ] +} \ No newline at end of file diff --git a/synth.py b/synth.py new file mode 100644 index 00000000..43b47374 --- /dev/null +++ b/synth.py @@ -0,0 +1,32 @@ +# Copyright 2020 Google LLC +# +# 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. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.gcp as gcp +import synthtool.languages.java as java + +service = 'retail' +versions = ['v2'] + +for version in versions: + java.bazel_library( + service=service, + version=version, + proto_path=f'google/cloud/{service}/{version}', + bazel_target=f'//google/cloud/{service}/{version}:google-cloud-{service}-{version}-java', + ) + +java.common_templates() \ No newline at end of file diff --git a/versions.txt b/versions.txt new file mode 100644 index 00000000..7789aa3f --- /dev/null +++ b/versions.txt @@ -0,0 +1,6 @@ +# Format: +# module:released-version:current-version + +google-cloud-retail:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-retail-v2:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-retail-v2:0.0.0:0.0.1-SNAPSHOT \ No newline at end of file